CS 401
MIDTERM PREPARATION (2025)
LECTURE WISE MCQS
Past paper by sir sharjeel
TOPIC NO 01:
1.1 Basic Computer Architecture
Q1. Which of the following is NOT a component of CPU?
(a) ALU
(b) Control Unit
(c) Registers
(d) Hard Disk
👉 Answer: (d) Hard Disk
Q2. Which bus is used to carry memory addresses?
(a) Data Bus
(b) Address Bus
(c) Control Bus
(d) System Bus
👉 Answer: (b) Address Bus
1.2 Registers
Q3. Which register holds the address of the next instruction?
(a) AX
(b) IP
(c) DS
(d) FLAGS
👉 Answer: (b) IP
Q4. The FLAGS register stores:
(a) Instructions
(b) Data
(c) Status bits like Carry, Zero, Sign
(d) Memory addresses
👉 Answer: (c) Status bits like Carry, Zero, Sign
1.3 Instruction Groups
Q5. Which instruction belongs to the data transfer group?
(a) ADD
(b) AND
(c) MOV
(d) JMP
👉 Answer: (c) MOV
Q6. Which one is a control flow instruction?
(a) OR
(b) POP
(c) CMP
(d) JMP
👉 Answer: (d) JMP
1.4 Intel iAPX88 Architecture
Q7. The Intel 8088 microprocessor has:
(a) 16-bit internal, 16-bit external bus
(b) 16-bit internal, 8-bit external bus
(c) 8-bit internal, 8-bit external bus
(d) 32-bit internal, 16-bit external bus
👉 Answer: (b) 16-bit internal, 8-bit external bus
Q8. Which unit in 8088 handles memory and I/O?
(a) ALU
(b) Execution Unit (EU)
(c) Bus Interface Unit (BIU)
(d) Control Unit
👉 Answer: (c) Bus Interface Unit (BIU)
1.5 History
Q9. Assembly language was first introduced in:
(a) 1940s
(b) 1950s
(c) 1960s
(d) 1980s
👉 Answer: (b) 1950s
Q10. In which era did high-level languages (C, Pascal) dominate programming?
(a) 1940s–1950s
(b) 1950s–1960s
(c) 1980s–1990s
(d) 2000s
👉 Answer: (c) 1980s–1990s
1.6 Register Architecture
Q11. Which register is used as a loop counter?
(a) AX
(b) BX
(c) CX
(d) DX
👉 Answer: (c) CX
Q12. AX register can be divided into:
(a) AH and AL
(b) BH and BL
(c) CH and CL
(d) DH and DL
👉 Answer: (a) AH and AL
1.7 Our First Program
Q13. Which DOS interrupt is used to print a string?
(a) 20h
(b) 21h
(c) 09h
(d) 10h
👉 Answer: (b) 21h
Q14. Which instruction is used to terminate a program in assembly (DOS)?
(a) INT 10h
(b) INT 20h
(c) INT 21h (AH = 4Ch)
(d) HLT
👉 Answer: (c) INT 21h (AH = 4Ch)
1.8 Segmented Memory Model
Q15. In 8086/8088, one segment size is:
(a) 16 bytes
(b) 64 KB
(c) 1 MB
(d) Unlimited
👉 Answer: (b) 64 KB
Q16. The formula for physical address is:
(a) Segment + Offset
(b) Segment × 10h + Offset
(c) Segment ÷ Offset
(d) Segment – Offset
👉 Answer: (b) Segment × 10h + Offset
TOPIC NO 02:
Basic Concept
1. An addressing mode in assembly language specifies:
(a) How an instruction is decoded
(b) How the effective address of the operand is calculated ✅
(c) How many operands are required
(d) The size of the instruction
Data Declaration
2. Which directive is used to define a 16-bit word in assembly language?
(a) DB
(b) DW ✅
(c) DD
(d) DS
3. Which of the following defines an array of 4 bytes?
(a) arr DB 1,2,3,4 ✅
(b) arr DW 1,2,3,4
(c) arr DD 1,2,3,4
(d) arr DS 4
Direct Addressing
4. In direct addressing mode, the operand’s address is:
(a) Stored in a register
(b) Specified directly in the instruction ✅
(c) Obtained from stack
(d) Computed as register + displacement
Size Mismatch Errors
5. Which of the following is invalid due to size mismatch?
(a) MOV AX, [1234h]
(b) MOV AL, [BX]
(c) MOV AX, BL ✅
(d) MOV SI, [2000h]
Register Indirect
6. Which registers can be used in register indirect addressing mode?
(a) AX, CX, DX, BX
(b) SI, DI, BX, BP ✅
(c) CS, DS, SS, ES
(d) None of these
Register + Offset
7. The instruction MOV AL, [BX+05h] belongs to:
(a) Immediate addressing
(b) Register indirect
(c) Register + displacement ✅
(d) Indexed
Segment Association
8. By default, data is fetched from which segment?
(a) CS
(b) SS
(c) DS ✅
(d) ES
9. Which instruction uses segment override?
(a) MOV AL, [BX]
(b) MOV AL, ES:[BX] ✅
(c) MOV AX, BX
(d) MOV AL, 05h
Address Wraparound
10. If the calculated address goes beyond FFFFFh in 8086, it will:
(a) Halt the program
(b) Cause an error
(c) Wrap around to 00000h ✅
(d) Access ROM only
Summary & Mixed
11. Which of the following is an immediate addressing example?
(a) MOV AX, 1234h ✅
(b) MOV AX, [1234h]
(c) MOV AX, [BX]
(d) MOV AX, BX
12. Which addressing mode allows access using base + index + displacement?
(a) Register indirect
(b) Indexed
(c) Based-indexed ✅
(d) Direct
TOPIC NO 03:
Branching Basics
1. In Assembly, branching means:
(a) Executing instructions line by line
(b) Changing the normal flow of execution ✅
(c) Storing data in registers
(d) Accessing memory locations
2. Which instruction is used for unconditional branching?
(a) CMP
(b) LOOP
(c) JMP ✅
(d) TEST
3. Conditional branching is based on:
(a) Registers only
(b) Memory addresses
(c) Flags (Zero, Carry, Sign) ✅
(d) Segment overrides
Comparison & Conditions (CMP, TEST)
4. CMP AX, BX does:
(a) Subtracts BX from AX and stores result
(b) Adds AX and BX
(c) Compares AX and BX by subtracting (result not stored) ✅
(d) Multiplies AX and BX
5. After CMP AX, BX, if AX = BX, then:
(a) ZF = 1 ✅
(b) ZF = 0
(c) CF = 1
(d) OF = 1
Conditional Jumps
6. Which jump executes if operands are equal?
(a) JNE
(b) JNZ
(c) JE ✅
(d) JL
7. Instruction JL Label means:
(a) Jump if AX = BX
(b) Jump if less ✅
(c) Jump if not equal
(d) Jump if greater
8. Which instruction is used for looping?
(a) CMP
(b) LOOP ✅
(c) JMP
(d) MOV
Unconditional Jump
9. The JMP instruction:
(a) Jumps only when ZF = 1
(b) Always jumps ✅
(c) Never jumps
(d) Depends on CX
Relative Addressing
10. Relative addressing in jumps means:
(a) Jump to a fixed absolute address
(b) Jump based on offset relative to current IP ✅
(c) Jump within another segment
(d) Jump only if condition true
Types of Jump
11. The range of a short jump is:
(a) -128 to +127 bytes ✅
(b) -255 to +255 bytes
(c) -64 to +63 bytes
(d) -512 to +511 bytes
12. A far jump changes:
(a) Only IP
(b) Only CS
(c) CS and IP ✅
(d) DS and SS
Sorting Example
13. In bubble sort, which instruction is mainly used for comparing two values?
(a) MOV
(b) CMP ✅
(c) LOOP
(d) TEST
14. In sorting, conditional jump (e.g., JBE) is used to:
(a) Always swap values
(b) Compare and swap only if needed ✅
(c) Skip loop iterations always
(d) Increment counter only
TOPIC NO 04:
4.1 Multiplication Algorithm
1. Multiplication by a power of 2 in binary can be done using:
(a) Addition
(b) Subtraction
(c) Left shift
(d) Right shift
Answer: (c) Left shift
2. Which algorithm is faster for multiplication?
(a) Repeated addition
(b) Shift-and-add method
(c) Repeated subtraction
(d) Division method
Answer: (b) Shift-and-add method
4.2 Shifting and Rotations
3. SHL instruction in assembly is equivalent to:
(a) Division by 2
(b) Multiplication by 2
(c) Subtraction
(d) Rotate left
Answer: (b) Multiplication by 2
4. In SAR (Shift Arithmetic Right), the vacant positions are filled with:
(a) 0s
(b) 1s
(c) Sign bit
(d) Carry flag
Answer: (c) Sign bit
5. Which of the following preserves all bits (no loss)?
(a) SHL
(b) SHR
(c) SAR
(d) ROL / ROR
Answer: (d) ROL / ROR
4.3 Multiplication in Assembly
6. Which instruction is used for unsigned multiplication?
(a) IMUL
(b) MUL
(c) DIV
(d) IDIV
Answer: (b) MUL
7. In MUL BL, the result is stored in:
(a) AX
(b) AL
(c) BL
(d) DX
Answer: (a) AX
4.4 Extended Operations
8. After 8-bit division using DIV, the quotient is stored in:
(a) AH
(b) AL
(c) AX
(d) DX
Answer: (b) AL
9. The instruction used to extend sign for signed division is:
(a) SAR
(b) CBW / CWD
(c) IMUL
(d) IDIV
Answer: (b) CBW / CWD
4.5 Bitwise Logical Operations
10. Which operation is used to clear specific bits?
(a) OR
(b) AND
(c) XOR
(d) NOT
Answer: (b) AND
11. Which bitwise operation is used to toggle bits?
(a) OR
(b) AND
(c) XOR
(d) NOT
Answer: (c) XOR
12. Which instruction inverts all bits of a register?
(a) XOR
(b) NOT
(c) AND
(d) OR
Answer: (b) NOT
4.6 Masking Operations
13. Which operation would you use to set a particular bit to 1?
(a) AND Masking
(b) OR Masking
(c) XOR Masking
(d) NOT Masking
Answer: (b) OR Masking
14. To clear the lower 4 bits of AL, which mask is correct?
(a) AND 0Fh
(b) AND F0h
(c) OR 0Fh
(d) XOR FFh
Answer: (b) AND F0h
15. Which masking is used for bit toggling?
(a) AND Masking
(b) OR Masking
(c) XOR Masking
(d) NOT Masking
Answer: (c) XOR Masking
TOPIC NO 05:
1. Subroutines
Q1. A subroutine is also called:
(A) Function
(B) Procedure
(C) Routine
(D) All of these
✅ Answer: D
Q2. Which instruction is used to call a subroutine?
(A) RET
(B) CALL
(C) PUSH
(D) JMP
✅ Answer: B
Q3. The main benefit of subroutines is:
(A) Avoids code repetition
(B) Makes program modular
(C) Easier debugging
(D) All of these
✅ Answer: D
2. Program Flow
Q4. Normal program flow is:
(A) Sequential
(B) Random
(C) Reverse
(D) None of these
✅ Answer: A
Q5. Which instruction is used to return control from subroutine?
(A) CALL
(B) RET
(C) JMP
(D) LOOP
✅ Answer: B
Q6. In the example:
MOV AX, 5
CALL SQUARE
After execution, AX will contain:
(A) 5
(B) 10
(C) 25
(D) 0
✅ Answer: C
3. Our First Subroutine
Q7. The subroutine DOUBLE doubles the value in AX. If AX = 6 before CALL DOUBLE, then after
return AX = ?
(A) 6
(B) 12
(C) 36
(D) 0
✅ Answer: B
4. Stack
Q8. The stack works on principle of:
(A) FIFO
(B) LIFO
(C) FILO
(D) None
✅ Answer: B
Q9. Which pair of instructions are used to store/retrieve from stack?
(A) MOV / ADD
(B) PUSH / POP
(C) CALL / RET
(D) INC / DEC
✅ Answer: B
5. Saving and Restoring Registers
Q10. Why do we save registers in a subroutine?
(A) To speed up program
(B) To protect register values from being lost
(C) To clear memory
(D) To load constants
✅ Answer: B
Q11. If registers are not restored before RET:
(A) No effect
(B) Main program may lose important values
(C) Stack will be empty
(D) Program runs faster
✅ Answer: B
6. Parameter Passing Through Stack
Q12. Parameters are passed to subroutines through:
(A) Registers only
(B) Memory only
(C) Stack
(D) Code Segment
✅ Answer: C
Q13. In the given example, pushing 5 and calling SQUARE returns:
(A) 5
(B) 10
(C) 25
(D) Error
✅ Answer: C
7. Local Variables
Q14. Local variables in assembly are stored in:
(A) Code segment
(B) Registers
(C) Stack
(D) Data segment
✅ Answer: C
Q15. What happens to local variables after subroutine returns?
(A) They remain permanently stored
(B) They are destroyed (released from stack)
(C) They become global
(D) They move to registers
✅ Answer: B
TOPIC NO 06:
1. Display Memory
Q1. In text mode, video memory segment starts at:
(A) A000h
(B) B000h
(C) B800h
(D) C000h
✅ Answer: C
Q2. Each character in display memory uses:
(A) 1 byte
(B) 2 bytes
(C) 4 bytes
(D) 8 bytes
✅ Answer: B
2. ASCII Codes
Q3. ASCII code of character 'A' is:
(A) 41h
(B) 61h
(C) 30h
(D) 50h
✅ Answer: A
Q4. ASCII code of digit '0' is:
(A) 0
(B) 48 (30h)
(C) 50 (32h)
(D) 65 (41h)
✅ Answer: B
3. Display Memory Formation
Q5. To display a character, the first byte stores:
(A) Background color
(B) ASCII code
(C) Attribute (color)
(D) Address
✅ Answer: B
Q6. The second byte of a character cell in display memory represents:
(A) ASCII code
(B) Address
(C) Attribute (color/brightness)
(D) Row number
✅ Answer: C
4. Hello World in Assembly
Q7. To display a string like “Hello”, we must:
(A) Use interrupts only
(B) Write ASCII codes + attributes into video memory
(C) Use global registers only
(D) Use stack only
✅ Answer: B
5. Number Printing in Assembly
Q8. To print number 5 on screen, we must convert it to ASCII by:
(A) Adding 20h
(B) Adding 30h
(C) Subtracting 30h
(D) No conversion needed
✅ Answer: B
Q9. If AL = 07h, what will it print?
(A) '7'
(B) ASCII Bell sound
(C) White on black color
(D) Nothing
✅ Answer: B
6. Screen Location Calculation
Q10. In 80x25 text mode, the formula to find a memory offset for row R and column C is:
(A) (R × 25 + C) × 2
(B) (R × 80 + C) × 2
(C) (R × 2 + C) × 80
(D) (R + C) × 80
✅ Answer: B
Q11. If we want to display a character at row 5, column 10, the offset will be:
(A) (5 × 80 + 10) × 2 = 820
(B) (10 × 80 + 5) × 2 = 1650
(C) (25 × 5 + 10) × 2 = 260
(D) None
✅ Answer: A
TOPIC NO 07:
Q1. Which register pair is commonly used as source and destination pointers in string
instructions?
(a) AX, BX
(b) DS:SI, ES:DI
(c) CX, DX
(d) SP, BP
✅ Answer: (b) DS:SI, ES:DI
Q2. The instruction STOSW stores data from:
(a) BX into ES:DI
(b) AX into ES:DI
(c) AL into DS:SI
(d) CX into ES:DI
✅ Answer: (b) AX into ES:DI
Q3. Which prefix is used to repeat a string instruction until CX becomes zero?
(a) LOOP
(b) REP
(c) JMP
(d) CALL
✅ Answer: (b) REP
Q4. The LODSB instruction loads a byte from:
(a) DS:SI → AL
(b) ES:DI → AL
(c) DS:SI → AX
(d) ES:DI → AX
✅ Answer: (a) DS:SI → AL
Q5. To clear the screen using STOSW, which segment is used for video memory in color text
mode?
(a) A000h
(b) B000h
(c) B800h
(d) C000h
✅ Answer: (c) B800h
Q6. The instruction SCASB is used to:
(a) Scan and replace characters
(b) Compare AL with ES:DI memory byte
(c) Copy a string from DS:SI to ES:DI
(d) Store AL at ES:DI
✅ Answer: (b) Compare AL with ES:DI memory byte
Q7. Which instruction is best for comparing two strings?
(a) MOVSB
(b) STOSB
(c) CMPSB
(d) SCASB
✅ Answer: (c) CMPSB
Q8. The LES instruction loads:
(a) ES and AX
(b) ES and BX (or any register)
(c) DS and SI
(d) ES only
✅ Answer: (b) ES and BX (or any other specified register)
Q9. If DF (Direction Flag) is cleared (CLD), string instructions process memory in which
direction?
(a) Backward (decrement SI/DI)
(b) Forward (increment SI/DI)
(c) Randomly
(d) No effect
✅ Answer: (b) Forward (increment SI/DI)
Q10. Which instruction can be used to implement screen scrolling (shifting lines upward)?
(a) LODSB
(b) MOVSW
(c) SCASB
(d) STOSB
✅ Answer: (b) MOVSW
TOPIC NO 08:
📘 MCQs – Interrupts
Q1. What does an interrupt do in a microprocessor system?
(a) Repeats the last instruction
(b) Stops CPU permanently
(c) Temporarily diverts execution to ISR
(d) Clears registers
✅ Answer: (c) Temporarily diverts execution to ISR
Q2. Which instruction is used to generate a software interrupt in assembly language?
(a) CALL
(b) INT
(c) IRET
(d) JMP
✅ Answer: (b) INT
Q3. What does the CPU push on the stack when an interrupt occurs?
(a) AX, BX, CX
(b) CS, IP, FLAGS
(c) DS, ES, BP
(d) Only IP
✅ Answer: (b) CS, IP, FLAGS
📘 MCQs – Software Interrupts
Q4. Which of the following is a software interrupt instruction?
(a) INT 21h
(b) MOV AX, BX
(c) PUSH AX
(d) RET
✅ Answer: (a) INT 21h
Q5. Software interrupts are mainly used for:
(a) Hardware testing
(b) System services like I/O and memory
(c) Only arithmetic calculations
(d) Debugging only
✅ Answer: (b) System services like I/O and memory
📘 MCQs – Hooking an Interrupt
Q6. The Interrupt Vector Table (IVT) starts at:
(a) 1000h:0000h
(b) 0000h:0000h
(c) F000h:FFF0h
(d) B800h:0000h
✅ Answer: (b) 0000h:0000h
Q7. Changing the entry of an interrupt in the IVT to point to a new routine is called:
(a) Masking
(b) Hooking
(c) Branching
(d) Nesting
✅ Answer: (b) Hooking
📘 MCQs – BIOS Interrupts
Q8. Which BIOS interrupt is used for video (display) services?
(a) INT 10h
(b) INT 13h
(c) INT 16h
(d) INT 21h
✅ Answer: (a) INT 10h
Q9. BIOS keyboard services are provided by:
(a) INT 09h
(b) INT 16h
(c) INT 20h
(d) INT 1Ah
✅ Answer: (b) INT 16h
📘 MCQs – DOS Interrupts
Q10. The main DOS interrupt for file and device services is:
(a) INT 10h
(b) INT 13h
(c) INT 16h
(d) INT 21h
✅ Answer: (d) INT 21h
Q11. To display a character on screen using DOS, we use function:
(a) AH = 01h
(b) AH = 02h
(c) AH = 09h
(d) AH = 0Eh
✅ Answer: (b) AH = 02h
Q12. Which instruction is used at the end of an interrupt service routine?
(a) RET
(b) JMP
(c) IRET
(d) CALL
✅ Answer: (c) IRET
TOPIC NO 09:
Q1. Real Time Interrupts are mainly generated by:
(a) Keyboard controller
(b) Programmable Interval Timer (PIT)
(c) Mouse driver
(d) Parallel port
✅ Answer: (b) Programmable Interval Timer (PIT)
Q2. The system timer in a PC generates interrupts how many times per second?
(a) 10
(b) 18.2
(c) 50
(d) 1000
✅ Answer: (b) 18.2
Q3. Hardware interrupts are generated by:
(a) CPU instructions only
(b) External devices via IRQ lines
(c) DOS function calls
(d) TSR programs
✅ Answer: (b) External devices via IRQ lines
Q4. When a key is pressed, the keyboard generates which interrupt?
(a) INT 08h
(b) INT 09h
(c) INT 10h
(d) INT 16h
✅ Answer: (b) INT 09h
Q5. Which assembly instruction is used to read from an I/O port?
(a) OUT
(b) MOV
(c) IN
(d) PUSH
✅ Answer: (c) IN
Q6. Which type of DOS program remains in memory even after execution ends?
(a) EXE program
(b) COM program
(c) TSR program
(d) Overlay program
✅ Answer: (c) TSR program
Q7. Which interrupt is commonly hooked by TSR programs to track timer events?
(a) INT 09h
(b) INT 1Ch
(c) INT 21h
(d) INT 10h
✅ Answer: (b) INT 1Ch
Q8. The 8253/8254 Programmable Interval Timer has how many counters?
(a) 1
(b) 2
(c) 3
(d) 4
✅ Answer: (c) 3
Q9. Which channel of PIT (8253) is used for system clock in PCs?
(a) Channel 0
(b) Channel 1
(c) Channel 2
(d) Channel 3
✅ Answer: (a) Channel 0
Q10. The base I/O address for the LPT1 parallel port is:
(a) 3F8h
(b) 2F8h
(c) 378h
(d) 60h
✅ Answer: (c) 378h
Q11. The parallel port transfers data:
(a) Serially, 1 bit at a time
(b) Parallel, 8 bits at once
(c) Only 4 bits at a time
(d) Using DMA
✅ Answer: (b) Parallel, 8 bits at once
Q12. The instruction used to send data to an output port is:
(a) IN
(b) OUT
(c) PUSH
(d) JMP
✅ Answer: (b) OUT
BEST OF LUCK
SUBSCRIBE LIKE COMMENT SHARE
Contact number (03441163937)