Question: CS 3 0 0 3 : Comparative Programming Languages Fall 2 0 2 4 Wainwright Homework Set 4 2 5 points Due: Friday November 2
CS : Comparative Programming Languages Fall
Wainwright Homework Set points
Due: Friday November at class time.
In each case YOU MUST SHOW ALL OF YOUR WORK and work independently.
Consider the following code:
program MAIN;
var i : integer;
var a : array of integer;
procedure SUBx : integer;
x; ai : ai; i; x; ai : ai x; x; i; ai : ai x;
end SUBPROG
a :; a :; a :; a :; a :; i :;
call SUBai;
print a;
end MAIN
Note: Assume that all uninitialized variables have the value zero.
Note: For each question below a through f work must accompany your solution.
Show in detail the trace you used to arrive at each of the answers.
pts
a What is the program output assuming that the parameter is passed by value?
pts
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.
Also assume the initial value for x is zero.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
