Question: //Programming Languages //Please answer the following 2. Consider the following procedure: procedure mystery (x, y, z); integer x, y, z; begin x = 1; z

//Programming Languages

//Please answer the following

2. Consider the following procedure:

procedure mystery (x, y, z); integer x, y, z;

begin

x = 1;

z = y + x;

end

and consider the following code fragment:

A[1] := 2;

A[2] := 1;

n := 2;

mystery (n, A[1], A[n]);

(a) What will be the final values of n, A[1] and A[2] if the parameters are passed by

reference?

(b) What will be the final values of n, A[1] and A[2] if the parameters are passed by

value?

(c) What will be the final values of n, A[1] and A[2] if the parameters are passed by

name?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!