cs401 PDF
cs401 PDF
cs401 PDF
2012
My Dear Fellows
Note: I tried my best to solve all
the midterm papers according to
handouts with references if you
found any mistake then please
inform me.
After Reading this file there is no
need to surf other papers of cs401
because I surf all the papers and
try to cover all in one.
Thanks!
Best of luck For Exams!
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
OBJECTIVE (MCQZ):-
04 May
2012
( Marks: 1 )
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
04 May
2012
Reference:
Whenever an element is pushed on the stack SP is decremented by two as
the 8088 stack works on word sized elements.
Question No: 12 ( Marks: 1 ) - Please choose one
When a very large number is divided by very small number so that the quotient is larger
than the space provided, this is called
Divide logical error
Divide overflow error Page no:85
Divide syntax error
An illegal instruction
Reference:
If a large number is divided by a very small number it is possible that the
quotient is larger than the space provided for it in the implied destination. In
this case an interrupt is automatically generated and the program is usually
terminated as a result. This is called a divide overflow error.
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
page no:81
Reference:The second byte in the word designated for one screen location holds the
foreground and background colors for the character. This is called its video
attribute or attribute byte.
04 May
2012
04 May
2012
04 May
2012
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
04 May
2012
Reference:
The shift logical left operation is the exact opposite of shift logical right. In
this operation the zero bit is inserted from the right and every bit moves one
position to its left with the most significant bit dropping into the carry flag.
Shift arithmetic left is just another name for shift logical left.
Execution of the instruction mov word [ES: 160], 0x1230 will print the character color
will
Green
page no : 81
White
Red
Black
Refernce:This is displayed 80 words after the start and there are 80 characters in
one screen row. Therefore this is displayed on the first column of the second
line. The ASCII code used is 30, which represents a 0 while the attribute
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
1 argument
1 argument
3 arguments
No arguments
Question No: 2
( Marks: 1 ) - Please choose one
In STOSB instruction SI is decremented or incremented by
4 12 3
Page: 92
Reference:SI will be
Incremented by one or two depending of whether STOSB or STOSW is used.
Question No: 3
04 May
2012
04 May
2012
The maximum parameters a subroutine can receive (with the help of registers) are
6
7 page no 72
8
9
Refernce:The maximum parameters a subroutine can receive
are seven when all the general registers are used.
Question No: 8
effective page no 33
faulty
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
AX page no 85
BX
CX
DX
Reference:The implied dividend is 16bit and is stored in the AX
register
Question No: 11
04 May
2012
Suppose the decimal number "35" after shifting its binary two bits
to left, the new value becomes _________
35
70
140 page no:52
17
Reference:The left shifting operation is basically multiplication by 2 while the right
shifting operation is division by two.
Question No: 14
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
04 May
2012
NOTE:The lecture number given before every mcq below is according to lms lecture
schedule not the handouts.
Question # 1
There are three busses to communicate the processor and memory named as
_____________
1) : address bus.,data bus and data bus.
2) : addressing bus.,data bus and data bus.
3) : address bus.,datamove bus and data bus.
4) : address bus.,data bus and control bus..
Correct Option : 4 From : Lecture 1
Question # 2
The address bus is unidirectional and address always travels from processor to
memory.
1) : TRUE
2) : FALSE
3) :
4) :
Correct Option : 1 From : Lecture 1
Question # 3
Data bus is bidirectional because________
1) : To way
2) : Data moves from both, processor to memory and memory to processor,
3) : Data moves from both, processor to memory and memory to data Bus,
4) : None of the Given
Correct Option : 3 From : Lecture 1
Question # 4
Control bus________
1) : is Not Important.
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
04 May
2012
04 May
2012
04 May
2012
04 May
2012
04 May
2012
04 May
2012
04 May
2012
04 May
2012
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
04 May
2012
04 May
2012
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
04 May
2012
04 May
2012
04 May
2012
04 May
2012
04 May
2012
Double byte
Double word
Reference:One screen location corresponds to a word in the video memory
04 May
2012
04 May
2012
04 May
2012
page no 91
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
not sure
:-SUBJECTIVE-:
IF DF=0 what its represent and IF DF=1 what its represent ?
Page no:17
Specifically related to string instructions, this flag tells
whether the current operation has to be done from
bottom to top of the block (D=0) or from top to bottom
of the block (D=1).
IF=It tells whether the processor can be interrupted from
outside or not.
Q.
Relation between RET and CALL is dependent or independent.
Page no :64
The RET
works regardless of the CALL and the CALL works regardless of the RET. If
you CALL a subroutine it will not complain if there is no RET present and
similarly if you RET without being called it wont complain.
Q.
Write all steps of algorithm for printing number 352.
Page no 84
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
Q.
When the instruction "push ax" is executed in decrementing stack how the value of SP
will change
Page no 69
Push ax will push
the current value of the AX register on the stack. The operation of PUSH is
shown below.
SP SP 2
[SP] AX
Q.
Explain MUL instruction in both cases (i) if the source operand is byte (ii) if the source
operand is a word?
Page no 87
MUL (multiply) performs an unsigned multiplication of the source operand
and the accumulator. If the source operand is a byte, then it is multiplied by
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
Q#21 Mark 2
What are the instructions used by assembly language for permanent and temporary
diversions.
The instructions for permanent diversion in 8088 are the
jump instructions, while the instruction for temporary diversion is the CALL
instruction.
Q#22 Mark 2
Which instruction is used to determine zero bit in string.
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
Q#23 Mark 3
Explain the use of TEST instruction.
Page no: 60
The test instruction is used for bit testing. BX holds the mask and in every next iteration
it is shifting left, as our concerned bit is now the next bit.
Q#24 Mark 3
Explain LES and LDS
Page no: 97
The string instructions need source and destination in the form of a segment offset pair.
LES and LDS load a segment register and a general purpose register from two
consecutive memory locations. LES loads ES while LDS loads DS. Both instructions has
two parameters, one is the general purpose register to be loaded and the other is the
memory location from which to load these registers. The major application of these
instructions is when a subroutine receives a segment offset pair as an argument and the
pair is to be loaded in a segment and an offset register.
Q#25 Mark 5
Describe local variables.
Page no: 75
Another important role of the stack is in the creation of local variables that are only
needed while the subroutine is in execution and not afterwards. They should not take
permanent space like global variables. Local variables should be created when the
subroutine is called and discarded afterwards. So that the spaced used by them can be
reused for the local variables of another subroutine. They only have meaning inside the
subroutine and no meaning outside it.
The most convenient place to store these variables is the stack. We need some special
manipulation of the stack for this task. We need to produce a gap in the stack for our
variables. This is explained with the help of the swap flag in the bubble sort example.
The swap flag we have declared as a word occupying space permanently is only needed
by the bubble sort subroutine and should be a local variable. Actually the variable was
introduced with the intent of making it a local variable at this time. The stack pointer
will be decremented by an extra two bytes thereby producing a gap in which a word can
reside. This gap will be used for our temporary, local, or automatic variable; however we
name it. We can decrement it as much as we want producing the desired space,
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
Question No: 17
( Marks: 2 )
Why is it necessary to provide the segment and offset address in case of FAR jump ?
Page no 46:
Segment and offset must be given to a far jump. Because, sometimes we may need to
go from one code segment to another, and near and short jumps cannot take us
there. Far jump must be used and a two byte segment and a two byte offset are
given to it. It loads CS with the segment part and IP with the offset part.
Question No: 18 ( Marks: 2 )
Whats your understanding about Incrementing and Decrementing Stack?
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
( Marks: 2 )
04 May
2012
scroll up
scrollup: push bp
mov bp,sp
push ax
push cx
push si
push di
push es
push ds
mov ax, 80 ; load chars per row in ax
mul byte [bp+4]
; calculate source position
mov si, ax
; load source position in si
push si
; save position for later use
shl si, 1
; convert to byte offset
mov cx, 2000
; number of screen locations
sub cx, ax
; count of words to move
mov ax, 0xb800
mov es, ax
; point es to video base
mov ds, ax
; point ds to video base
xor di, di
; point di to top left column
cld
; set auto increment mode
rep movsw
; scroll up
mov ax, 0x0720
; space in normal attribute
pop cx
; count of positions to clear
rep stosw
; clear the scrolled space
pop ds
pop es
pop di
pop si
pop cx
pop ax
pop bp
ret 2
Question No: 22 ( Marks: 5 )
Explain how extended shifting is performed
Page no :56
Using our basic shifting and rotation instructions we can effectively shift a 32bit
number in memory word by word. We cannot shift the whole number at once since
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
04 May
2012
Question No: 17
( Marks: 1 )
( Marks: 1 )
Question No: 19
( Marks: 2 )
04 May
2012
( Marks: 2 )
( Marks: 3 )
( Marks: 3 )
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
Page no 52
SHR
The SHR inserts a zero from the left and moves every bit one position to the right and
copy the rightmost bit in the carry flag.
SAR
The SAR shift every bit one place to the right with a copy of the most significant bit left
at the most significant place. The bit dropped from the right is caught in the carry
basket. The sign bit is retained in this operation.
Question No: 18 ( Marks: 2 )
For what purpose "INT 1" is reserved ?
Page no 103
INT 1, Trap, Single step Interrupt
This interrupt is used in debugging with the trap flag. If the trap flag is
set the Single Step Interrupt is generated after every instruction. By
hooking this interrupt a debugger can get control after every
instruction and display the registers etc. 8088 was the first processor
that has this ability to support debugging.
Question No: 19 ( Marks: 2 )
Define implied operand?
Page no 18
It is always in a particular register say the accumulator. It needs to not be mentioned in
the instruction.
The rotate right (ROR) and rotate through carry right (RCR) instructions shift all the bits
toward less significant bit positions, except for the least-significant bit, which is rotated
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
The lods instruction is unique among the string instructions. We will never use a repeat
prefix with this instruction. Because it copies the byte or word pointed at by ds:si into
the al, ax, or eax register, after which it increments or decrements the si register by one,
two, or four. Repeating this instruction via the repeat prefix would serve no purpose
whatsoever since the accumulator register will be overwritten each time the lods
instruction repeats. At the end of the repeat operation, the accumulator will contain the
last value read from memory.
3. Write all steps of algorithm for printing number 352.
In this technique the first digit printed is the right most one
Divide the number by base (10 in case of decimal)..The remainder after
first division was 3, after second division was 5 and after the third division
was 2.
The remainder is its right most digit
Convert the digit to its ASCII representation
Save this digit on stack
If the quotient is non-zero repeat the whole process to get the next
digit, otherwise stop.
Pop digits one by one and print on screen left to right. Stack is a Last In First Out
structure so if 3, 5, and 2 are pushed on it, 2, 5, and 3 will come
out in this order.
24. What are the result after performing the instruction
(each carry 1 marks )
1.
and ax,bx
2.
or ax,bx
3.
xor ax,bx
Given that ax = 00110011 and bx = 00010001
25. Describe Local Variables?
A local variable is valid within the statement block in which it is defined and within any
nested statement blocks, unless you redefine the variable within the statement block.
Local variables should be created when the subroutine is called and discarded
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
Segment Registers:
In certain processors memory is segmented (or divided).Its actually not physically
segmented rather logically to store code, data, stack etc in different portions of memory.
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com
04 May
2012
The segment, offset pair is called a logical address, while the 20bit address is a physical
address which is the real thing. Logical addressing is a mechanism to access the physical
memory.
Offset:
A distance from a given paragraph boundary in memory. The offset usually is given as a
number of bytes
Word is unit of data, like (bit -1 , nibble -4 , byte-8, word-16, Dword-32, Qword-64) A
word is of 2 bytes = 16bits Dword = 4 bytes Qword= 8 bytes
Registers are like Scratch Pad Ram.What are the meaning of scratch pad ram.
Scratchpad means a high-speed internal memory used for temporary storage of
preliminary information.
An 8-bit register, like AH, AL, BH, BL, can only store one data element at a time. And a
16-bit register can store multiple data element e.g. one in AH and other in AL.
MIDTERM EXAMINATION
CS401- Computer Architecture and Assembly Language Programming
All Mcqz and Subjective Solved With Reference
SOLVED BY: SaHeR
For any help in studies contact my id
Serious.sahar6@gmail.com