What does the following code do? var a, b : integer; begin a:=a+b; b:=a-b;…

GATE · 1993 · CS · Question 7 subparts

What does the following code do?

var a, b : integer;

begin

a:=a+b;

b:=a-b;

a:=a-b

end;

  1. A.

    exchanges a and b

  2. B.

    doubles a and stores in b

  3. C.

    doubles b and stores in a

  4. D.

    leaves a and b unchanged

  5. E.

    none of the above

Attempted by 160 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…