0% found this document useful (0 votes)
3 views

Sample Lab Test CSC159 [QUESTION] SET2

This document is a lab test paper for the Computer Organization course at Universiti Teknologi Mara, detailing the structure and instructions for candidates. It consists of multiple parts with various questions related to assembly language and computer organization concepts. Candidates are required to answer all questions within three hours and submit their answers in PDF format.

Uploaded by

sitiamalku82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Sample Lab Test CSC159 [QUESTION] SET2

This document is a lab test paper for the Computer Organization course at Universiti Teknologi Mara, detailing the structure and instructions for candidates. It consists of multiple parts with various questions related to assembly language and computer organization concepts. Candidates are required to answer all questions within three hours and submit their answers in PDF format.

Uploaded by

sitiamalku82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

UNIVERSITI TEKNOLOGI MARA

LAB TEST

COURSE : COMPUTER ORGANIZATION


COURSE CODE : CSC159
SEMESTER : MAC 2021 – OCT 2021
TIME : 9.00 AM – 12.00 PM

INSTRUCTIONS TO CANDIDATES:

1. Answer ALL questions within 3 hours.


This question paper consists of FOUR (4) parts.

QUESTIONS MARKS STUDENT SCORE


PART A 15
PART B 10
QUESTION 1 5
PART C
QUESTION 2 5
PART D QUESTION 1 10
TOTAL 45

2. You are NOT allowed to discuss/share/disseminate the questions and answers


amongst your classmates/course mates.
3. You are ALLOWED to use any EMU8086 to write/compile/debug your program.
4. If your answer is similar to your classmates/course mates, further actions can be
taken by your lecturer, and you will be penalised.
5. Submit your answer in PDF format.

NAME:

MATRIC NO:

GROUP:

LECTURER:

DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO


CONFIDENTIAL CS/JULY2021/CSC159

PART A (10 marks):


Answer TRUE (T) or FALSE (F) for the following statements.
Write your answers at ANSWER PART A.

1. mov and xchg instructions will not change all flags registers.

2. Source operand cannot be an immediate value.

3. The statement xchg total, count is valid if it is in 16-bit size.

4. Div (divide) instruction performs division on unsigned numbers. If the source


operand is 16-bit, as in div bx, the quotient is stored in the bx, while the remainder
is stored in the dx.

5. The following assembly language program sets the values for Carry Flag, Sign Flag
and Auxiliary Flag to ONE (1)

Mov cx, 10d


Mov dx, 12d
Sub cx, dx

6. Immediate data cannot be used as an operand in the NOT instructions.

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

PART B (15 MARKS)


Write your answer at ANSWER PART B

1. What is type of the addressing mode of the below instruction?

MOV BX, DX

A. Immediate operand
B. Register operand
C. Memory operand
D. Index operand

2. Which of the following is CORRECT statement about status flag?

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.

4. Given the following assembly language:

Mov dx,02F1
Mov dh,EE
Mov bh, CD
Xchg dh, bl

What are the value for register BX and DX?

A. BX= CD00 ; DX = 02EE


B. BX= CD02 ; DX = 00EE
C. BX= CDEE ; DX = 00F1
D. BX= CD02 ; DX = 00F1

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

Choose the BEST arithmetic instructions to perform the above mathematical


equation (assume that a, b and c are one word long and are positive numbers):

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:

A. The format for sub instruction is: sub destination, source


B. The execution of a sub instruction affects all the status flags.
C. Immediate values are allowed to be placed as the destination operand.
D. sub instructions can be used to subtract both signed and unsigned numbers.

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?

A. mov al, 34h


mov cl, 03h
rol al, cl

B. mov al, 34h


mov cl,02h
rol al,cl

C. mov al, 34h


rol al,1

D. mov al, 34h


mov cl,05h
rol al,cl

14. Based on the program segment below, which statements are CORRECT about
assembly language instruction?

Num1 db 88h
mov AL, 88h
cmp AL, Num1

I. The execution of cmp instruction perform operation sub AL, Num1.


II. The execution of cmp instruction do change the value in the destination
operand.
III. The execution of cmp instruction will make Zefo Flag become 1 (ZF=1).
IV. The execution of cmp instruction will give value for AX=0088h.

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?

mov ax, 20h


mov cx, 03h
jmp REPEAT
REPEAT:
add ax, 2h
xchg ah, al
loop REPEAT

add ax, 50h


exit

A. At loop REPEAT, register CX will be decremented by 1 and program control is


transferred to label REPEAT.
B. After the loop ends, program execution will continue at add ax, 50h
instruction.
C. The loop stops when CX>0 AND Zero Flag (ZF)=1.
D. The loop will be carried out for 3 times until the loop ends.

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

Questions (a) to (e) are related to each other.


Write an assembly language instruction based on each statement below:
(5 MARKS)

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.

e) What is the content of variable sum.

8
CONFIDENTIAL CS/JULY2021/CSC159

QUESTION 2

Convert the following equation into assembly language instructions (assume Y in word
size).

Y = 𝟐𝟕𝟖𝟏𝟎 + 𝟐𝟐𝟔𝟏𝟎 – 𝟏𝟕𝟔𝟏𝟎 + 𝟏𝟏𝟎

(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)

b) Using SHIFT instructions, write appropriate assembly language instructions to


perform the following arithmetic operation:

ValueA = 310
ValueB = (5010 / 1610) + (ValueA * 210 * 1610)

(6 MARKS)

10
CONFIDENTIAL CS/JULY2021/CSC159

END OF QUESTION PAPER

11

You might also like