Question: Consider the following code. program MAN; var i : integer; var a : array [ 1 . . 5 ] of integer; procedure SUB (

Consider the following code.
program MAN;
var i : integer;
var a : array[1..5] of integer;
procedure SUB(x : integer);
{x++;a[i]:=a[i-1]+3;i:=i++;x++;a[i]:=a[i+1]+x;x++;}( endSUBPROG)
{a[1]:=2;a[2]:=1;a[3]:=2;a[4]:=3;a[5]:=3;i:=2;
call SUB(ali);
print(a[1..5]);}(endMAIN)
NOTE: Assume that all uninitialized variables have the value zero.
(a) What is the program output assuming that the parameter is passed by value?
(b) What is the program output assuming that the parameter is passed by result?
Assume that the address of the pass by result parameter is bound at the time of call.
(c) What is the program output assuming that the parameter is passed by result?
Assume that the address of the pass by result parameter is bound at the time of return.
(d) What is the program output assuming that the parameter is passed by value-result?
Assume that the address of the pass by result parameter is bound at the time of call.
(e) What is the program output assuming that the parameter is passed by reference?
(f) What is the program output assuming that the parameter is passed by name?
 Consider the following code. program MAN; var i : integer; var

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!