MOLINA FINAL EXAM
The symbol for the current location counter is
$
Example 2 1:.data 2:varX DWORD 9,8,7,6,5,4,3,2,1,0 3:varY DWORD (LENGTHOF varX) DUP(0) 4:.code 5:mov esi,OFFSET varY + (SIZEOF varX) - 4 6:mov edi,4 7:mov ecx,LENGTHOF varX - 1 8:L1:mov eax,varX[edi] 9:mov [esi],eax 10:add edi,4 11:sub esi,4 12:loop L1 Refer to Example 2. If line 9 were changed to the following, what would be the final values at locations varY, varY+4, and varY+8? 9: mov [esi-4],eax
0, 1, 2
Form the 8-bit two's complement of each binary integer: 11110001
00001111
Translate the following decimal number to binary: 34
00100010
Translate the following signed decimal number to binary: -78
10110010
Use the following data definitions until notified otherwise: byte1 BYTE 0FFh,1,2 byte2 BYTE 14h word1 WORD 0FFFFh,1,2 word2 WORD 3 word3 SWORD 7FFFh,8000h word4 SWORD 9000h dword1 DWORD 10h,20h,30h,40h dArray DWORD 10 DUP(?) What is the final hexadecimal value of AL when this code executes? mov ebx,OFFSET byte1 mov al,[ebx+3]
14h
Use the following data definitions until notified otherwise: byte1 BYTE 0FFh,1,2 byte2 BYTE 14h word1 WORD 0FFFFh,1,2 word2 WORD 3 word3 SWORD 7FFFh,8000h word4 SWORD 9000h dword1 DWORD 10h,20h,30h,40h dArray DWORD 10 DUP(?) What is the hexadecimal value of AX when this code executes? mov esi,OFFSET word1 add esi,4 mov ax,[esi]
2
What is the value of the expression.(TYPE word1)?
2
Which flag is set when an unsigned value is too large to fit into a destination operand?
Carry
A signed integer stores the sign in the least significant bit (LSB).
False
Adding 7Fh and 05h in an 8-bit register sets the Overflow flag.
False
If an integer's sign bit is 1, the integer is positive.
False
The following is a valid identifier: AB62-$T
False
Which instruction moves the lower 16 bits of dword1 into the BX register (hint: use PTR).
mov bx, WORD PTR dword1
The two's complement of an integer is formed by doing which of the following?
reversing (inverting) the bits and adding 1
Which directive identifies the part of a program containing instructions?
.CODE
Example 2 1:.data 2:varX DWORD 9,8,7,6,5,4,3,2,1,0 3:varY DWORD (LENGTHOF varX) DUP(0) 4:.code 5:mov esi,OFFSET varY + (SIZEOF varX) - 4 6:mov edi,4 7:mov ecx,LENGTHOF varX - 1 8:L1:mov eax,varX[edi] 9:mov [esi],eax 10:add edi,4 11:sub esi,4 12:loop L1 Refer to Example 2. After the loop executes, what will be the values at locations varY, varY+4, and varY+8?
0, 0, 1
Use the following data definitions until notified otherwise: byte1 BYTE 0FFh,1,2 byte2 BYTE 14h word1 WORD 0FFFFh,1,2 word2 WORD 3 word3 SWORD 7FFFh,8000h word4 SWORD 9000h dword1 DWORD 10h,20h,30h,40h dArray DWORD 10 DUP(?) What is the final hexadecimal value of EAX when this code executes? mov edx,8 mov eax,dword1[edx]
00000030h
Which of the following binary values is equivalent to hexadecimal 4A2B?
0100 1010 0010 1011
Add the following binary integers: 00101101 and 00111011:
01101000
Which of the following binary values is equivalent to hexadecimal 7CBE? a. 0111 1101 1011 1110 b. 0111 1011 1011 1100 c. 0111 1100 1100 1110 d. 0111 1100 1011 1110
0111 1100 1011 1110
What will be the hexadecimal value of AL after these instructions execute? mov al,0CFh and al,2Bh
0Bh
Which of the following code sequences assigns the value 10h to EBX? (The following question may have more than one correct answer. Mark all correct)
1 and 2 above
Which of the following code sequences assigns the value 10h to EBX? There may be multiple answers.
1 and 4
Translate the following decimal number to hexadecimal: 258
102
Which of the following is the binary translation of signed decimal -33 ? a. 11011111 b. 10101011 c. 11001100 d. 11100011
11011111
In the following data definition, assume that List2 begins at offset 2000h. What is the offset of the third value (5)? List2 WORD 3,4,5,6,7
2004h
Which list contains the correct hexadecimal translation (in order) of the following unsigned decimal integers? 33, 95, 257
21, 5F, 101
What is the value of the expression (LENGTHOF word1)?
3
What is the result of ax after the following: .data val1 WORD 4000h val2 WORD 5000h val3 WORD 3000h .code main PROC mov ax, val1 add al, 20h sub ah, 10h
3020h
What is the value of the expression (TYPE dword1)?
4
Convert the following string to a sequence of hexadecimal ASCII codes: "BW654" knowing that "A" is 41h and 1 is 31h. Use comas to separate your answer.
42h, 57h, 36h, 35h, 34h
What will be the value of EAX when the following sequence of instructions has executed? Push 5 push 10 pop ebx pop eax
5
What is the value of the expression (SIZEOF word1)?
6
In the following instruction sequence, show the changed values of AL where indicated, in hexadecimal: mov al,9Ch not al
63h
Which format is used to store Little Endian representation for the following 12345678h ? from low to high memory left to right?
78563412
Use the following data definitions until notified otherwise: byte1 BYTE 0FFh,1,2 byte2 BYTE 14h word1 WORD 0FFFFh,1,2 word2 WORD 3 word3 SWORD 7FFFh,8000h word4 SWORD 9000h dword1 DWORD 10h,20h,30h,40h dArray DWORD 10 DUP(?) What is the final hexadecimal value of AX when this code executes? mov ebx,OFFSET dword1 sub ebx,2 mov ax,[ebx]
9000h
What will be the hexadecimal value of AL after these instructions execute? mov al,94h xor al,37h
A3h
Within the CPU, all calculations and logic operations take place inside the ___________ .
ALU
Given the following array definition, which letter choice contains a valid constant declaration named ArrayCount that automatically calculates the number of elements in the array? newArray DWORD 10,20,30,40,50
ArrayCount = ($-newArray) / 4
What will be the hexadecimal value of AL after these instructions execute? mov al,3Ch or al,82h
BEh
Which answer choice shows the correct values of the Carry, Zero, and Sign flags after the following instructions execute? mov al,00110011b test al,2
CF = 0, ZF = 0, SF = 0
What is the name of the lowest 8 bits of the EDX register?
DL
Which register is known as a loop counter?
ECX
What will be the final value in EDX after this code executes? mov edx,1 mov eax,7FFFh cmp eax,0FFFF8000h jl L2 mov edx,0 L2:
EDX = 0
Which two 32-bit registers are known as extended index registers?
ESI, EDI
Use the following data for the following question: word1 WORD 1000h,2000h,3000h,4000h,5000h dword1 DWORD 10000h,20000h,30000h,40000h What is the final value of AX after this code has executed? mov esi,OFFSET word1 mov ecx,5 mov eax,100h L1:add ax,[esi] add ax,16 add esi,TYPE word1 Loop L1
F150h
A quadword is 4 bytes.
False
The AND and OR always clear the Sign and Overflow flags.
False
The AND and TEST perform exactly the same operations.
False
The DS register can be the destination operand of a MOV instruction.
False
The ESP register always points to the next available position (NAP) where a new value will be pushed on the stack
False
The PUSH instruction copies a value from the stack to an operand before decrementing the stack pointer
False
The RET instruction pops the value pointed to by EBP off the stack into the instruction pointer..
False
The TEST instruction always alters the destination operand.
False
The XOR means as long as one value is 1 the resulting value is also 1.
False
The expression X ˅ Y is only true when X and Y are both true.
False
The following C++ expression cannot be written in assembly language code. X = (Y + 4) * 3;
False
Use the following data definitions until notified otherwise: byte1 BYTE 0FFh,1,2 byte2 BYTE 14h word1 WORD 0FFFFh,1,2 word2 WORD 3 word3 SWORD 7FFFh,8000h word4 SWORD 9000h dword1 DWORD 10h,20h,30h,40h dArray DWORD 10 DUP(?) The following instructions implement the following expresion dArray[0] = dArray[1] + dArray[2] in assembly language. mov eax, [dArray+4] add eax, [dArray+4] mov dArray, eax
False
Use the following data definitions until notified otherwise: byte1 BYTE 0FFh,1,2 byte2 BYTE 14h word1 WORD 0FFFFh,1,2 word2 WORD 3 word3 SWORD 7FFFh,8000h word4 SWORD 9000h dword1 DWORD 10h,20h,30h,40h dArray DWORD 10 DUP(?) The following instructions implement the following expresion eax = -dword1 + (edx - ecx) + 1 in assembly language. sub edx, ecx mov eax, dword1 neg eax ; eax = -dword1 add eax, edx inc edx
False
Using the following data declarations, specify if the following instructions code is a proper code with a loop that copied the string from the source to target. source BYTE "String to be copied", 0 target BYTE SIZEOF source DUP(0), 0 mov edi, 0 mov ecx, SIZEOF source L1: mov al, source[edi] mov target [edi], al inc edi loop
False
label word 10, 20, 30, 40, 50 mov ax, label + 4 puts 50 into ax.
False
Which of the following are true about the PUSH instruction?
It decrements the stack pointer (by 2 or 4) and copies the operand into the stack at the location pointed to by the stack pointer.
Which instruction loads the low byte of the EFLAGS register into AH?
LAHF
Which of the following defines a text macro named MESSAGE that contains this string data? "I'm good at this!",0
MESSAGE TEXTEQU <"I'm good at this!",0>
A doubleword (on x86 systems) is 32 bits.
True
A link library contains procedures that have already been assembled into object code.
True
A signed byte can be equal to +127.
True
A word (on x86 systems) is 16 bits.
True
Adding 0FFh and 05h in an 8-bit register sets the Overflow flag.
True
Adding 5 to 0FBh in an 8-bit register sets the Zero flag.
True
For any two integers n and m, ((n XOR m) XOR m) produces n.
True
In a stack, the first value pushed on a stack is the last one to be removed.
True
The ES register can the source operand of a MOV instruction.
True
The INC instruction does not affect the Carry flag.
True
The MOV instruction does not permit an immediate value to be moved to a segment register.
True
The MOVSX instruction sign-extends an integer into a larger operand.
True
The NOT instruction inverts all of the bits in an operand.
True
The expression X ˄ Y is true only when X and Y are both true.
True
The following instructions will set the Carry flag: mov al,0FEh sub al,2
True
The following instructions will set the Sign flag: mov al,0FEh sub al,2
True
The listing file contains a list of program symbols.
True
The three most basic operators in Boolean algebra are AND, OR, and NOT.
True
Three hexadecimal digits can be used to represent 12 binary bits.
True
Use the following data definitions until notified otherwise: byte1 BYTE 0FFh,1,2 byte2 BYTE 14h word1 WORD 0FFFFh,1,2 word2 WORD 3 word3 SWORD 7FFFh,8000h word4 SWORD 9000h dword1 DWORD 10h,20h,30h,40h dArray DWORD 10 DUP(?) The following statements move the content of word1 to word2: mov ax, word1;(any general-purpose 16 bit register may be used) mov word2, ax
True
What is the value of the boolean expression X ˅ (Y ˄ Z), when X=true, Y=false, and Z=false?
True
val3 DWORD 20 DUP (?) means there are 80 bytes of data that will be placed beginning at val3 at runtime.
True
Is the expression X ˅ (Y ˄ Z) equivalent to (X ˅ Y) ˄ (X ˅ Z) for all possible inputs of X, Y, and Z?
Yes
The byte-ordering scheme used by computers to store large integers in memory with the high-order byte at the lowest address is called:
big endian
High-speed memory that reduces the frequency of access by the CPU to conventional memory is called
cache memory
Which of the following CALL instructions writes the contents of EAX to standard output as a signed decimal integer?
call WriteInt
The four parts of a CPU are:
clock, registers, control unit, arithmetic logic unit
The three types of buses connected to the CPU are:
data, address, control
During which phase of the instruction execution cycle is the program counter incremented?
fetch
List the three primary steps of the instruction execution cycle, in sequential order:
fetch, decode, execute
The basic parts of an instruction, in order from left to right, are:
label, mnemonic, operand(s), comment
Select the answer choice that best implements the following expression. Do not permit dword1, ECX, or EDX to be modified: eax = -dword1 + (edx - ecx) + 1
mov eax,dword1 neg eax mov ebx,edx sub ebx,ecx add eax,ebx inc eax
Which instruction moves the 32-bit address of word1 into the ESI register (assume 32-bit Protected mode).
mov esi, OFFSET word1
Select a data definition statement that creates an array of 500 signed doublewords named myList and initializes each array element to the value ?1.
myList SDWORD 500 DUP (-1)
If you wanted to find out whether an integer contained an even number of 1 bits, which status flag would be useful?
parity