Sample Lab Test CSC159 [QUESTION] SET2
Sample Lab Test CSC159 [QUESTION] SET2
LAB TEST
INSTRUCTIONS TO CANDIDATES:
NAME:
MATRIC NO:
GROUP:
LECTURER:
1. mov and xchg instructions will not change all flags registers.
5. The following assembly language program sets the values for Carry Flag, Sign Flag
and Auxiliary Flag to ONE (1)
7. Given BH = 11h, the value of BX after execution of instruction AND BH, 88h is
0000 0000 0000 0000.
8. SAR instruction shifts each bit in the destination operand to the right and will replace
empty space with '0'.
9. Execution of cmp and test instruction do not change the value in the destination
operand and also do not affect the status flags.
10. The count register (CX) is mainly used as a counter for loop instructions.
ANSWER PART A
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
2
CONFIDENTIAL CS/JULY2021/CSC159
MOV BX, DX
A. Immediate operand
B. Register operand
C. Memory operand
D. Index operand
A. Auxiliary flag will set to zero if there is a borrow from bit 4 to bit position 3.
B. If the register of AX is 7FFFh, so the sign flag for register AX is negative.
C. The parity flag will reset if the result of AX equal to A781h.
D. Result arithmetic for register DX is 0080h, then the lower byte will reset the
overflow flag in sign number.
3. The statement below is FALSE about the mov (move) instructions EXCEPT:
A. MOV instruction copies data from size byte memory operand to word size
register.
B. The destination operand may be either a register, a memory operand or a
number.
C. The destination and source operand will be changed during mov instruction
execution.
D. Data can transfer to the destination operand between general purpose register.
Mov dx,02F1
Mov dh,EE
Mov bh, CD
Xchg dh, bl
3
CONFIDENTIAL CS/JULY2021/CSC159
5. Which instruction can transform segment program below into assembly language?
A = Temp
B=A
Temp = B
A. Mov AX,A
Mov BX,B
Xchg AX,BX
B. Mov AX,temp
Mov BX,AX
Mov temp,BX
Xchg AX,BX
C.
Mov temp, AX
Mov AX, BX
Mov BX, temp
D. Xchg AX,BX
Mov A,temp
Mov B,A
Mov temp,B
Xchg AX,BX
6. Y = b2 – 4ac
I. Mov
II. Sub
III. Imul
IV. Mul
A. II and III
B. II and IV
C. I, II and III
D. I, II and IV
7. Identify the BEST reason for an Overflow Flag to be set to ONE (1) for an 8-bit
imul instruction.
A. The upper half of the multiplication is the sign extension of the lower half.
B. The result of the multiplication is out of range (-128d to +127d).
C. The result of the multiplication is within range (-128d to +127d).
D. The result of the multiplication produces a negative value.
4
CONFIDENTIAL CS/JULY2021/CSC159
8. The inc (increment) instruction has several features that distinguish it from the
add (addition) instruction. According to the list below, identify the different features
of inc (increment) instructions:
I. inc (increment) instruction affects all status flags except the Carry Flag.
II. The execution of inc (increment) instruction is faster compared to the
execution of add (addition) instruction.
III. The execution of inc (increment) instruction is slower compared to the
execution of add (addition) instruction.
IV. inc (increment) instruction is frequently applied in decrementing loop control
variables.
A. I and II
B. I and III
C. II and IV
D. III and IV
9. The statement below is TRUE about the sub (subtraction) instructions EXCEPT:
10. Which of the following instruction does NOT affect the destination operand?
A. SAR
B. MOV
C. CMP
D. ROL
11. Based on the program segment below, what is the value of the AX register and
Parity Flag (PF) after XOR instruction is executed?
mov AL,4Bh
XOR AL,2Ah
A. AX=6100, PF=0
B. AX=0061, PF=0
C. AX=002A, PF=1
D. AX=0061, PF=1
5
CONFIDENTIAL CS/JULY2021/CSC159
12. The statement below is TRUE about the shift instructions EXCEPT:
A. mov CL, 4
sal AX,CL is equal AX*24.
B. mov CL, 3
shr ax, CL is equal AX/23.
C. mov CL,8
sar AX, CL is equal AX/28.
D. mov CL, 2
shl AX,CL is equal AX/22
13. Which of the following instructions will turn on the Carry Flag once it has been fully
executed?
14. Based on the program segment below, which statements are CORRECT about
assembly language instruction?
Num1 db 88h
mov AL, 88h
cmp AL, Num1
A. I, II and III
B. I, II and IV
C. I, III and IV
D. II, III and IV
6
CONFIDENTIAL CS/JULY2021/CSC159
15. Based on the program segment below, which statements are INCORRECT about
assembly language instruction?
ANSWER PART B
ANSWER PART B
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
7
CONFIDENTIAL CS/JULY2021/CSC159
PART C
QUESTION 1
a) Declare a 8-bit of storage for variable named sum and initialize it to value -1.
b) Declare a 8-bit of storage for variable named data1 and initialize it to A9.
c) Transfer 1A2B to any type of general purpose register using hexadecimal format.
d) Subtract the AL register from data1 and assign the value to variable sum.
8
CONFIDENTIAL CS/JULY2021/CSC159
QUESTION 2
Convert the following equation into assembly language instructions (assume Y in word
size).
(5 MARKS)
9
CONFIDENTIAL CS/JULY2021/CSC159
PART C
QUESTION 3
a) Assume that you have unsigned values in the AX and BX registers, in which both
values are not the same, i.e., 5010 in the BX register, and 10010 in the AX register.
By using the comparison instruction, move the smaller value into the CX register,
and use the DX register to store the bigger value.
(4 MARKS)
ValueA = 310
ValueB = (5010 / 1610) + (ValueA * 210 * 1610)
(6 MARKS)
10
CONFIDENTIAL CS/JULY2021/CSC159
11