Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the answer for E and F. Please explain (b) [I pr.I Write down the size of a stackframe of outputseq () . readMinMax

What is the answer for E and F. Please explain

image text in transcribedimage text in transcribedimage text in transcribed

(b) [I pr.I Write down the size of a stackframe of outputseq () . readMinMax () + readhrrsiz() and exam (). ANSWERS: outputSeq(3:___ readminMax (1)___ readArrSiz():__ exam(1): Qurstions (c) - (i) ask you about the state of the virtual machine at the time of the debugging.stop after execution of 519 instructions: (c) 0.5pt.) What is the data memory address of results [3]? (results is a static variable declared on the 3ni non-blank line of the program on p. 5.) ANSWER: (d) 0.5 pt. ) Name the method whose code is being executed. ANSWER: (c) [0.5 pt. ] What is the data memory address of offset 0 in the currently executing method activation's stackframe? ANSWER: (f) 11 pt.l What are the addresses of the data memory locations that constitute the stackframe of the currently executing method activation? ANSWER: (g) [1.5 pts.] What values are stored in the locations of the formal parameter(s) and local variable(s) of the executing method activation? For each parameter and each local variable, write down its name followed by the value stored in its location: ANSWER: (h) [0.5 pt.] Name the method that called the executing method. ANSWER: (i) [1 pt.] What are the addresses of the data memory locations that constitute the stackframe of the caller? (This must be a stackframe of the method named in (h).) ANS WVER: Now suppose the debugging stop had not occurred after execution of 519 instructions. (j) [1.5 pt.] Write down the code memory addresses of the three instructions that would have been executed next, in the order in which those instructions would have been executed. (ln other words, write down the code memory addresses of the instructions that would have been the 520ih,5215t, and 522nd instructions to be executed, in that order.) ANSWERS: (k) 11 pt.] Immediatelv afler execution of the three instructions you identified in (j), what would ASP and ESP have contained? ANSWERS: ASP: ESP: IMPORTANT: Read the remarks at the bottom of p. 4 before you answer the following questions. (a) [1 pt.] For each of the methods outputseg(), readMinMax (), readArrSiz (), and exam () in the program on the previous page, say how many locations (if any) are allocated in its stackframes to local variables declared within the method's bods. ANSWERS: outputseq (): readMinMax (): readarrsiz(): exam(): therectawa. ut 11. Bctaner? int it =ininax [03; Whito {1 minmax [1],1;; in code memory: Instructions at addresses 196205 syatem.out.printins"Bai anawezt": ; en ae argsreatipin =17 196: PUSHNUM 1 PUSHNUM Inr arraysizefedd - Gi System.put,print ("max num oE terms: "); 202: PUSHLOCADDR if \{arraysize \& 1\} System.out.printini"Bad answer!"'; 204: PUSHSTATADDR 2 205: 205 : LOADFROMADDR System, out, println; "Not enough mem!"?; eise arraysizeread =2; suits = new intlarraysize]; Page 5 of 10 (b) [I pr.I Write down the size of a stackframe of outputseq () . readMinMax () + readhrrsiz() and exam (). ANSWERS: outputSeq(3:___ readminMax (1)___ readArrSiz():__ exam(1): Qurstions (c) - (i) ask you about the state of the virtual machine at the time of the debugging.stop after execution of 519 instructions: (c) 0.5pt.) What is the data memory address of results [3]? (results is a static variable declared on the 3ni non-blank line of the program on p. 5.) ANSWER: (d) 0.5 pt. ) Name the method whose code is being executed. ANSWER: (c) [0.5 pt. ] What is the data memory address of offset 0 in the currently executing method activation's stackframe? ANSWER: (f) 11 pt.l What are the addresses of the data memory locations that constitute the stackframe of the currently executing method activation? ANSWER: (g) [1.5 pts.] What values are stored in the locations of the formal parameter(s) and local variable(s) of the executing method activation? For each parameter and each local variable, write down its name followed by the value stored in its location: ANSWER: (h) [0.5 pt.] Name the method that called the executing method. ANSWER: (i) [1 pt.] What are the addresses of the data memory locations that constitute the stackframe of the caller? (This must be a stackframe of the method named in (h).) ANS WVER: Now suppose the debugging stop had not occurred after execution of 519 instructions. (j) [1.5 pt.] Write down the code memory addresses of the three instructions that would have been executed next, in the order in which those instructions would have been executed. (ln other words, write down the code memory addresses of the instructions that would have been the 520ih,5215t, and 522nd instructions to be executed, in that order.) ANSWERS: (k) 11 pt.] Immediatelv afler execution of the three instructions you identified in (j), what would ASP and ESP have contained? ANSWERS: ASP: ESP: IMPORTANT: Read the remarks at the bottom of p. 4 before you answer the following questions. (a) [1 pt.] For each of the methods outputseg(), readMinMax (), readArrSiz (), and exam () in the program on the previous page, say how many locations (if any) are allocated in its stackframes to local variables declared within the method's bods. ANSWERS: outputseq (): readMinMax (): readarrsiz(): exam(): therectawa. ut 11. Bctaner? int it =ininax [03; Whito {1 minmax [1],1;; in code memory: Instructions at addresses 196205 syatem.out.printins"Bai anawezt": ; en ae argsreatipin =17 196: PUSHNUM 1 PUSHNUM Inr arraysizefedd - Gi System.put,print ("max num oE terms: "); 202: PUSHLOCADDR if \{arraysize \& 1\} System.out.printini"Bad answer!"'; 204: PUSHSTATADDR 2 205: 205 : LOADFROMADDR System, out, println; "Not enough mem!"?; eise arraysizeread =2; suits = new intlarraysize]; Page 5 of 10

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

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

Question

Using Language That Works

Answered: 1 week ago

Question

4. Are my sources relevant?

Answered: 1 week ago