Module 7 Summary Exercises

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

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

5th Element

Suppose that you are given the following partial data segment. What value does idLength contain, in decimal? (Ignore the .0000 from Canvas) .data idArray WORD 3546, 1534, 12, 3481, 154, 6423 idLength DWORD LENGTHOF idArray idSize DWORD SIZEOF idArray idType DWORD TYPE idArray

6

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) .data x DWORD 153461 y WORD 37 z WORD 90 .code main PROC PUSH x PUSH y PUSH z CALL someProcedure INC EAX MOV EBX, z XOR EAX, EBX exit main ENDP

8

(T/F) The following two instructions are equivalent. RET RET 4

False

(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.

False

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, list[EBX]

The _________ operator returns the size, in bytes, of a single element of a data declaration.

TYPE

When passing procedure parameters on the stack, why are the following lines of code often necessary in a procedure? PUSH EBP MOV EBP, ESP

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

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?

You attempt to access whatever data bytes are stored there.

Arrays elements are stored in ____________ memory.

Contiguous

Given the following declarations, assume that the memory address of balance is 44h. What is the hexadecimal address of the first element of history? HISTLIMIT = 100 .data balance DWORD 0 account WORD ? history WORD HISTLIMIT DUP(?) isValid BYTE 0

04Ah

Suppose that you are given the following data segment and code snippet. What hexadecimal value does EAX contain at Execution Point A? .data myPtrCheck BYTE 12h, 34h, 56h, 78h,90h, 0ABh, 0CDh, 0EFh .code main PROC ; ... MOV EAX, DWORD PTR [myPtrCheck + 2] ; Execution Point A ; ... exit main ENDP

0AB907856

For the following segment, what is SIZEOF myChecker1 in decimal? (ignore the .0000 from Canvas) .data myChecker1 BYTE 12h BYTE 34h BYTE 56h BYTE 78h BYTE 90h

1

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) .data x DWORD 153461 y WORD 37 z BYTE "Why are you looking at this?",0 .code main PROC PUSH x PUSH y PUSH OFFSET z CALL someProcedure INC EAX MOV EBX, z XOR EAX, EBX exit main ENDP

10

Given the following declarations, assume that the memory address of balance is 44h. What is the hexadecimal address of the last element of history? HISTLIMIT = 100 .data balance DWORD 0 account WORD ? history WORD HISTLIMIT DUP(?) isValid BYTE 0

110

Suppose that you are given the following partial data segment. What value does idSize contain, in decimal? (Ignore the .0000 from Canvas) .data idArray WORD 3546, 1534, 12, 3481, 154, 6423 idLength DWORD LENGTHOF idArray idSize DWORD SIZEOF idArray idType DWORD TYPE idArray

12

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 13

17

Suppose that you are given the following partial data segment. What value does idType contain, in decimal? (Ignore the .0000 from Canvas) .data idArray WORD 3546, 1534, 12, 3481, 154, 6423 idLength DWORD LENGTHOF idArray idSize DWORD SIZEOF idArray idType DWORD TYPE idArray

2

To access stack-passed parameters in a procedure, which addressing mode is used?

Base + Offset

Register Indirect addressing is defined as follows:

Accessing memory through an address stored in a register.

The _________ operator returns a count of the number of elements in a single data declaration.

LENGTHOF

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]

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

OFFSET

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.

PTR

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. Local Variables Passed Parameters Old EBP Value Procedure Return Address Saved Registers

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


Ensembles d'études connexes

OST-249 - CPC Exam Prep - Combined - 1-8

View Set

Chapter 15:Obsessive-Compulsive and Related Disorders-PREPU

View Set

Chapter 41, Nursing Management: Peptic Ulcer Disease

View Set

DMLSS: Defense Medical Logistics Standard Support (DMLSS) Basics

View Set

Market Motive Web Analytics Practitioner Test

View Set