...
NTA-UGC-NET 2021 Dec & 2022 June Paper-2
October 4, 2023
Artificial-Intelligence
October 4, 2023
NTA-UGC-NET 2021 Dec & 2022 June Paper-2
October 4, 2023
Artificial-Intelligence
October 4, 2023

Question 4

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?

A
Theory Explanation.
Correct Answer: A
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!