CS-401 MIDTERM SHORT NOTES BY ALMAS AFZAL.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 CS-401 MIDTERM SHORT NOTES BY ALMAS AFZAL.pdf for free?

You can preview and download "CS-401 MIDTERM SHORT NOTES BY ALMAS AFZAL.pdf" (CS401 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs-401-midterm-short-notes-by-almas-afzal-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

                            CS401 – Preface

1. What is Assembly Language?

 A programming language that talks directly to the computer.
 In high-level languages (like C, C++, Java), there is a “gap” between the
  programmer and the machine.
 This gap is filled by compilers or interpreters, but in assembly, you bypass most
  of them.
 It works close to hardware, giving you more control.

2. Is it difficult?

 People think it’s hard, but it’s actually simple.
 It looks hard because we are used to thinking computers are complicated.
 Assembly is just direct and clear — what you write is exactly what the computer
  does.

3. Course focus

 Examples will use IBM PC with Intel processors.
 Concepts will be platform-independent (can work on any system).

Basic knowledge needed:

1. Digital logic (AND, OR, NOT)
2. Binary numbers and arithmetic

4. Why learn Assembly?

Optimization: Makes code faster by removing unnecessary instructions.

Real-time systems: Needed when operations must finish in a fixed time.
Fine control: You control each instruction — no hidden steps like in “for” loops in
high-level languages.

5. When to use it?

 In performance-critical parts of a program (e.g., image processing).
 To make programs run faster by saving CPU cycles.
 To meet exact timing requirements in hardware control systems.

6. How to learn it?

 You can’t just read; you must practice.
 Try every example, run code, test, and experiment.
 Only by doing this will you see how powerful and simple it is.

                          Chapter 1
             Introduction to Assembly Language
1.1. BASIC COMPUTER ARCHITECTURE

1. Computer main parts:

1. Processor (CPU) – Does the operations.
2. Memory (RAM) – Stores data.
3. I/O devices – Connects computer to outside world (keyboard, display, etc.).

For now, we focus only on Processor + Memory.

2. Communication between CPU & Memory

To work, CPU must:

 Know which data to read/write.
 Tell memory whether to read or write.
 Actually transfer the data.

This is done via 3 types of buses:

       Bus                      Purpose                            Direction
   Address Bus Sends memory address (location) to access. Unidirectional (CPU → Memory)
    Data Bus   Transfers actual data between CPU & Memory.       Bidirectional

      Bus                        Purpose                            Direction
   Control Bus Sends control signals (read/write, status info).   Bidirectional

3. How each bus works

Address Bus

 Tells memory exactly which cell to use (like giving an address to a postman).
 Always one-way from CPU to Memory.
 Example: “Fifth book from top” = specific memory location.
 Memory cell size is called cell width (often 8-bit = 1 byte).

Data Bus

 Transfers actual data.
 Can go both directions:
                                  1. CPU → Memory (write)
                                  2. Memory → CPU (read)

Control Bus

Sends read/write commands and special status signals.
Also lets peripherals send “status” back to CPU (e.g., “door locked” message).
Ensures synchronization — CPU reads when memory is ready, writes when memory
can accept.

4. Why synchronization is important

 If CPU wants to read but memory is trying to write → No communication happens.
 Control bus ensures CPU and memory act in correct order (one speaks, one listens).

1.2 Registers

What are Registers?

 Tiny, super-fast storage areas inside the CPU.
 Used to hold data (operands) temporarily while processing.
 Faster than main memory.
 Very few in number → precious resource.

Why do we need Registers?

 CPU can get only one data item at a time from memory via the data bus.

 But most operations (like addition) need two operands.

Solution:

 Store one operand in a register.
 Bring the second operand from memory.
 Perform operation quickly.
 Sometimes both operands are in registers for maximum speed.

Registers vs Memory

                         Registers                Memory
                         Very fast                  Slower
                      Few in number               Large size
                        Inside CPU               Outside CPU
                        Expensive                  Cheaper

Types of Registers

1. Accumulator

 Main register for math & logic operations.
 Width of accumulator = CPU word size
 (e.g., 32-bit CPU → 32-bit accumulator).

2. Pointer / Index / Base Register

 Holds address of data (not the data itself).
 Useful in loops & arrays (e.g., accessing each element in order).
 Changes automatically in repetitive tasks.

3. Flags Register (Program Status Word)

 Stores status bits after operations.
 Each bit has its own meaning (not combined).
 Example: Carry Flag stores extra bit after addition overflow.

4. Program Counter / Instruction Pointer

 Holds address of next instruction to execute.
 Moves step-by-step through the program.
 CPU understands numbers (opcodes), not words like "ADD".

 Mnemonics (e.g., ADD A, B) are symbolic forms → converted by Assembler into
  opcodes.

1.3 Instruction Groups

What are Instruction Groups?

Every processor has a set of opcodes for:

   Moving data
   Doing math & logic
   Controlling program flow
   Special tasks

Mnemonics (human-readable names for opcodes) vary by manufacturer:
One CPU may use MOV, another may use LOAD or STORE.
Basic idea is same → only names differ.
Grouping instructions makes it easy to learn a new processor.

Main Instruction Groups

1. Data Movement Instructions

Purpose: Move data from one place to another.

Sources/Destinations can be:

1. Registers
2. Memory
3. Peripheral devices

Examples:

mov ax, bx → Copy data from bx to ax.
lad 1234 → Load data from address 1234 into a register.

Key point: Only moves data, doesn’t change it.

2. Arithmetic and Logic Instructions

Arithmetic → Add, subtract, multiply, divide.
Logic → AND, OR, XOR, NOT (complement).

Examples:

More CS401 files

All CS401 files · Midterm Prep 2026 · MCQs Bank