CS 271 Quiz 2.1
Suppose that result is declared as DWORD, and the following MASM code is executed: mov eax,7 mov ebx,5 mov ecx,6 label5: add eax,ebx add ebx,2 loop label5 mov result,eax What is the value stored in the memory location named result?
67
Suppose that result is declared as DWORD, and the following MASM code is executed: mov eax,9 mov ebx,6 mov ecx,6 label5: add eax,ebx add ebx,2 loop label5 mov result,eax What is the value stored in the memory location named result?
75
Adding 0FFh and 05h in an 8-bit register sets the Overflow flag.
False
MASM has built-in range checking for effective addresses.
False
The MOVSX instruction is only used with unsigned integers.
False
The following instructions will set the Carry flag: mov al,0FEh sub al,2
False
Parity Flag
Indicates whether or not an even number of 1 bits occurs in the least significant byte of the destination operand, immediately after an arithmetic or boolean instruction has executed
Which of the following is NOT a valid MOV operation? Table 4-1 might be helpful. (check any/all that apply) MOV reg,reg MOV mem,reg MOV reg,mem MOV imm,imm MOV reg,imm MOV imm,mem MOV mem,imm MOV mem,mem
MOV imm,imm MOV imm,mem MOV mem,mem
Adding 5 to 0FBh in an 8-bit register sets the Zero flag.
True
The INC instruction does not affect the Carry Flag
True
The MOVSX instruction sign-extends an integer into a larger operand.
True
The MOVZX instruction is only used with unsigned integers.
True
The following instructions will set the Sign flag: mov al,0FEh sub al,2
True
Which of the following are valid uses of the XCHG instruction? (check any/all that apply) XCHG reg,imm XCHG imm,imm XCHG reg,mem XCHG mem,reg XCHG mem,mem XCHG imm,reg XCHG imm,reg XCHG reg,reg
XCHG reg,mem XCHG mem,reg XCHG reg,reg
Overflow Flag
indicates signed integer overflow
Sign Flag
indicates that an operation produced a negative result
Zero Flag
indicates that an operation produced zero
Carry Flag
indicates unsigned integer overflow
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 OPTIONS A mov eax,dword1 mov edx,ebx sub ebx,ecx add eax,ebx inc eax B mov eax,dword1 neg eax mov ebx,edx sub ebx,ecx add eax,ebx inc eax C neg dword1 mov ebx,edx sub ebx,ecx add eax,ebx inc eax D mov eax,dword1 neg eax sub edx,ecx add eax,edx inc eax
mov eax,dword1 neg eax mov ebx,edx sub ebx,ecx add eax,ebx inc eax
Auxiliary Carry Flag
set when a 1 bit carries out of position 3 in the least significant byte of the destination operand.