Question: Consider the following pseudocode: int a : = the 5 th digit of your Student ID ; int b : = the 6 th digit

Consider the following pseudocode:
int a := the 5th digit of your Student ID ;
int b := the 6th digit of your Student ID ;
int c := the 7th digit of your Student ID ;
int d := the 8th digit of your Student ID ;
int z; // global variable
procedure f(int x){
if a > b and c > d then z := a - d;
elseif a > b and c <= d then x := d - c;
elseif a <= b and c > d then x := c - a;
else z := d - a;
endif;
... insert code ...
}
// The main execution starts here.
z := a;
f(z);
print(z);
Insert your own code where indicated above. Your code cannot modify the values of a, b,
c, and d. Your code must simultaneously make the execution of the program:
(a) print a number that is greater or equal than (a+5)4 with print(z) above, if executed
using call by reference.
(b) print a number that is smaller or equal than b with print(z) above, if executed using
call by value-result.
Remember: Do not provide two code solutions (one for (a) and one for (b)). You will have
to provide the same code that simultaneously satisfies (a) and (b).

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!