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 softwarelarge code sizes

low cycles per second all of three

ii)Addressable memory of i7 processor is ……..

64 GB32 GB16 GB 8GB

iii)Memory and portaddresses are identified by

different address rangessignal 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

842 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, RAXEDX, EAX

EAX, EDXRAX, RDX

ix)CLD instruction when used with MOVSW ………………...

ESI and EDI are incremented by 2SI and DI are incremented by 2

RSI and RDI are incremented by 2all 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, EBXPUSH ESI

 MUL RDX POP CX

xii) In call _WriteConsoleA@20, 20 stands for

20 bytes10 words5 double words5 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?

025‘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.

zerooverflowsign carry

xvi)Whichof the following segment registers is used withoffset in BX register

CSDSES 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

010111010111110101011001none of three

xx)After MOV AX, 01011101b; BTR AX, 4 sequence of instructions carry flag is ………. and 4th bit = ………..

set, 1set, 00, 00, 1

xxi)Which one of the following instructions is false?

XCHG RDX, RAXMOV ECX, DWORD PTR [EBX+EDI+5]

rep MOVSD  OUT ECX, EBX

xxii)After execution of ‘ PUSH EAX ‘ instruction, ESP register is

decremented by 4decremented by 8

incremented by 4none of three

xxiii)MOV CX, 32763; ADD CX, 5. Which flag is set after execution of the two instructions?

OverflowZeroCarrynone

xxiv)MOV DL, 10010101b; CMP DL, 10010100b; JZ label2 ; Control will be transferred to label2 if

JBE replaces JZJL replaces JZ

JG replaces JZlabel2 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 ………………………………

E0FE4AE0FFAE112AE102A

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, set01010011, clear11010011, set11010011, clear

xxviii)xvi)An array is defined as ‘array DWORD 16 DUP(‘OK’)’, ‘SIZEOF array’ returns ………………… and ‘LENGTHOF array’ returns ………………..

64, 32128, 3264, 16none 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 varPUSHEDI PUSH AX PUSH DL

xxxii)’ SAL EBX, 1’ instruction always fills LSB with …………..

01depends on numbernone of three

xxxiii)MOV BH, 01011000b ; NEG BH instructions return …………………binary number.

11001000101101011100101110101000

xxxiv)Which of the following instructions pop 32Bit registers from stack?

POPFDPOPAPOPADPOPF

xxxv) The task performed by MOV AH, 4ch; int 21his

to terminate an applicationto start an application

to suspend an applicationto 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