Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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). a=8,b=6,c=3,d=5

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions