CS401 Short Notes for Midterm.pdf

Verified academic study resource for CS401 (Computer Architecture & Assembly Language) under the Computer Science at Virtual University of Pakistan. This PDF document (Midterm Solved Past Paper & Revision File) covers Mid-Term Exam Scope (Lectures 1 to 22) spanning approximately 240 pages across 4 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS401 – Computer Architecture & Assembly Language
Faculty
Computer Science
Format
PDF
Type
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)
Tags
MIDTERM

Focus on core definitions and repeated MCQs from Lectures 1–22. Remember that scoring in the First Half builds your safety buffer toward the mandatory 20% Two-Half passing rule in CS401.

What this file covers — CS401 syllabus roadmap

  1. Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
  2. Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
  3. Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
  4. Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)

Frequently asked questions

Where can I download CS401 Short Notes for Midterm.pdf for free?

You can preview and download "CS401 Short Notes for Midterm.pdf" (CS401 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs401-short-notes-for-midterm-pdf) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS401 file?

This document covers Mid-Term Exam Scope (Lectures 1 to 22) across 4 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS401 under the VU 20% Two-Half Rule?

Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.

Are CS401 solved past papers and handouts verified for 2026 exams?

Yes. All CS401 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.

Inside this file

1                       www.vuanswer.com
      ASSEMBLY LANGUAGE PROGRAMMING
                        m              (CS401)
                            SUBJECTIVE SOLVED FOR MID TERM

     Explain the process of ADC?
                Normal addition has two operands and the second operand is added to the first operand.
However ADC has three operands. The third implied operand is the carry flag. The ADC instruction is
specifically placed for extending the capability of ADD. Further more consider an instruction “ADC AX, BX.”
Normal addition would have just added BX to AX, however ADC first adds the carry flag to AX and then adds
BX to AX. Therefore the last carry is also included in the result. The lower halves of the two numbers to be
added are first added with a normal addition. For the upper halves a normal addition would lose track of a
possible carry from the lower halves and the answer would be wrong. If a carry was generated it should go to
the upper half. Therefore the upper halves are added with an addition with carry instruction.

     What is the difference between LES and LDS instructions ?
                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.

     Describe local variables.
                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 swapflag 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, however
the decrement must be by an even number, as the unit of stack operation is a word. In our case we needed just
one word. Also the most convenient position for this gap is immediately after saving the value of SP in BP. So
that the same base pointer can be used to access the local variables as well; this time using negative offsets. The
standard way to start a subroutine which needs to access parameters and has local variables is as under.
push bp
mov bp, sp
sub sp, 2
                The gap could have been created with a dummy push, but the subtraction makes it clear that the
value pushed is not important and the gap will be used for our local variable. Also gap of any size can be
created in a single instruction with subtraction. The parameters can still be accessed at bp+4 and bp+6 and the

2                                                           www.vuanswer.com
swapflag can be accessed at bp-2. The subtraction in SP was after taking the snapshot; therefore BP is above
                                                            m
the parameters but below the local variables. The parameters are therefore accessed using
positive offsets from BP and the local variables are accessed using negative offsets.

    Explain LES and LDS
                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.
    Explain the use of TEST instruction.
                 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.

     The Formula to scroll up the screen
rep movsw                                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

   What is difference between SHR and SAR instructions?
SHR

More CS401 files

All CS401 files · Midterm Prep 2026 · MCQs Bank