Ch 03: Branching, Loops and Program Flow

261 Questions261 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 241 โ€“ 250 of 261 Questions
Page 25 of 27
Q241
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Which conditional jump instruction is taken if the last arithmetic operation produced a zero in its destination, or after CMP if both operands were equal?
๐Ÿ’ป assembly Snippet
cmp ax, bx
je match_label  ; Jumps if AX == BX (ZF = 1)
  1. A.Jump if Zero (JZ) / Jump if Equal (JE)
  2. B.Jump if Equal (JE) only
  3. C.Jump if Zero (JZ) only
  4. D.No jump for this condition
Q242
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How does the CMP (Compare) instruction operate in 8086 assembly language, and how does it update processor status flags compared to the SUB instruction?
๐Ÿ’ป assembly Snippet
; CMP vs SUB Example
mov ax, 24
cmp ax, 12    ; Calculates 24 - 12 = 12; Sets ZF = 0, AX remains 24
sub ax, 12    ; Calculates 24 - 12 = 12; Sets ZF = 0, AX becomes 12
Q243
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Explain the operational logic of the JNE (Jump if Not Equal) / JNZ (Jump if Not Zero) conditional branch instruction and its reliance on the Zero Flag (ZF).
๐Ÿ’ป assembly Snippet
; Conditional Branching with JNE
mov ax, 24
cmp ax, 12          ; Operands unequal -> ZF = 0
jne target_address  ; Jump taken because ZF == 0
Q244
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What is the JNZ (Jump if Not Zero) instruction in 8086 assembly language, and how does its execution depend on the status of the Zero Flag (ZF)?
๐Ÿ’ป assembly Snippet
; JNZ Conditional Branching Example
mov ax, 5
sub ax, 2     ; Result = 3 (Non-zero -> ZF = 0)
jnz loop_body ; Jump taken because ZF == 0
Q245
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How are comparison operations and conditional branching used in assembly language to emulate high-level relational and boolean control logic?
๐Ÿ’ป assembly Snippet
; High-level Relational Logic in Assembly
cmp ax, bx       ; Compare AX and BX (sets ZF, CF, SF, OF flags)
jg ax_is_greater ; Branch if AX > BX (Signed Greater)
Q246
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How does the CMP (Compare) instruction function in 8086 assembly language, and why is it described as a non-destructive subtraction operation?
๐Ÿ’ป assembly Snippet
; CMP Instruction Example
cmp ax, bx    ; Calculates AX - BX, sets flags, preserves AX and BX
je values_equal ; Jump if ZF = 1 (AX == BX)
Q247
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Explain how the Carry Flag (CF), Zero Flag (ZF), Sign Flag (SF), and Overflow Flag (OF) reflect relations between operands during a CMP operation.
๐Ÿ’ป assembly Snippet
; Status Flags after CMP
cmp ax, 10    ; If AX = 10 -> ZF=1, CF=0
              ; If AX = 5  -> ZF=0, CF=1 (Borrow required)
              ; If AX = 15 -> ZF=0, CF=0
Q248
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What is the key difference between conditional jump instructions used for signed comparisons (JG/JL) and unsigned comparisons (JA/JB) in x86 assembly?
๐Ÿ’ป assembly Snippet
; Signed vs Unsigned Branching Example
cmp ax, bx
jg signed_greater   ; Signed comparison: branches if AX > BX (Signed)
ja unsigned_above   ; Unsigned comparison: branches if AX > BX (Unsigned)
Q249
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How do JZ (Jump if Zero) and JNZ (Jump if Not Zero) conditional jump instructions operate following a CMP operation?
๐Ÿ’ป assembly Snippet
; JZ and JNZ Example
cmp ax, bx
jz values_are_equal    ; Jumps if AX == BX (ZF == 1)
jnz values_are_unequal  ; Jumps if AX != BX (ZF == 0)
Q250
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 3๐Ÿท๏ธ 3.1. Conditional JumpsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Why does Intel assembly language provide instruction aliases (synonyms) such as JE/JZ, JNE/JNZ, and JB/JNAE/JC, and how do they map to machine code opcodes and status flags?
๐Ÿ’ป assembly Snippet
; Instruction Mnemonic Aliases
cmp ax, bx
je targets_equal   ; Assembly alias for JZ (Opcode 74h)
cmp ax, bx
jz targets_zero    ; Same opcode as JE (Opcode 74h)