Summary Exercise - Week 7

Ace your homework & exams now with Quizwiz!

The following instruction will increment the stack pointer (ESP) by how many bytes? (Ignore the .0 after the number. Canvas insists on pushing decimals even when kindly asked not to). ret 16

20.0

Suppose that you are given the following program. Inside someProcedure, what numerical operand should be used with the RET instruction? .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC push x push y push z call someProcedure pop x inc EAX mov EBX, z xor EAX, EBX exit main ENDP END MAIN

4

The RET instruction (without operands) will pop how many bytes off the stack? A.) 4 B.) 2 C.) 8 D.) 16

A.) 4

Arrays are stored in ____________ memory. A.) Contiguous B.) Random C.) Disjoint

A.) Contiguous

Given list, an array of WORDs, what element is addressed by list[8]? Hint: It's Love. A.) 4th Element B.) 8th Element C.) 9th Element D.) 5th Element

D.) 5th Element

Given the following register states, and using Base Indexed Addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contans the address of the first element of list. ESI register contains the address of the eleventh element of list. EBX register contains the value 40, A.) mov eax, list[ebx] B.) mov eax, list[esi] C.) mov eax, [esi] D.) mov eax, [edx + ebx]

D.) mov eax, [edx + ebx]

Given the following register states, and using Indexed Addressing, which of the following lines of code will move the 11th element of the list array (of DWORDs) to the EAX register? EDX register contans the address of the first element of list. ESI register contains the address of the eleventh element of list. EBX register contains the value 40, A.) mov eax, [edx + ebx] B.) mov eax, [esi] C.) mov eax, list[esi] D.) mov eax, list[ebx]

D.) mov eax, list[ebx]

The following two instructions are equivalent. ret ret 4 T/F

False

The stack frame inside a procedure is also known as the ____________. A.) Procedure Frame B.) Program Record C.) Activation Record D.) Activation Stack

C.) Activation Record

For this problem, suppose that you are working with the partial data segment given below. Assume that the memory address of balance is 0x44. What hexadecimal address belongs to the last item in history? HISTLIMIT = 100 .data balance DWORD 0 account WORD ? history WORD HISTLIMIT DUP(?) isValid BYTE 0

0x0110

For this problem, suppose that you are working with the partial data segment given below. Assume that the memory address of balance is 0x44. What hexadecimal address belongs to the first item in history? HISTLIMIT = 100 .data balance DWORD 0 account WORD ? history WORD HISTLIMIT DUP(?) isValid BYTE 0

0x4A

Suppose that you are given the following program. After the instruction "mov ebp, esp", which of the following is referenced by each of the following? .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC push x push y push z call someProcedure ... exit main ENDP someProcedure PROC push ebp mov ebp, esp ... pop ebp ret 8 someProcedure ENDP END MAIN 1.) [ebp + 4] 2.) [ebp + 8] 3.) [ebp + 10] 4.) [ebp + 12] 5.) [ebp] 6.) [ebp + 6] A.) The previous value of EBP B.) None of these C.) The decimal value 90 D.) The return address for someProcedure E.) The decimal value 153461 F.) The decimal value 37

1. D 2. C 3. F 4. E 5. A 6. B

When passing procedure parameters on the stack, why are the following lines of code often necessary in a procedure? push ebp mov ebp,esp A.) Because the procedure might change the EBP register value. B.) To keep additional usage of the stack within the procedure from invalidating the stack offsets. C.) To preserve the original EBP register value for register indirect addressing. D.) They are never necessary.

B.) To keep additional usage of the stack within the procedure from invalidating the stack offsets.


Related study sets

Maintenance Electrician Flash Cards

View Set