๐Ÿ“‘ CHAPTER PRACTICE

CS401 - Computer Architecture and Assembly Language Programming โ€“ Subroutines

Practice 10 verified multiple choice questions per batch with instant answer reveal and comprehensive solutions.

Showing 1 โ€“ 10 of 222 Questions
Page 1 of 23
Q1๐Ÿ“ Short Q๐Ÿ“‘ Lec 5EasyโญHigh-Yield๐Ÿ’กConceptual
How many parameters can a subroutine receive through the stack in x86 assembly language?
๐Ÿ’ป assembly Snippet
push param1
push param2
push param3
call my_subroutine
Q2๐Ÿ“ Short Q๐Ÿ“‘ Lec 5Medium๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
Given initial register values AX = 0x3412, BX = 0x7856, CX = 0x1CAB, and SP = 0x0100, trace the contents of AX, BX, CX, and SP after executing: PUSH AX; PUSH BX; XCHG AX, CX; POP CX.
๐Ÿ’ป assembly Snippet
mov ax, 0x3412
mov bx, 0x7856
mov cx, 0x1CAB
mov sp, 0x0100
push ax
push bx
xchg ax, cx
pop cx
Q3๐Ÿ“ Short Q๐Ÿ“‘ Lec 5Medium๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
Given initial values AX = 0x3412, BX = 0x7856, CX = 0x1CAB, and SP = 0x0100, trace the contents of AX, BX, CX, and SP after executing: PUSH AX; PUSH BX; POP AX; POP CX.
๐Ÿ’ป assembly Snippet
; Initial: AX=0x3412, BX=0x7856, CX=0x1CAB, SP=0x0100
push ax
push bx
pop ax
pop cx
Q4๐Ÿ“ Short Q๐Ÿ“‘ Lec 5Medium๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
How is the value of the IP register saved and updated when a CALL instruction is executed?
๐Ÿ’ป assembly Snippet
call my_subroutine
mov ax, 1
my_subroutine:
ret
Q5๐Ÿ“ Short Q๐Ÿ“‘ Lec 5Easy๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
Describe the operation of PUSH and POP instructions with the help of an assembly language example.
๐Ÿ’ป assembly Snippet
push ax
pop bx
Q6๐Ÿ“ Short Q๐Ÿ“‘ Lec 5Easy๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
Why are procedures used in assembly language, and what must be the last executable instruction in a procedure?
๐Ÿ’ป assembly Snippet
my_proc:
    ; procedure body
    ret
Q7๐Ÿ“ Short Q๐Ÿ“‘ Lec 5Medium๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
Provide valid x86 assembly instruction(s) to move the value located at the top of the stack into the IP (Instruction Pointer) register.
๐Ÿ’ป assembly Snippet
ret
Q8โ“ MCQ๐Ÿ“‘ Lec 5Easy๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
How many prevalent calling conventions exist in assembly language programming (specifically x86 CS401)?
๐Ÿ’ป assembly Snippet
push param2
push param1
call my_subroutine
add sp, 4
  1. A.1
  2. B.2
  3. C.3
  4. D.4
Q9โ“ MCQ๐Ÿ“‘ Lec 5Medium๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
In NASM assembly language, an imported symbol is declared using the ________ directive, while an exported symbol is declared using the ________ directive.
๐Ÿ’ป assembly Snippet
extern my_external_func
global my_public_func
  1. A.EXTERN directive, GLOBAL directive
  2. B.GLOBAL directive, EXTERN directive
  3. C.IMPORT directive, EXPORT directive
  4. D.PUBLIC directive, EXTERN directive
Q10โ“ MCQ๐Ÿ“‘ Lec 5Medium๐Ÿ”RepeatedโญHigh-Yield๐Ÿ’กConceptual
Read the following x86 assembly stack framing sequence and determine the final effect on the BP register value: push bp mov bp, sp sub sp, 2 mov sp, bp pop bp
๐Ÿ’ป assembly Snippet
push bp
mov bp, sp
sub sp, 2
mov sp, bp
pop bp
  1. A.bp will retain its original value
  2. B.Value of sp will move to bp
  3. C.Value of bp will be less than sp
  4. D.Value of bp will be zero