0% found this document useful (0 votes)
40 views8 pages

COAL Sessional-I Solution

Uploaded by

Sajeela Noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views8 pages

COAL Sessional-I Solution

Uploaded by

Sajeela Noor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

National University of Computer and Emerging Sciences

FAST School of Computing Fall-2022 Islamabad Campus

Serial No:
EE-2003 Computer
Sessional Exam-I
Organization and Assembly Total Time: 1 Hour
Language Total Marks: 60

________________
Signature of Invigilator
Tuesday, 27th September, 2022.

Course Instructor

Dr. Niaz Ahmed, Ms. Sobia Rasheed, Ms. Shehr


Bano, Mr. Rohail Gulbaz, Mr. Shams Farooq

_____________________________________________ _____________________
Student Name Roll No. Section Signature

DO NOT OPEN THE QUESTION BOOK OR START UNTIL INSTRUCTED.


Instructions:
1. Attempt question paper. Attempt all of them. Read the question carefully, understand the
question, and then attempt it.
2. No additional sheet will be provided for rough work. Use the provided space for rough work
3. After asked to commence the exam, please verify that you have eight (8) different printed
pages including this title page. There are a total of 6 questions.
4. Calculator sharing is strictly prohibited.
5. Use permanent ink pens only. Any part done using soft pencil will not be marked and cannot
be claimed for rechecking.

Q-1 Q-2 Q-3 Q-4 Q-5 Q-6 Total


Marks
Obtained
Total
10 10 10 10 10 10 60
Marks
National University of Computer and Emerging Sciences
FAST School of Computing Fall-2022 Islamabad Campus
Question 1 [10 Marks]
Convert the following as indicate. Perform Arithmetic operation and then convert. No marks for direct
answer

i. (AB.3)16 + (5E)16 = ( ? )2 iii. (1.01)2 x (0.1011)2 = ( ? ) 10

ii. (1.000)16 – (0.9F1)16 = ( ? )8 iv. – (25)10 – (126) 10


Perform 2’s complement subtraction
National University of Computer and Emerging Sciences
FAST School of Computing Fall-2022 Islamabad Campus
Question 2 [10 Marks]

Consider the following data declaration and fill in the given memory in hexadecimal (h).

Note: ASCII for ‘A’ = 041H

.data
v1 db 56h,23q,17d,1000101b,10,-1,"AB"
v2 word 'AB','CD',0ABCDH
v3 dd 'ABC',01234ABCDH
v4 Qword 012345678H

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
0100 56 13 11 45 0A FF 41 42 42 41 44 43 CD AB 43 42

0110 41 00 CD AB 34 12 78 56 34 12 00 00 00 00

0120
0130

Page 3 of 8
National University of Computer and Emerging Sciences
FAST School of Computing Fall-2022 Islamabad Campus
Question 3 [10 Marks]
Update the given registers after executing following code.

Note: Consider starting address at 0x0100

.data
size=3
ary1 db 2 dup(size
dup(1,0AH))
size=5
ary2 db 1 dup(size dup(2))
ary3 dw 2,3
dw 3
db 2
bary4 LABEL BYTE
wary4 LABEL WORD
Dary4 dd 0ABCDEF12H,1
pary dw ary1

.code
mov ax,@data
mov ds,ax
mov ax,0

mov al,sizeof ary1 AL 02


mov ah,lengthof ary2 AH 05
mov bl,lengthof ary3 BL 02
mov si,OFFSET ary1 SI 0100
mov di,pary DI 0100
mov al,bary4 BL 02
mov bx,wary4 DX EF12
mov cx,WORD PTR[Dary4+4] AX 0001

Page 4 of 8
National University of Computer and Emerging Sciences
FAST School of Computing Fall-2022 Islamabad Campus
Question 4 [10 Marks]
Implement following C++ code using LOOP statement. Update the final value of SI after execution of
the program.

int si=0;
for(int a=2;a>0;a--)
{
for(int b=a;b>0;b--
)
{
si++;
}
}
.code
mov ax,@data
mov ds,ax
mov si,0
mov cx,2
outer:
mov bx,cx
inner:
inc si
Loop inner
mov cx,bx
LOOP outer

mov ah,04ch
int 021h

Page 5 of 8
National University of Computer and Emerging Sciences
FAST School of Computing Fall-2022 Islamabad Campus
Question 5 [10 Marks]

Consider the following data declaration. Copy String to Stringcopy using LOOP. You are not
supposed to copy course code to the stringcopy.

NOTE: Your copy string should look like as following

stringcopy " Computer Organization and Assembly Language"

.data
string db "EE2003-Computer Organization and Assembly Language"
s1=($-str1)-7
stringcopy db s1 dup("?")
.code

mov ax,@data
mov ds,ax
mov ax,0

mov cx,s1
mov si,offset string
add si,7
mov di,offset stringcopy
L1:
mov al,[SI]
mov byte Ptr[DI],al
inc si
inc di
LOOP L1
mov ah,04ch
int 021h

end

Page 6 of 8
National University of Computer and Emerging Sciences
FAST School of Computing Fall-2022 Islamabad Campus
Question 6 [10 Marks]

i. Update the given flags after executing following code

mov ax, 0FFFFH OF SIGN ZF AF PF CF


add ax,1
0 0 1 1 1 1

ii. Write a code that add v1 with v2 and store result in sum. Your code should be for X86 architecture. You
are not supposed to use movsx command as it belongs to .386 architecture

.data
v1 db -5
v2 dw 0FFFCh
sum dw 0

.code
mov ax,@data
mov ds,ax
mov ax,0
mov ax,0FFFFh
mov al,v1
add ax,v2
mov sum,ax

mov ah,04ch
int 021h

end

Page 7 of 8
National University of Computer and Emerging Sciences
FAST School of Computing Fall-2022 Islamabad Campus
iii. Write a code that swap v1 with v2.

.data
v1 db 5
v2 db 4
.code
mov ax,@data
mov ds,ax
mov ax,0

mov al,v1
xchg al,v2
mov v1,al

mov ah,04ch
int 021h

iv. Consider the following data declaration and fill in the given memory in hexadecimal (h).

.data
v1 db 1
align WORD
v2 word 2
v3 byte 3
align WORD
v4 dw 4

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
0100 01 00 02 00 03 00 04 00
0110
0120
0130

Page 8 of 8

You might also like