Fed. Urdu University for Arts, Science and Technology
Department of Computer Science & IT
TerminalExam. BS III (2015)
Course: Computer Architecture & AssemblyDuration: 2 hour
Date:June13, 2015Max. Marks: 60
Student’s Name: ……………..…………………. Student’s Seat No: ………………
Instruction: Attempt all questions
Q 1.Tick( ) the most appropriate box.
i)RISC technology ………
emphasizes on softwarelarge code sizes
low cycles per second all of three
ii)Addressable memory of i7 processor is ……..
64 GB32 GB16 GB 8GB
iii)Memory and portaddresses are identified by
different address rangessignal on control bus
segment registers all of three
iv)The state of trap flag shows whether
breakpoints are enabled errors are trapped
messages are trapped DI and SI registers are incremented
v)………… bytes is the size of R8D register
842 1
vi)Which one of the following instructions is false?
PUSH RBX PUSH ESI
PUSH DI PUSH BH
vii) MUL R12 instruction saves upper 64 bit in ……… register and lower 64 bit in ….... register.
RDX, RAX R10, R11 EDX, EAX RAX, RDX
viii) IDIV EBX divides a number in EDX:EAXand places quotient in …. and remainder in …
RDX, RAXEDX, EAX
EAX, EDXRAX, RDX
ix)CLD instruction when used with MOVSW ………………...
ESI and EDI are incremented by 2SI and DI are incremented by 2
RSI and RDI are incremented by 2all of three
x)To display a string ………….. is pushed on the stack and Windows API function_GetStdHandle@4 is called
10-10 11-11
xi)Which one of the following instructions is false?
MOV RAX, EBXPUSH ESI
MUL RDX POP CX
xii) In call _WriteConsoleA@20, 20 stands for
20 bytes10 words5 double words5 arguments
xiii) WriteConsole(handle, &msg[0], 25, &written, 0)is a WIN API call which argument is pushed first when the call is used in assembly language?
025‘handle’ offset of ‘written’
xiv).model flatdirective in 32bit assembly code is used for …………..
32bit memory address segmented address
32 bit Stack 32 bit data segment
xv)MOV EAX, 00001111b;MOV EBX,0Fh; SUB EAX, EBXsequence of instructions set ….. flag register.
zerooverflowsign carry
xvi)Whichof the following segment registers is used withoffset in BX register
CSDSES SS
xvii)Signed 16-bit integer data type in MASM is coded as,
TBYTE SWORD QWORD SDWORD
xviii)Data defined as ‘ column BYTE 5 DUP(“JUW”)’ is stored in memory as:
5 bytes 10 bytes 12 bytes 15 bytes
xix)After MOV AL, 01011101b; BTC AL,5 sequence of instructions AL contains
010111010111110101011001none of three
xx)After MOV AX, 01011101b; BTR AX, 4 sequence of instructions carry flag is ………. and 4th bit = ………..
set, 1set, 00, 00, 1
xxi)Which one of the following instructions is false?
XCHG RDX, RAXMOV ECX, DWORD PTR [EBX+EDI+5]
rep MOVSD OUT ECX, EBX
xxii)After execution of ‘ PUSH EAX ‘ instruction, ESP register is
decremented by 4decremented by 8
incremented by 4none of three
xxiii)MOV CX, 32763; ADD CX, 5. Which flag is set after execution of the two instructions?
OverflowZeroCarrynone
xxiv)MOV DL, 10010101b; CMP DL, 10010100b; JZ label2 ; Control will be transferred to label2 if
JBE replaces JZJL replaces JZ
JG replaces JZlabel2 is at less than 127 bytes
xxv)If DS register contains E0FE (hex value) and offset address is 004A (hex value) then physical memory address is ………………………………
E0FE4AE0FFAE112AE102A
xxvi)‘ XOR EDX, EDX ‘ sets ……………………. Flag on sign parity carry zero
xxvii)MOV CL, 11001101b ; RCL CL, 6; As a result of two instructions AL contains …………………… and carry flag is ………. At the start carry flag is off.
01011001, set01010011, clear11010011, set11010011, clear
xxviii)xvi)An array is defined as ‘array DWORD 16 DUP(‘OK’)’, ‘SIZEOF array’ returns ………………… and ‘LENGTHOF array’ returns ………………..
64, 32128, 3264, 16none of three
xxix) Service 01 of interrupt 21h ……………………………………..
prints a character on screen prints string on screen
gets a character fromkeyboard gets a string from keyboard
xxx)Service 09 of interrupt 21h ……………………………………..
prints a character on screen prints string on screen
prints a character on a printer prints a number on screen
xxxi)Which one of the following instructions is false? Assume var as 64 bit
PUSH varPUSHEDI PUSH AX PUSH DL
xxxii)’ SAL EBX, 1’ instruction always fills LSB with …………..
01depends on numbernone of three
xxxiii)MOV BH, 01011000b ; NEG BH instructions return …………………binary number.
11001000101101011100101110101000
xxxiv)Which of the following instructions pop 32Bit registers from stack?
POPFDPOPAPOPADPOPF
xxxv) The task performed by MOV AH, 4ch; int 21his
to terminate an applicationto start an application
to suspend an applicationto end a procedure
Q 2.a)How parameters are passed to a procedure?
b)What is wrong with the following embedded assembly code in c++?
…….
__asm
{
mov eax,00000900h
mov edx, OFFSET var
int 21h
}
c)What result do we get by ‘PUSHFD’ instruction?
d)What is checked by LOOPNE instruction?
e)Explain the difference between SAR and SHR instructions.
f)What differentiates IMUL and MUL instructions
g)SUBBYTE PTR[EBX+EDI+10], 32. Is the statement correct?
Q 3.a).586P
………
invoke MessageBox, NULL, ADDR Message, ADDR WindowTitle, MB_OK
invoke ExitProcess, eax.
Explain the above code.
b)Explain the followinginstructions and use them.:
SHLD, LAHF, STD, BTC, CBW, MOVSQ, CMPSD, STOSB, LODSW, MOVZX
.
Q 4a) Use LEAinstruction
b)Check a number for even property.
c)label1:cmp byte ptr[ebx+esi],97
jl label2
cmp byte ptr[ebx+esi],122
jg label2
sub byte ptr[ebx+esi], 32
label2:inc esi
loop label1
What is being performed in the above code?
THE END
Assembly LanguageDept. of Computer Sc. & IT FUUAST Page 1 of 3