Ch 05: Subroutines and Stack Architecture

222 Questions222 MCQs0 Short Questions0 Long Questions
๐ŸŽฏ Exam Practice Papers
SEMESTER PASS

CS401 - Computer Architecture and Assembly Language Programming Examination Practice

Timed practice exam simulation for CS401 - Computer Architecture and Assembly Language Programming.

๐Ÿ“˜ VU MID TERM EXAMLectures 1 to 22
โฑ๏ธ 60 Mins

Mid Term Examination

Covers syllabus of Lectures 1 to 22 with 30 high-yield MCQs in a timed exam environment.

๐Ÿ“30 MCQs
โฑ๏ธ60 Minutes
๐Ÿ“— VU FINAL TERM EXAMLectures 23 to 45
โฑ๏ธ 90 Mins

Final Term Examination

Comprehensive semester exam preparation with 45 MCQs covering Lectures 23 to 45 with complete course coverage.

๐Ÿ“45 MCQs
โฑ๏ธ90 Minutes
Showing 211 โ€“ 220 of 222 Questions
Page 22 of 23
Q211
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutine MechanismEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When encountered inside a subroutine, which instruction pops the saved return address off the stack and returns control to the instruction following the CALL?
๐Ÿ’ป assembly Snippet
ret
  1. A.CALL
  2. B.RET
  3. C.AND
  4. D.XOR
Q212
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutine MechanismEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Which two instructions are commonly used as a pair to invoke and return from subroutines, despite being technically independent in hardware operation?
  1. A.RET and ADC
  2. B.CALL and SBB
  3. C.CALL and RET
  4. D.ADC and SBB
Q213
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutine MechanismEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The subroutine CALL mechanism diverts the thread of execution and preserves general-purpose registers, automatically modifying the Stack Pointer (SP) and which control register?
  1. A.SI
  2. B.IP (Instruction Pointer)
  3. C.DI
  4. D.BP
Q214
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutine MechanismEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
If the ________ instruction is not available, clearing parameters from the stack by the callee subroutine becomes a complicated process.
๐Ÿ’ป assembly Snippet
ret 4  ; Pops return address and adds 4 to SP to clear parameters
  1. A.CALL
  2. B.SBB
  3. C.RET n
  4. D.None of the given options
Q215
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutine MechanismEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
To preserve register values across subroutine calls, the standard programming technique is to use a pair of ________ operations to save the caller's values on the stack and restore them before returning.
๐Ÿ’ป assembly Snippet
push ax
; ... subroutine body ...
pop ax
  1. A.POP and ADC
  2. B.CALL and RET
  3. C.CALL and RET n
  4. D.PUSH and POP
Q216
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Stack Frame ArchitectureEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
To access caller-passed parameters from the stack inside a subroutine, the naive initial approach that comes to mind is to ________ them off the stack.
  1. A.PUSH
  2. B.POP
  3. C.CALL
  4. D.Register
Q217
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Stack Frame ArchitectureEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When executing the instruction 'PUSH BP', what specific action is performed?
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
  1. A.Sending BP copy to stack
  2. B.Making BP copy from stack
  3. C.Pushing the current contents of base pointer register BP onto the stack
  4. D.Doing nothing
Q218
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Stack Frame ArchitectureEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Local variables are defined as variables whose accessibility and lifespan are strictly restricted to a specific:
๐Ÿ’ป assembly Snippet
sub sp, 4  ; Allocate local variables on stack frame
  1. A.Subroutine
  2. B.Program
  3. C.CALL
  4. D.Label
Q219
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutine MechanismEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The CALL mechanism diverts execution control and preserves general-purpose registers, automatically modifying the Stack Pointer (SP) and which control register?
  1. A.SI
  2. B.IP (Instruction Pointer)
  3. C.DI
  4. D.SP
Q220
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. String InstructionsEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What is the Destination Index (DI) register in 8086/8088 assembly language, and how is it used in string operations alongside the Extra Segment (ES) register?
๐Ÿ’ป assembly Snippet
; Example string byte store using ES:DI
mov ax, 0x2000
mov es, ax      ; Load Extra Segment address into ES
mov di, 0x0100  ; Destination memory offset in DI
mov al, 'A'     ; ASCII character 'A'
stosb           ; Store byte AL into [ES:DI] and automatically increment DI