CS 271 - Week 7 Quiz

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

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 110 x110 110h 0110 0x110 0110h x0110

Given the following register states, and using Base Indexed Addressing, what line 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.

mov eax, [edx + ebx]

Given the following register states, and using Register Indirect Addressing, what line 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.

mov eax, [esi]

Given the following register states, and using Indexed Addressing, what line 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.

mov eax, list[ebx]

Suppose that you are given the following program (with memory addresses shown on the left). What hexadecimal value does EIP hold immediately after "inc EAX" has executed? .data 0x100 x DWORD 153461 0x104 y BYTE 37 0x105 z BYTE 90 .code main PROC 0x12 push x 0x17 mov AH, y 0x1C mov AL, z 0x21 call someProcedure 0x26 inc EAX 0x2B mov EBX, z 0x30 xor EAX, EBX 0x35 exit main ENDP END MAIN

0x2B 2Bh 2B x2B

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 BYTE 37 z BYTE 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

2

The following instruction will increment the stack pointer (ESP) by how many bytes? ret 16

20

The RET instruction (without operands) will pop how many bytes off the stack?

4

Given the following partial data segment, what value would I put in the brackets in list10 10 to access the 12th element of list? (Ignore the .0000 that Canvas may append to your answer). .MAX = 50 .data list DWORD MAX DUP(0) a DWORD 25 b DWORD 15

44

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

4A 4Ah x4A 0x4A

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 program. Inside someProcedure, what numerical operand should be used with the RET instruction? .data x DWORD 153461 y BYTE 37 z BYTE 90 .code main PROC push x push y push z call someProcedure inc EAX mov EBX, z xor EAX, EBX exit main ENDP END MAIN

6

Register Indirect addressing is defined as follows:

Accessing memory through an address stored in a register.

The stack frame inside a procedure is also known as the ____________.

Activation Record

Arrays are stored in ____________ memory.

Contiguous

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

False

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.

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 [ebp]? [ebp + 4]? [ebp + 6]? [ebp + 8]? [ebp + 10]? [ebp + 12]?

[ebp] = The previous value of EBP [ebp + 4] = The return address from someProcedure [ebp + 6] = None [ebp + 8] = The decimal value 90 [ebp + 10] = The decimal value 37 [ebp + 12] = The decimal value 153461


Kaugnay na mga set ng pag-aaral

Best Shots 2 - Describing a person

View Set

Poissons de Suisse (Actinoptérygiens)

View Set

Principles of Christian Theology Part 2

View Set

2012 AP Government Multiple Choice Questions, ap gov exam multiple choice, APgov final exam- multiple choice (Units 1 & 2), AP Gov Final (Multiple Choice), Government Final Multiple Choice Questions, AP Government Multiple Choice Final Exam, AP Govt....

View Set

Precalc Polar Coordinates (Unit 14)

View Set

اساسيات التخطيط - الجزء الاول: التخط

View Set

Chapter 36: Introduction to the Nervous System

View Set