CS271 Module 7

Réussis tes devoirs et examens dès maintenant avec 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

What would TYPE wArr evaluate to?

2WORD is a 2-byte data type

What would SIZEOF dwArr evaluate to?

30476 x 4 = 304

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

5th Element

What would LENGTHOF dwArr evaluate to?

76

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 25th element of list into EAX? (Ignore the .0000 that Canvas may append to your answer). MAX = 50 .data list DWORD MAX DUP(0) a DWORD 25 b DWORD 15

96

Which register is normally used for destination-operand operations (operations where you are using a register-offset addressing mode to overwrite memory).

EDI

Which register is normally used for source-operand operations (operations where you are using a register-offset addressing mode to pull data from memory).

ESI

The following two instructions are equivalent. RET RET 4

False

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.

False

(True/False) The instruction INC [EDI] is valid.

False[EDI] does not have an implied size, so this will cause an error.

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 of list. ESI register contains the address (OFFSET) of the eleventh element of list. EBX register contains the value 40. MOV EAX, list[ESI] MOV EAX, [EDX + EBX] MOV EAX, [ESI] MOV EAX, list[EBX]

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 of list.ESI register contains the address (OFFSET) of the eleventh element of list.EBX register contains the value 40. MOV EAX, [ESI] MOV EAX, [EDX + EBX] MOV EAX, list[EBX] MOV EAX, list[ESI]

MOV EAX, [ESI]

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 of list.ESI register contains the address (OFFSET) of the eleventh element of list.EBX register contains the value 40. MOV EAX, [ESI] MOV EAX, list[ESI] MOV EAX, list[EBX] MOV EAX, [EDX + EBX]

MOV EAX, list[EBX]

Write a statement to declares dwArr, an array of 76 DWORDs, which initializes the elements all to a value of 10.

dwArr DWORD 76 DUP(10)

Write a statement to declare wArr, an array of 150 WORDs, which does not initialize the values.

wArr WORD 150 DUP(?)

The _________ operator returns the size, in bytes, of a single element of a data declaration. LENGTHOF OFFSET TYPE SIZEOF PTR

TYPE

The _________ operator returns the size, in bytes, of a single element of a data declaration. PTR LENGTHOF TYPE SIZEOF OFFSET

TYPE

True/False) The instruction ADD DWORD PTR [EDI+3], 20 is valid.

Trueadd mem, imm is an allowed instruction format.

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? Compile-time error Run-time error The disassembler prevents your program from compiling. You attempt to access whatever data bytes are stored there.

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? Compile-time error You attempt to access whatever data bytes are stored there. The disassembler prevents your program from compiling. Run-time error

You attempt to access whatever data bytes are stored there.

Which addressing mode is most often used to access stack-passed parameters?

Base+Offset

Arrays elements are stored in ____________ memory. Disjoint Contiguous Random

Contiguous

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 8

12

Register Indirect addressing is defined as follows: Accessing a memory area specified and maintained by a pointer in the ESP register. Accessing register contents as a value. None of these. Accessing memory through an address stored in a register.

Accessing memory through an address stored in a register.

The _________ operator returns a count of the number of elements in a single data declaration. OFFSET PTR LENGTHOF TYPE SIZEOF

LENGTHOF

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 of list. ESI register contains the address (OFFSET) of the eleventh element of list. EBX register contains the value 40. MOV EAX, list[ESI] MOV EAX, [EDX + EBX] MOV EAX, [ESI] MOV EAX, list[EBX]

MOV EAX, [EDX + EBX]

The _________ operator returns the distance in bytes, of a label from the beginning of its enclosing segment, added to the segment register. SIZEOF OFFSET PTR LENGTHOF TYPE

OFFSET

The _________ operator returns the distance in bytes, of a label from the beginning of its enclosing segment, added to the segment register. SIZEOF TYPE PTR OFFSET LENGTHOF

OFFSET

Please place the following components of the stack frame in the order in which they should be pushed (or room made for them) on the stack.

Passed Parameters Procedure Return Address Old EBP Value Local Variables Saved Registers

Which addressing mode is most suitable for iterating through an array?

Register Indirect, though the others work as well.

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. TYPE LENGTHOF OFFSET PTR SIZEOF

SIZEOF


Ensembles d'études connexes

Fundamentals of nursing- walters kluwer chapter 1

View Set

Drafting the Introduction and Refining the Thesis

View Set

chapter 2 perception, self and communications

View Set

17. Postpartum & Newborn Discharge Teaching

View Set

Chapter 11: Team characteristics & DIversity

View Set

MacroEconomics Exam 3 (Ch. 8-10)

View Set

Chapter 29 AP World History Vocabulary

View Set