Module 5 Summary Exercises

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

on the stack

Which offers a more flexible approach, passing arguments to procedures in registers, or on the stack?

1) 11 2) 1C33 3) 99

1) At Execution Point B, what is the decimal value in EBX ? 2) At Execution Point B, what is the hexadecimal value in ESP ? 3) At Execution Point B, what is the decimal value in ?

What is the current value of the stack pointer (in 4 byte hex)? 04CA What is the value at the top of the stack (in 4 byte hex)? 0120

1) What is the current value of the stack pointer (in 4 byte hex)? 2) What is the value at the top of the stack (in 4 byte hex)?

1) 08FCh 2) 0120h

1) What is the current value of the stack pointer (in 4 byte hex)? 2) What is the value at the top of the stack (in 4 byte hex)?

1) 4D6 2) 1F

1) What is the current value of the stack pointer (in 4 byte hex)? 2) What is the value at the top of the stack (in 4 byte hex)?

1) 8F8 2) 2A5

1) What is the current value of the stack pointer (in 4 byte hex)? 2) What is the value at the top of the stack (in 4 byte hex)?

Activation record

Another name for a stack frame is

arguments

Values passed to a subrou"ne by a calling program are called __________.

5

What will be the value of EAX when the following sequence of instructions has executed? PUSH 5 PUSH 10 POP EBX POP EAX

params

When values are received by a called subrou"ne, they are called __________.

b

Which of the following code sequences assigns the value 10 to EBX ?

2) CALL 3) PUSH 4) RET 5) POP

Which of the following instructions always modify the ESP register? (Check all that apply) 1) JMP 2) CALL 3) PUSH 4) RET 5) POP 6)JNE 7) INC 8) DEC

T

T/F In the IA32 architecture, ESP (the stack pointer) is incremented each time data is popped from the stack.

EIP

The RET instruction pops the top of the stack into what register?

a) on the stack

Which offers a more flexible approach, passing arguments to procedures in registers, or on the stack? a) on the stack b) in registers

a) on the stack

Which offers a more flexible approach, passing arguments to procedures in registers, or on the stack? a) on the stack b) in registers

2) Value parameters 4) Reference parameters

What general types of parameters are passed on the stack? 1) Stack frames 2) Value parameters 3) Local variables 4) Reference parameters 5) Activation records

The area of the stack set aside for passed arguments, return address, local variables, and saved registers.

A stack frame is _____

1) The area of the stack set aside for passed arguments, return address, local variables, and saved registers.

A stack frame is _____ 1) The area of the stack set aside for passed arguments, return address, local variables, and saved registers. 2) A register window pointing to local variables.An area in the heap that is used to store global variables 3) The area of the stack set aside for storing global strings. 4) The area of the text segment set aside for passed arguments, subroutine return address, local variables, and saved registers

nested

A/An ________ procedure call occurs when a called procedure calls another procedure before the first procedure returns.

the last value to be added to, or pushed on, the top of stack.

ESP always points to ______

a

Select the proper syntax for establishing a subprocedure.

c)

Select the proper syntax for establishing a subprocedure.

F

T/F A stack is also called a FIFO structure (First-In, First-Out) because the last value put into the stack is always the first valuetaken out.

T

T/F A subprocedure's stack frame contains the return address and its local variables.

T

T/F An argument passed by reference consists of a memory address offset.

T

T/F An input parameter may be passed by reference.

F

T/F An input/output parameter may be passed by value.

T

T/F Arrays are passed by reference to avoid copying each element into the stack/registers.

F

T/F High-level languages always pass arrays to subrou"nes by value.

F

T/F High-level languages always pass arrays to subroutines by value.

F ESP is always decremented when data is pushed onto the stack

T/F In the IA32 architecture, ESP (the stack pointer) is incremented each time data is pushed onto the stack.

T

T/F In the IA32 architecture, the top item on the stack will always have a lower memory address than the bottom item.

T

T/F Mechanically speaking, the CALL instruction pushes its return address on the stack and copies the called procedure's address into the instruction pointer.

T

T/F PUSHF is used to preserve all general purpose register contents on the stack.

T

T/F Passing by reference requires accessing a parameter's offset from inside the called procedure.

T

T/F The USES operator, coupled with the PROC directive, lets you list the names of all registers modified within a procedure and preserves them automatically for you.

F

T/F When an argument is passed by value, a copy of the address is pushed on the stack.

Push, then Jump

The CALL instruction functions similarly to which of the following? Jump Jump, then Push Push, then Jump Move, then Jump

4

The RET instruc"on (without operands) will pop how many bytes off the stack?

d) 4

The RET instruction (without operands) will pop how many bytes off the stack? a) 2 b) 8 c) 16 d) 4

EIP

The RET instruction pops the top of the stack into what register? EBP EIP It does not pop the top of the stack into a register. ESP

all of the above

There are several important uses of run"me stacks in programs (select all that apply): a) The stack provides temporary storage for local variables. b) The stack makes a convenient temporary save area for registers when they are used for more than one purpose. c) When the CALL instruc"on executes, the stack is used to store the address where the called procedure will return to. d) When calling a subrou"ne, you pass input values called arguments by pushing them on the stack.

all of the above

There are several important uses of runtime stacks in programs (select all that apply): a) The stack makes a convenient temporary save area for registers when they are used for more than one purpose b) When calling a subroutine, you pass input values called arguments by pushing them on the stack. c) The stack provides temporary storage for local variables. d) When the CALL instruction executes, the stack is used to store the address where the called procedure will return to.

arguments

Values passed to a subroutine by a calling program are called __________.

a) Stack parameters are compatible with high-level languages. b) Stack parameters reduce code clutter because registers do not have to be saved and restored.

What advantages do stack parameters have over register parameters? a) Stack parameters are compatible with high-level languages. b) Stack parameters reduce code clutter because registers do not have to be saved and restored. c) Register parameters are optimized for speed. d) Programs using stack parameters execute more quickly.

POP EBP

What instruction (with any necessary operands) would pop the top 32 bits of the runtime stack into the EBP register?

PUSHFD

What instruction would I use to save the current value of the flags register?

a) 8F8 b) 2A5

What is the current value of the stack pointer (in 4 byte hex)? What is the value at the top of the stack (in 4 byte hex)?

Pass Parameters in Registers

What parameter-passing method do most/all of Irvine's library procedures use?

PUSHAD

What single instruction would I use to save all general purpose registers?

20

What will be the value of EAX when the following sequence of instructions has executed? PUSH 5 PUSH 10 PUSH 20 POP EAX

params

When values are received by a called subroutine, they are called

a, c, d, e

Which of the following are normally part of the stack frame? (Select all that apply) a) Return Address b) Calling Procedure Starting Address c) Local Variables d) Arguments e) Saved Register Values

last one

Which of the following code sequences assigns the value 10 to EBX ?

d) It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer (by 2 or 4).

Which of the following is true about the POP instruction? a) It increments the stack pointer (by 2 or 4), and then copies the data pointed to by the stack pointer into the operand. b) It copies the data pointed to by the stack pointer into the operand, and then decrements the stack pointer (by 2 or 4). c) It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer by 1. d) It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer (by 2 or 4).

d) It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer (by 2 or 4).

Which of the following is true about the POP instruction? a) It increments the stack pointer (by 2 or 4), and then copies the data pointed to by the stack pointer into the operand. b) It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer by 1. c) It copies the data pointed to by the stack pointer into the operand, and then decrements the stack pointer (by 2 or 4). d) It copies the data pointed to by the stack pointer into the operand, and then increments the stack pointer (by 2 or 4).

1) It decrements the stack pointer (by 2 or 4), and then copies the operand into the stack at the location pointed to by the stack pointer.

Which of the following is true about the PUSH instruction? 1) It decrements the stack pointer (by 2 or 4), and then copies the operand into the stack at the location pointed to by the stack pointer. 2) It increments the stack pointer by 1 and copies the operand into the stack at the location pointed to by the stack pointer. 3) It copies the operand into the stack at the location pointed to by the stack pointer, and then decrements the stack pointer (by 2 or 4). 4) It increments the stack pointer (by 2 or 4) and copies the operand into the stack at the location pointed to by the stack pointer.


Kaugnay na mga set ng pag-aaral

History of Graphic Design Unit 2

View Set

MLBT1080 Important Professionalism Topics Assignment

View Set

Chapter 15.4 - Countries of Central America

View Set

Marketing Research Chapters 1-5 Exam

View Set

Chapter 6: The acquisition of memories and the working-memory system

View Set

Security Operations and Monitoring

View Set

Chapter 9 Planning for Community Change

View Set

Restorative Exam 3 (with dental casting alloys cards)

View Set

PSYCH FINAL EXAM STUDY GUIDE CHAP 3

View Set