Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE CS 1997 | Question 54

Improve Article
Save Article
Like Article
  • Last Updated : 24 Oct, 2017
Improve Article
Save Article
Like Article

[5-Marks question]

Consider the following program in Pseudo-Pascal syntax.

program what:
    var z: integer
    procedure recur(x):
    begin if x <= 40 then
        begin x:x+z
            recur(x);
            z:=x+10
        end
    end(*recur*)
begin(*what*)
    z=10;
    recur(z);
    writeln(z)
end

a. Suppose the parameter to the procedure ‘recur’ is passed by value.
i. What value is printed by program?
ii. How many times is ‘recur’ called?
b. What value is printed by the program if the parameter is passed by reference?


Answer:

Explanation:

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!