Docsity

Quiz 3 with Answer Key for Machine Dependent Program | ECS 050, Quizzes of Computer Science

Toggle sidebar
bg1
Name: _____Answer Key____________
ECS 50 Winter 2004 Section 2 Quiz 3 2/13/2004
1. Stack pointer/SP/ESP points to the top of the stack.
2. Considering the code where prog is a subroutine,
push $20
push $5
push $11
call prog
pop %edx
pop %edx
pop %edx
addl %eax, %ebx
Which of the following instruction can copy the value 20 from the stack (passing by
parameter) to %ecx?
a. movl %esp, %ecx
b. movl 4(%esp), %ecx
c. movl 8(%esp), %ecx
d. movl 12(%esp), %ecx
Answer: ____D__________
Stack
$20
$5
$11
return address
ESPi = ESP before executing the code
ESPa = ESP after it calls the subroutine
ESP
i
ESP
a

Partial preview of the text

Download Quiz 3 with Answer Key for Machine Dependent Program | ECS 050 and more Quizzes Computer Science in PDF only on Docsity!

Name: _____Answer Key____________

ECS 50 Winter 2004 Section 2 Quiz 3 2/13/

  1. Stack pointer/SP/ESP points to the top of the stack.
  2. Considering the code where prog is a subroutine,

push $ push $ push $ call prog pop %edx pop %edx pop %edx addl %eax, %ebx

Which of the following instruction can copy the value 20 from the stack (passing by parameter) to %ecx?

a. movl %esp, %ecx b. movl 4(%esp), %ecx c. movl 8(%esp), %ecx d. movl 12(%esp), %ecx

Answer: ____D__________

Stack

$ $ $ return address

ESPi = ESP before executing the code ESPa = ESP after it calls the subroutine

ESPi

ESPa