Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions