Module 7 Summary Exercises
5th Element
Given list , an array of WORDs, what element is addressed by list[8] ? Hint: It's Love.
100
Given the following partial data segment declarations and using Indexed Operands addressing, what value would I put in the brackets in MOV EAX, list[?] to move the 26th element of list into EAX ? (Ignore the .0000 that Canvas may append to your answer).
d) MOV EAX, [EDX + EBX]
Given the following register states, and using Base+Offset 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 contains the address (OFFSET) of the first element oflist . ESI register contains the address (OFFSET) 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, list[EBX]
Given the following register states, and using Indexed Operands 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 contains the address (OFFSET) of the first element oflist . ESI register contains the address (OFFSET) of the eleventh element of list . EBX register contains the value 40. a) MOV EAX, [ESI] b) MOV EAX, [EDX + EBX] c) MOV EAX, list[ESI] d) MOV EAX, list[EBX]
d) MOV EAX, [ESI]
Given the following register states, and using Register Indirect 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 contains the address (OFFSET) of the first element oflist . ESI register contains the address (OFFSET) of the eleventh element of list . EBX register contains the value 40. a) MOV EAX, [EDX + EBX] b) MOV EAX, list[EBX] c) MOV EAX, list[ESI] d) MOV EAX, [ESI]
10
Suppose that you are given the following partial program.Inside someProcedure , what numerical operand should be used with the RET instruction? (e.g. RET n , what should n be? Ignore any decimal points that Canvas adds)
8
Suppose that you are given the following partial program.Inside someProcedure , what numerical operand should be used with the RET instruction? (e.g. RET n , what should n be? Ignore any decimal points that Canvas adds)
Activation record is also known as
T/ F The following two instructions are equivalent. 1. RET 2. RET 4
F
T/F When passing parameters to a procedure on the stack, it is usually okay to change the value of the EBP register within the procedure after building the stack frame.
PTR
The _________ operator overrides the default type of a label (variable), and can also be used to combine elements of a smaller data type and move them into a larger operand.
LENGTHOF
The _________ operator returns a count of the number of elements in a single data declaration.
SIZEOF
The _________ operator returns a value that is equivalent to multiplying the number of elements in a single data declaration by the size, in bytes, of a single element of a data declaration.
OFFSET
The _________ operator returns the distance in bytes, of a label from the beginning of its enclosing segment, added to the segment register.
TYPE
The _________ operator returns the size, in bytes, of a single element of a data declaration.
14
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 10
16
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 12
8
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 4
Base + Offset
To access stack-passed parameters in a procedure, which addressing mode is used? Register Indirect Indexed Operands Register Direct Base + Offset
c) To keep additional usage of the stack within the procedure from invalidating the stack offsets.
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) They are never necessary. c) To keep additional usage of the stack within the procedure from invalidating the stack offsets. d) To preserve the original EBP register value for register indirect addressing.
1) The return address from some procedure 2) The decimal value 90. 3) The decimal value 37. 4) The decimal value 153461. 5) The previous value of EBP 6) None of these 7) The memory address of someProcedure
1) [ebp + 4] 2) [ebp + 8] 3) [ebp + 10] 4) [ebp + 12] 5) [ebp] 6) [ebp + 6]
contiguous
Arrays elements are stored in ____________ memory.
a) You attempt to access whatever data bytes are stored there
If you reference a point beyond the end of an array in MASM (for example, the address of the what would be the 105th element of a 100- element array), what happens? a) You attempt to access whatever data bytes are stored there. b) Run-time error c) The disassembler prevents your program from compiling. d) Compile-time error
a) You attempt to access whatever data bytes are stored there.
If you reference a point beyond the end of an array in MASM (for example, the address of the what would be the 105th element of a 100- element array), what happens? a) You attempt to access whatever data bytes are stored there. b) Run-time error c) The disassembler prevents your program from compiling. d) Compile-time error
d) Accessing memory through an address stored in a register.
Register Indirect addressing is defined as follows: a) None of these. b) Accessing register contents as a value. c) Accessing a memory area specified and maintained by a pointer in the ESP register. d) Accessing memory through an address stored in a register.