Gate CS-2006 Question Paper With Solutions

Q. 15 Consider the following code written in a pass-by reference language like FORTAN and these statements about the code.

subroutine swap(ix,iy)
     it = ix
L1 : ix = iy
L2 : iy = it
end
  ia = 3
  ib = 8
  call swap (ia, 1b+5)
  print *, ia, ib
end
S1: The complier will generate code to allocate a temporary nameless cell,

initialize it to 13, and pass the address of the cell to swap

S2: On execution the code will generate a runtime error on line 1.1

S3: On execution the code will generate a runtime error on line 1.2

S4: The program will print 13 and 8

S5: The program will print 13 and-2

Exactly the following set of statement (s) is correct:

(A) S1 and S2

(B) S1 and S4

(C) S3

(D) S1 and S5

Answer: (B)

Explanation: Gate CS-2006 Question Paper With Solutions

Learn More:   Gate ME-2016-3 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here