Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The diagram below shows a snapshot of the run-time stack on an LC-3 system while

ID: 3739811 • Letter: T

Question

The diagram below shows a snapshot of the run-time stack on an LC-3 system while the minMax function is running. There is a comment that identifies the precise location of the snapshot. Answer the following questions about this program.

What is the return address of the minMax function?

When minMax returns, at what address will it store its return value?

What is the current value of variable z in the main function? What does it’s value tell you about the while loop?

What is the value of variable t, x, min, and max in the minMax function at the current snapshot? What is the value of *min and *max at the current snapshot?

Is there any meaning behind the value held at address R5+3 when the snapshot is taken?

Which activation records are currently on the stack?

What is the meaning of the value at address 0xFFC6?

What will the value of R5 be after main returns?

int minMax(int *x, int "min, int *max) static double average-0; //global static int count-0; lIglobal intt -*x; count++ average (average (count-1) + "x)/count; R5 13 0xFFCE 0x3104 if(t>"max) max t FFCE FFCD FFCC 20 104 3 if (t average; int main) 0xFFD5 0xFFCF int x=0, min=0, max=0; int z-0; if (1 scanf("%d",8x)) { min X; max = x; ) elsef return 0; while(1-scanf"%d", &x;)) z+-minMax(&x;, &min;, &max;); printf("%d %dn", min, max); return 0

Explanation / Answer

A. Reaturan address of minmax function is oxFFAD OXFFB8

B. When minimax returan, at ox FFB9 ADDRES WILL IT STORE ITS RETURN VALUE.

C. The current value of variable z in the main function is oxFFB9.

D. The current value of variable t in minmax function is oxFFB8

E. 12 times the while loop in the main function has executed .

F The meaning of the value held at address oxFFB9 is the next max value.

G. 31, oxFFB7, ox4101,0, fFFB7, FFB6, FFB5,9,61,1, 31, oxFFBF these are activation records currently on the stack.