...
Question 4530 – Higher-Education-System
April 2, 2024
Question 6734 – UGC NET CS 2016 July- paper-3
April 2, 2024
Question 4530 – Higher-Education-System
April 2, 2024
Question 6734 – UGC NET CS 2016 July- paper-3
April 2, 2024

Question 10497 – Programming

(a) What type of parameter passing mechanism (call-by-value, call-by-reference, call-by-name, or-by-value result) is the following sequence of actions truing to implement for a procedure call P(A[i]) where P(i:integer) is a procedure
and A is an integer array?

 1. Create a new local variable, say z.
 2. Assign to z the value of A[i].
 3. Execute the body of P using z for A[i]
 4. Set A[i] to z. 

Is the implementation correct? Explain and correct it if necessary. You are supposed to make only small changes.

(b) Show the activation records and the display structure just after the procedures called at lines marked x and y have started their execution. Be sure to indicate which of the two procedures named A you are referring to.

 Program Test;
   Procedure A;
     Procedure B;
       Procedure A;
     ……
   end a;
 begin
   y:A;
   end B;
 begin
   B;
   end A;
 begin
   x:A;
 end Test. 

Correct Answer: A

A
Theory Explanation.
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!!