-
Consider the following code written in a pass-byreference language like FORTRAN 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, ib + 5)
print *, ia, ib
end
S1 : The compiler will generate code to allocate a temporary nameless cell, initialize it to 13 and pass the address of the cell swap
S2 : On execution the code will generate a run time error on line L1
S3 : On execution the code will generate a run time error on line L2
S4 : The program will print 13 and 8
S5 : The program will print 13 and –2
Exactly which of the following sets of statements is/ are correct ?
-
- S1 and S2
- S1 and S4
- S3
- S1 and S5
- S1 and S2
Correct Option: B
S1 : Yes the compiler will generate a temporary nameless cell & initialize it to 13 and pass to swap.
S2 : No error
S3 : No error
S4 : Program will print 13 and 8
S5 : False. Hence (b) is correct option.