Let P be the following procedure, written using Ada syntax: procedure P (M: out
ID: 3615553 • Letter: L
Question
Let P be the following procedure, written using Ada syntax:procedure P (M: out Integer;N: out Integer) is begin M := 3; I := I + 1; N := 7; end P;
I is a global variable. Now, suppose that the followingstatements are executed:
I := 2; A(I) := 4; P(A(I), A(I));
For each of the following sets of assumptions, indicate whatthe value of A(2) will be after the call of P.
(a) M and N are passed by result. Result parameters are copiedout from left to right when a procedure returns. The addresses ofits actual parameters are computed at the time a procedure iscalled.
(b) M and N are passed by result. Result parameters arecopied out from right to left when a procedure returns. Theaddresses of its actual parameters are computed at the time aprocedure is called.
(c) M and N are passed by result. Result parameters arecopied out from left to right when a procedure returns.The addresses of its actual parameters are computed at the time aprocedure is returns.
(d) M and N are passed by result. Result parameters arecopied out from right to left when a procedure returns. Theaddresses of its actual parameters are computed at the time aprocedure is returns.
(e) M and N are passed by references.
(f) M and N are passed by Name.
procedure P (M: out Integer;N: out Integer) is begin M := 3; I := I + 1; N := 7; end P;
I is a global variable. Now, suppose that the followingstatements are executed:
I := 2; A(I) := 4; P(A(I), A(I));
For each of the following sets of assumptions, indicate whatthe value of A(2) will be after the call of P.
(a) M and N are passed by result. Result parameters are copiedout from left to right when a procedure returns. The addresses ofits actual parameters are computed at the time a procedure iscalled.
(b) M and N are passed by result. Result parameters arecopied out from right to left when a procedure returns. Theaddresses of its actual parameters are computed at the time aprocedure is called.
(c) M and N are passed by result. Result parameters arecopied out from left to right when a procedure returns.The addresses of its actual parameters are computed at the time aprocedure is returns.
(d) M and N are passed by result. Result parameters arecopied out from right to left when a procedure returns. Theaddresses of its actual parameters are computed at the time aprocedure is returns.
(e) M and N are passed by references.
(f) M and N are passed by Name.
Explanation / Answer
HELP...............
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.