Week 5 Flashcards

1
Q

How would you find the hexadecimal address of the last item in the following array?
.data
0x44 history WORD 100 DUP(?)

A

The array effectively spans from 0-198 bytes. So add 0x44 + 198d = 0x10A

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What hexadecimal value does EIP hold immediately after “inc EAX” has executed?

0x26 inc EAX
0x2B mov EBX, z
0x30 xor EAX, EBX

A

0x2B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

12

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

A

6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If you reference a point beyond the end of an array i.e. the 101st element of a 100-element array, what happens?

A

You access whatever data bytes are stored there.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Given the following register states, and using Register Indirect Addressing, how would you move the 11th element of the list array (of DWORDs) to the EAX register?
EDX = the address of list[0]
ESI = address of list[10]
EBX = 40

A

mov eax, [esi]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Given the following register states, and using Base Indexed Addressing, how would you move the 11th element of the list array (of DWORDs) to the EAX register?
EDX = the address of list[0]
ESI = address of list[10]
EBX = 40

A

mov eax, [edx + ebx]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Given the following register states, and using Indexed Addressing, how would you move the 11th element of the list array (of DWORDs) to the EAX register?
EDX = the address of list[0]
ESI = address of list[10]
EBX = 40

A

mov eax, list [ebx]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Given list, an array of WORDs, what element is addressed by list[7]?

A

4th element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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

A

4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The following two instructions are equivalent:
ret
ret 4

A

False, the second instruction pops an additional 4 bytes off the stack.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

When passing procedure parameters on the stack, why are the following lines of code often necessary?
push ebp
mov ebb, esp

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Register indirect addressing is defined as?

Indexed Addressing is defined as?

Base Indexed Addressing is defined as?

A
Register indirect addressing is accessing memory through an address stored in a register. 
mov esi, OFFSET list
mov eax, [esi]
add  esi, 4
mov  eax, [esi]

Indexed addressing is adding a constant to a register to generate an effective address.
mov esi, 0
mov eax, list[esi] ; or [list + esi]

Base Indexed Addressing is accessing lists through the base pointer in procedures.
mov esi, [ebp + 12] ; @list
mov edx, 0
mov eax, [esi + edx] ; gets curr element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is SIZEOF myChecker (in decimal)?

.data
myChecker BYTE 12h
BYTE 34h
BYTE 56h

A

SIZEOF = 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you obtain the value of the SIZEOF operator?

A

Multiply the number of elements in a data declaration by the size in bytes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is SIZEOF myChecker (in decimal)?

.data
myChecker BYTE 12h,
34h,
56h

A

SIZEOF = 3

17
Q

What is the correct formula to obtain the address of an element in matrix[r][c]?

A

base address + data size * [(row index * elements/row) + column index]

18
Q

Loading a string byte using string primitives increments or decrements which register?

19
Q

EAX contains what value in hexadecimal?

.data
myList BYTE 12h, 34h, 56h, 78h, 90h, ABh, CDh

.code
mov eax, DWORD PTR [myList + 2]

A

eax = AB907856h

20
Q

What is the value in decimal of y?

.data
myList WORD 12h, 34h, 56h, 78h, 90h, ABh
y DWORD SIZEOF myList

A
y = length * size
y = 6 * 2 = 12
21
Q

What is the value in decimal of x?

.data
myList WORD 12h, 34h, 56h, 78h, 90h, ABh
x DWORD LENGTHOF myList

22
Q

The _____ operator overrides the default type of. a label and can also be used to combine elements of a smaller data type and move them into a larger operand.

23
Q

Two dimensional arrays are declared in _____ order in MASM?

24
Q

If the string direction flag is not set, string operations will move backwards through the string.

25
Given the following array declaration, how many bytes of memory does array matrix require (in decimal)? .data matrix WORD 21 DUP (33 DUP(?))
1386 | 21 * 33 * 2