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 51 โ€“ 60 of 222 Questions
Page 6 of 23
Q51
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Local Variable Stack Allocation)Medium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In assembly language subroutine stack frame management, how are local variables allocated on the stack?
๐Ÿ’ป assembly Snippet
push bp
mov  bp, sp
sub  sp, 4 ; Allocates space for 4 bytes of local variables on stack
; ...
mov  sp, bp ; Deallocates local variables
pop  bp
ret
  1. A.By subtracting the required byte size from SP
  2. B.By adding the required byte size to SP
  3. C.By pushing segment registers onto the stack
  4. D.By calling INT 0x21
Q52
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Local Variable Scope in Subroutine)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Local variables are variables that are defined and used exclusively within a __________.
  1. A.Subroutine
  2. B.Program
  3. C.CALL
  4. D.Label
Q53
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (RET Instruction Arguments)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
To transfer control back from a subroutine to the caller, the standard near `RET` instruction takes how many explicit parameters/arguments?
๐Ÿ’ป assembly Snippet
ret ; Pops saved return address from stack (0 operands)
  1. A.1 argument
  2. B.2 arguments
  3. C.3 arguments
  4. D.No arguments
Q54
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (Parameter Passing via Registers)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In 16-bit x86 architecture, what is the maximum number of parameters a subroutine can receive directly through general-purpose registers (AX, BX, CX, DX, SI, DI, BP)?
  1. A.6
  2. B.7
  3. C.8
  4. D.9
Q55
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (RET Instruction Argument Count)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How many explicit parameters/arguments does the standard `RET` (Return from subroutine) instruction take?
๐Ÿ’ป assembly Snippet
ret ; Pops saved IP from stack (0 parameters)
Q56
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (PUSH Instruction Operation)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Describe the function and operational steps performed by the `PUSH` instruction on the stack.
๐Ÿ’ป assembly Snippet
push ax ; Decrements SP by 2, copies AX to [SS:SP]
Q57
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (SS:SP Stack Segment Combination)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The physical memory address of data located on the execution stack is calculated using which segment-offset register combination?
  1. A.SS:SP combination
  2. B.SS:SI combination
  3. C.ES:BP combination
  4. D.ES:SP combination
Q58
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (RET SP Pointer Increment)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Upon execution of the standard near return instruction `RET`, how is the Stack Pointer (`SP`) modified?
๐Ÿ’ป assembly Snippet
ret ; Pops 2-byte IP offset from [SS:SP], SP = SP + 2
  1. A.SP is incremented by 2
  2. B.SP is decremented by 2
  3. C.SP is incremented by 1
  4. D.SP is decremented by 1
Q59
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (RET n Stack Pointer Increment)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What structural changes occur to the Stack Pointer (`SP`) register upon executing the instruction `RET 2`?
๐Ÿ’ป assembly Snippet
ret 2 ; Pops 2-byte IP, then adds 2 bytes to SP -> Total SP = SP + 4
Q60
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 5๐Ÿท๏ธ 5.1. Subroutines and Stack (RETF Instruction Execution Mechanics)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When executing a far return instruction `RETF`, into which CPU register is the first 16-bit word popped from the stack loaded?
๐Ÿ’ป assembly Snippet
retf ; Pops IP first, then CS second
  1. A.BP
  2. B.IP
  3. C.SP
  4. D.SI