Ch 04: Bit Manipulation and Shifts

198 Questions198 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 191 โ€“ 198 of 198 Questions
Page 20 of 20
Q191
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Summarize the core loop logic of the Shift-and-Add Binary Multiplication Algorithm and explain the role of the Carry Flag (CF) during each iteration.
๐Ÿ’ป assembly Snippet
; Shift-and-Add Core Loop
shr cx, 1       ; Shift multiplier LSB into CF
jnc skip_add    ; If CF == 0, skip addition
add ax, bx      ; Add multiplicand if CF == 1
skip_add:
shl bx, 1       ; Shift multiplicand left for next bit weight
Q192
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingHardโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Why does multiplying two 16-bit numbers require 32-bit register space and 32-bit shifting/addition operations, and what occurs if a 16-bit multiplicand is shifted in 16-bit registers?
๐Ÿ’ป assembly Snippet
; Zero-extending 16-bit multiplicand into 32-bit DX:AX space
mov ax, [multiplicand] ; Lower 16 bits in AX
xor dx, dx             ; Upper 16 bits cleared in DX (DX:AX = 32-bit multiplicand)
Q193
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What is meant by a 'valuable bit' in binary extended shift operations, and how does zero-extension protect valuable bits during multi-bit left shifts?
๐Ÿ’ป assembly Snippet
; Zero-extension protects valuable bits during shifting
; Initial 32-bit space: 0000 0000 0000 0000 | 1000 0000 0000 0001 b
; Shifting left moves '1' bits into upper word without bit loss
Q194
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How is 32-bit extended left shifting performed on a doubleword in 16-bit 8086 assembly language using SHL and RCL?
๐Ÿ’ป assembly Snippet
; Extended 32-bit Left Shift Example
num1 dd 40000
shl word [num1], 1    ; Shift lower 16-bit word left (MSB -> CF)
rcl word [num1+2], 1  ; Rotate upper 16-bit word left through carry (CF -> LSB)
Q195
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.3. Extended OperationsEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What is the ADC (Add with Carry) instruction in 8086 assembly language, how does it differ from ADD, and how is it used for multi-word (32-bit) addition?
๐Ÿ’ป assembly Snippet
; 32-bit Extended Addition (DX:AX + CX:BX)
add ax, bx    ; Add lower 16 bits (AX = AX + BX, sets CF if carry)
adc dx, cx    ; Add upper 16 bits + CF (DX = DX + CX + CF)
Q196
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.3. Extended OperationsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How does extended subtraction operate in 8086 assembly language using SUB and SBB (Subtract with Borrow)?
๐Ÿ’ป assembly Snippet
; 32-bit Extended Subtraction (DX:AX - CX:BX)
sub ax, bx    ; Subtract lower 16 bits (sets CF if borrow needed)
sbb dx, cx    ; Subtract upper 16 bits and borrow (DX = DX - CX - CF)
Q197
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.3. Extended OperationsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Write an 8086 assembly language code snippet to add two 32-bit doubleword variables ('src' and 'dest') in memory using ADD and ADC, and explain how carry propagation works between lower and upper words.
๐Ÿ’ป assembly Snippet
; 32-Bit DoubleWord Addition Memory Example
dest: dd 40000
src:  dd 80000

mov ax, [src]          ; Load lower 16 bits of src
add word [dest], ax    ; Add lower 16 bits of dest and src (sets CF)
mov ax, [src+2]        ; Load upper 16 bits of src
adc word [dest+2], ax  ; Add upper 16 bits + CF into dest+2
Q198
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.3. Extended OperationsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How does the SBB (Subtract with Borrow) instruction function in multi-word extended subtraction, and what dual roles does the Carry Flag (CF) perform during addition and subtraction?
๐Ÿ’ป assembly Snippet
; 32-Bit DoubleWord Subtraction Example
mov ax, [src]          ; Load lower 16 bits of src
sub word [dest], ax    ; Subtract lower words (sets CF if borrow needed)
mov ax, [src+2]        ; Load upper 16 bits of src
sbb word [dest+2], ax  ; Subtract upper words minus borrow (dest+2 = dest+2 - ax - CF)