Question 9851 – Programming
February 13, 2024
Question 9782 – Programming
February 13, 2024
Question 9851 – Programming
February 13, 2024
Question 9782 – Programming
February 13, 2024

Question 9873 – Programming

Consider the following program is pseudo-Pascal syntax.

    program main;
       var x: integer;
       procedure Q [z:integer);
       begin
          z: z + x;
          writeln(z)
       end;
    procedure P (y:integer);
          var x: integer;
       begin
          x: y + 2;
          Q(x);
          writeln(x)
       end;
       begin 
          x:=5;
          P(x);
          Q(x);
          writeln(x)
       end. 

What is the output of the program, when
(a) The parameter passing mechanism is call-by-value and the scope rule is static scooping?

(b) The parameter passing mechanism is call-by-reference and the scope rule is dynamic scooping?

Correct Answer: A

Question 28 Explanation: 
Note: Out of syllabus.
A
Theory Explanation is given below.
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!!