CS401 Midterm Current Paper
- Type
- Midterm past paper
- Course
- CS401 Computer Architecture and Assembly Language Programming
- Size
- PDF 432 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 2, 3 of 11. Download the file for all 11 pages.
1) 5 flags thy onki defines likhni the
- C = Carry = This extra bit that won’t fit in the target register is placed in the carry flag where it can be used and tested.
- P = Parity = Parity is the number of “one” bits in a binary number. Parity is either odd or even.
- A = Auxiliary Carry = auxiliary carry is the carry from the first nibble to the second.
- Z = Zero Flag = The Zero flag is set if the last mathematical or logical instruction has produced a zero in its destination
- S = Sign Flag = A signed number is represented in its two’s complement form in the computer.
- T = Trap Flag = The trap flag has a special role in debugging which will be discussed later.
- I = Interrupt Flag = It tells whether the processor can be interrupted from outside or not.
- D = Direction Flag = 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).
- O = Overflow Flag = The overflow flag is set during signed arithmetic, e.g. addition or subtraction, when the sign of the destination changes unexpectedly
2) ASCII code likhna tha a ka
A = 065, a = 097
3) How MOVS work
MOVS is the instruction that allows memory to memory moves. MOVS transfers a byte or word from the source location DS:SI to the destination ES:DI and updates SI and DI to point to the next locations. MOVS is used to move a block of memory.
4) Difference near and short jump
A short JMP is the relative JMP that you refer to. It is encoded as a two bytes; the actual JMP and the number of bytes +/- relative to the current IP. A near jump allows you to jump within the current "segment" (using real mode terms) or within the currently selected memory area in the CS selector.
5) Local variable and where to store it
We modify the bubble sort subroutine to use a local variable to store the swap flag. A local variable should be used to store the return value from the first recursive call.
- selective bit inversion on lowest nibble 100110b.
XOR can also be used as a masking operation to invert selective bits. The bits in the mask are cleared at positions, which are to retain their values, and are set at positions, which are to be inverted.
Q7. What is the function of segment override prefix and what changes it brings to the opcode?
Solution: Function of Segment Override Prefix: The segment override prefix, which may be added to almost any instruction in any memory addressing mode, allows the programmer to deviate from the default segment.
- 2 long thy or dono ma instructions di hwi thi wo execute kr k onky components btany aur attribute bytes ky display colours / Background and foreground colors k attributes
The attribute byte as detailed below has the RGB for the foreground and the background. It has an intensity bit for the foreground color as well thus making 16 possible colors of the foreground and 8 possible colors for the background.
7 – Blinking of foreground character 6 – Red component of background color 5 – Green component of background color 4 – Blue component of background color 3 – Intensity component of foreground color 2 – Red component of foreground color 1 – Green component of foreground color 0 – Blue component of foreground color
Q9. How are local variables created?
Local variables are created when the method, constructor or block is entered and the variable will be destroyed once it exits the method, constructor, or block. ... Local variables are visible only within the declared method, constructor, or block. Local variables are implemented at stack level internally.
Q10. Process of calling a subroutine keeping in mind stack data structure and using inter segment direct call?
Subroutine nesting is a common Programming practice In which one Subroutine call another Subroutine. As the last Subroutine called is the first one to be returned ( Last in first out format). So stack data structure is the most efficient way to store the return addresses of the Subroutines.
11) LDS ka aya tha
LES loads ES while LDS loads DS. Both these instructions have two parameters, one is the general purpose register to be loaded and the other is the memory location from which to load these registers.
12) Inter or intra ka ayaa tha
Near calls are also called intra segment calls, while far calls are called inter-segment calls.
13) LOADS ki definition:
LODS transfers a byte or word from the source location DS:SI to AL or AX and updates SI to point to the next location. LODS is generally used in a loop
14) REP intsruction working
REP Prefix: REP repeats the following string instruction CX times. The use of CX is implied with the REP prefix. The decrement in CX doesn’t affect any flags and the jump is also independent of the flags, just like JCXZ.
15) movement of busses between memory and processor
Address bus - carries memory addresses from the processor to other components such as primary storage and input/output devices. The address bus is unidirectional . Data bus - carries the data between the processor and other components.
16) define byte with example
A byte is a unit of memory data equal to either seven or eight bits depending on whether or not it needs error correction (parity). ... You can think of a byte as one letter, for example, the letter 'h' is one byte or eight bits and the word 'hope' as four bytes or 32 bits (4*8).
17) Assembly Directives kia hte hain detail mn btana tha
Directives are commands that are part of the assembler syntax but are not related to the x86 processor instruction set. All assembler directives begin with a period (.) align directive causes the next data generated to be aligned modulo integer bytes.
18) Vectored kia hte hai 8088 architecture mn
The software interrupt mechanism in 8088 uses vectored interrupts meaning that the address of the interrupt routine is not directly mentioned in an interrupt call, rather the address is lookup up from a table. 8088 provides a mechanism for mapping interrupts to interrupt handlers.
19) Type The Assembly Language Program Of Add 10 Numbers 10,20,30,40,50,10,20,30,40,50
- Write Three name of assembly logical part.
We have two logical parts of our program, the code and the data, and actually there is a third part called the program stack as well, but higher level languages make this invisible to us. These three logical parts of a program should appear as three distinct units in memory, but making this division is not possible in the linear memory model.
Related CS401 files
All CS401 files →- CS401 Midterm Solved MCQs 2012 Midterm PDF 2 MB
- CS401 Midterm Objective and Subjective Past Papers Midterm PDF 1.3 MB
- CS401 Midterm Past Papers by Junaid Midterm PDF 1.5 MB
- CS401 Midterm Past Papers Midterm PDF 92 KB
- CS401 Highlighted Notes Highlighted PDF 8.7 MB
- CS401 Quiz 4 January 2026 Quiz PDF 35 KB
Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.