Assembly - Exam #3
What will be the value of EAX when the following sequence of instructions has executed? Push 5 push 10 pop ebx pop eax
5
In the following instruction sequence, show the changed values of AL where indicated, in hexadecimal: mov al,9Ch not al
63h
(Some of the following questions have more than one correct answer. Circle all correct answers.) What will be the final values of CX and DX when the following code executes? .data array SWORD 8,2,3,5,-4,6,0,4 .code mov cx,1 mov esi,2 mov ax,array[esi] mov bx,array[esi+4] cmp ax,3 jae L2 cmp bx,4 jb L1 jmp L3 L1:mov cx,4 L2:mov dx,5 jmp L4 L3:mov dx,6 L4:
CX = 1, DX = 6
What will be the hexadecimal value of AL after these instructions execute? mov al,3Ch or al,82h
BEh
In the following sequence, show the value of flags mov al, 06h cmp al, 05h
CF = 0 ZF = 0 SF = 0
In the following sequence, show the value of flags mov al, 0Fh test al, 02h
CF = 0 ZF = 0 SF = 0
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
Which answer choice shows the correct values of the Carry, Zero, and Sign flags after the following instructions execute? mov al,6 cmp al,5
CF = 0, ZF = 0, SF = 0
In the following sequence, show the value of flags mov al, 05h cmp al, 0Fh
CF = 1 ZF = 0 SF = 1
The assembler knows the exact address of a library procedure. [T/F]
False
The PROTO directive is required when calling a library procedure.
True
What will be the final value of ESI when the following code executes? .data array SWORD 8,2,3,5,-4,6,0,4 .code mov esi,0 mov ecx,LENGTHOF array L1:mov ax,array[esi] cmp ax,0 pushf add esi,TYPE array popf Loopne L1
0000000Eh
In the following instruction sequence, show the changed values of ah where indicated, in hexadecimal: mov ax,64C1h xor ah, al
0A5h
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? (Some of the following questions have more than one correct answer. Circle all correct answers.)
1 and 2 above
In the following instruction sequence, show the changed values of AL where indicated, in binary: mov al,00111100b or al, 82h
1011 1110
The process of dividing a problem into general tasks, and then separating general tasks into more specific tasks is called . . . (Some of the following questions have more than one correct answer. Circle all correct answers.)
2 and 3 above
What will be the value of EAX when the following sequence of instructions has executed? push 5 push 10 push 20 pop eax
20
In the following sequence, show the value of AL in hexadecimal mov al, 3Dh and al, 74h
34h
What will be the hexadecimal value of AL after these instructions execute? mov al,94h xor al,37h
A3h
In the following sequence, show the value of AL in hexadecimal mov al, 72h xor al, 0DCh
A9h
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.
What will be the result of L5 and L1 after the jump instruction is executed? mov ecx, 0 cmp ecx, 0 JG L5 JNL L1
L5 - jump not taken L1 - jump is taken
What will be the result of L5 and L1 after the jump instruction is executed? mov edx, -1 cmp edx, 0 JNL L5 JNLE L5 JL L1
L5 - jump not taken L5 - jump not taken L1 - jump is taken
What will be the result of L5 and L1 after the jump instruction is executed? mov edx, 0A523h cmp edx, 0A523h jne L5 je L1
L5 - jump not taken L1 - jump is taken
A link library contains procedures that have already been assembled into object code. [T/F]
True
The linker combines object files into an executable file. [T/F]
True
Which of the following are characteristics of a top-down design program?
all the above are characteristics
Which of the following selections contain instructions that jump to label L4 if bits 1, 2, and 3 are all set in the DL register?
and dl,0Eh cmp dl,0Eh je L4
Which of the following CALL instructions writes the contents of EAX to standard output as a signed decimal integer?
call WriteInt
What will be the value of ECX when the following sequence of instructions has executed? push 5 push 10 pop ebx pop eax pop ecx
cannot be determined
Suppose EAX, EBX, and ECX contained three unsigned integers. Which of the following code excerpts would display the largest of the three integers?
cmp eax,ebx jae L1 mov eax,ebx L1: cmp eax,ecx jae L2 mov eax,ecx L2: call WriteInt
(Some of the following questions have more than one correct answer. Circle all correct answers.) Which choices contain correct implementations of the following pseudocode? (Assume that all values are unsigned): if( eax > ebx ) mov dl,5; else mov dl,6;
cmp eax,ebx ja L1 mov dl,6 jmp L2 L1:mov dl,5 L2:
Given the following string definition, write a sequence of statements that write the string to standard output. Use a library procedure. str1 BYTE "Display this string",0 Selected Answer: .data str1 .code str1 BYTE "Display this string",0 str1 > output.txt
mov edx,OFFSET str1 call WriteString
Use the following data for this question. All values are signed: .data val1 SDWORD ? val2 SDWORD ? Which selection is the correct implementation of the following pseudocode? if( val1 > val2 || val2 > eax ) mov ebx,1; else mov ebx,2;
mov val1,ebx cmp ebx,val2 jg L1 cmp val2,eax jg L1 mov ebx,2 jmp L2 L1:mov ebx,1 L2:
In the following sequence, show the value of AL in hexadecimal mov al, 7Ah not al
none of the above