CS401 EXERCISE.pdf
Verified academic study resource for CS401 (Computer Architecture & Assembly Language) under the Computer Science at Virtual University of Pakistan. This PDF document (Verified Study Resource) covers Full Course Curriculum spanning approximately 280 pages across 8 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
- Type
- Study Resource
- Coverage
- Full Course Curriculum
Review this document alongside the official handouts and test your retention in the Interactive MCQs Studio.
What this file covers — CS401 syllabus roadmap
- Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
- Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
- Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
- Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)
- Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
- Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
- Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
- Final-Term Examination Dossier & Capstone Synthesis — Lectures 42 to 45 (Pages 511 to 585). Final-Term Exam Synthesis (Lectures 23–45 Scope)
Frequently asked questions
Where can I download CS401 EXERCISE.pdf for free?
You can preview and download "CS401 EXERCISE.pdf" (CS401 PDF, ~280 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs401-exercise-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 Full Course Curriculum across 8 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22, Lectures 23 to 29, Lectures 30 to 36, Lectures 37 to 41, Lectures 42 to 45), 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 EXERCISES
CODES
CHAPTER #2
9b. Copy AX into memory location with offset 0FFF in the current data segment.
SOLUTION :
; solution developed by https://github.com/PySaqib
[org 0x0100]
mov [0x0FFF], ax ; copies the data from offset AX into offset 0x0FFF
; do m2 DS:0FFF in DOSBOX input to verify.
; you can view the value of AX to crosscheck.
mov ax, 0x4c00 ; exit.
int 0x21
c. Move contents of memory location with offset 0010 to memory location with offset 002F in the
current data segment
SOLUTION
; solution developed by https://github.com/PySaqib
[org 0x0100]
; NOTE: You cannot perform memory to memory operations in assembly.
; We use a register to hold value temporarily.
mov ax, [0x0010] ; copying contents of 0010 into AX.
mov word [0x002F], ax ; copying contents at offset 002F from AX.
mov ax, 0x4c00 ; exit.
int 0x21
10. Write a program to calculate the square of 20 by using a loop that adds 20 to the accumulator 20
times.
SOLUTION
; solution developed by https://github.com/PySaqib
[org 0x0100]
mov ax, 0 ; setting AX to 0.
mov cx, 20 ; the number of times we want the loop to run.
l1: ; main loop
add ax, 20 ; adding our number.
loop l1 ; looping directive
; this does --cx and then jumps to l1
mov ax, 0x4c00 ; exit.
int 0x21
Chapter # 3
4. Write a program to find the maximum number and the minimum number from an array of ten
numbers
SOLUTION
;A program to find the maximum and minimum number from an array of ten numbers
[org 0x0100]
jmp start
data: db 10,2,3,4,7,8,6,5,9,1
swap: db 0
max: db 0
min: db 0
start: mov byte[swap],0
mov bx,0
loop1: mov al,[data+bx]
cmp al,[data+bx+1]
jbe noswap
swapp: mov dl,[data+bx+1]
mov [data+bx+1],al
mov [data+bx],dl
mov byte [swap], 1
noswap: add bl,1
cmp bx,9
jnz loop1
checkswap: cmp byte[swap],0
jnz start
store: mov al, [data]
mov [min],al
mov bl, [data+9]
mov [max],bl
mov ax,0x4c00
int 21h
5. Write a program to search a particular element from an array using binary search. If the element
is found set AX to one and otherwise to zero.
SOLUTION
;Binary Search
[org 0x0100]
jmp start1
data: db 1,2,3,4,5,6,7,8,9,10,11
start: db 0
end: db 10
key: db -1
start1: mov al,[key]
loop1: mov cl,[start]
cmp cl,[end]
ja end1 ;Checking if(start<=end), if not then jump to
end1
mov dl,[start]
add dl,[end] ;dl is basically now start + end
sar dl,1 ;here dl is being divided by 2
mov bl,dl ;bl is mid and is calculated by (start + end)/2
cmp al, [data + bx]
je store ; agar data mil gaya tw program end kar do
ja step1 ; agar data greater hai current element sey
jb step2 ; agar data smaller hai current element sey
step1: add dl,1 ;mid + 1 kar do
mov [start],dl ;start ko ab mid + 1 kar do taakey hum mid se aagey jaga par
dekhein
jmp loop1
step2: sub dl,1 ;mid -1 kar do
mov[end],dl ;end ko ab mid - 1 kar do taakey hum mid se
previous jaga par dekhein
jmp loop1
store: mov ax, 1
mov ax,0x4c00
int 21h
end1: mov ax,0
mov ax,0x4c00
int 21h
6. Write a program to calculate the factorial of a number where factorial is defined as: factorial(x) =
x*(x-1)*(x-2)*...*1 factorial(0) = 1
SOLUTION:
;Program to calculate factorial
[org 0x0100]
jmp start
num : dw 4
fact: dw 0
start: mov ax,[num] ; ax is x (ax is 4)
mov bx,0 ;used instead of result
loop1: cmp ax,1 ;(1 ya 1 se less har number par is label par move kar jayo)
jle fact0
mov dx,ax ; (mai ax sey aik kam dx mai rakhwa deta hun i.e x-1 )
sub dx,1 ; (is case mai dx is 3)
mov cx,dx ; cx is x - 1
multiply: shr cx,1
jnc noaddition
add bx,ax
noaddition: cmp cx,0
jz next
shl ax,1
jmp multiply
next: sub dx,1 ; (ab next 12 ne multiply hona hai 2 se , isi lye dx jo ke 3 tha usey subtract
kar key 2 kya)
mov ax,dx
cmp ax,1 ; (doobara match kar lya ke kahin ax 1 ya 1 se less tw nahi ho
gaya. Agar ho gaya tw bas ; multiplication end kar do)
jle fact0
mov ax,bx ;for example in case of fact 4 (4*3*2*1), pehley 4*3 huwa
aur us ka result 12 bx mai aya
; ab 12*2 hona hai isi lye bx ko ax mai rakhwa dya
takey ax=12 ho aur phir cx=2 ho aur woh ;phir multiply hon
mov bx,0 ;Next multiplication ke lye result ko doobara se initialize kar dya
0 pey
mov cx,dx ;cx is x - 1 (is case mai ab cx 2 ho ga)
jmp multiply ; (now 12*2 will be done)
fact0: cmp bx,0
jnz movebx
mov word [fact],1
jmp end
movebx: mov [fact],bx
end: mov ax,0x4c00
More CS401 files
- CS401 (2).txt (TXT · Study Resource)
- CS401 - 1.pdf (PDF · Study Resource)
- CS401 - 2.pdf (PDF · Study Resource)
- CS401 - 3.pdf (PDF · Study Resource)
- CS401 - 4.pdf (PDF · Study Resource)
- CS401 AZNAIN.docx (DOC · Study Resource)
- CS401 MID fall 2010 01-12-2010.doc (DOC · Study Resource)
- CS401 PRACTICAL QUESTON.pdf (PDF · Study Resource)