Consider the following program in pseudo-Pascal syntax. What is printed by the…

PYQ GATE 1996

Consider the following program in pseudo-Pascal syntax. What is printed by the program if parameter a in procedure test1 is passed as:

(i) a call-by-reference parameter?

(ii) a call-by-value-result parameter?

program Example (input, output)
var b: integer;
procedure test2:
begin b:=10; end
procedure test1 (a:integer):
begin
    a:=5;
    writeln ('point 1: ', a, b);
    test2;
    writeln ('point 2: ', a, b);
end
begin (*Example*)
    b:=3; test1(b);
    writeln('point3: ', b);
end

Sign up free to check your answer

Sign up free

Explore the full course: Compiler Design

Loading lesson…