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 181 โ€“ 190 of 198 Questions
Page 19 of 20
Q181
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Shift InstructionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The diagram `| 0 | ---> [ 1 1 0 1 0 0 0 ] ---> | C |` (where 0 enters the MSB and the LSB exits into the Carry Flag) illustrates which assembly instruction?
๐Ÿ’ป assembly Snippet
shr ax, 1
  1. A.SHL
  2. B.SAR
  3. C.SHR
  4. D.SAL
Q182
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Shift InstructionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The diagram `| C | <--- [ 1 1 0 1 0 0 0 ] <--- | 0 |` (where 0 enters the LSB and the MSB exits into the Carry Flag) illustrates which assembly instruction?
๐Ÿ’ป assembly Snippet
shl ax, 1
  1. A.SHL
  2. B.SAR
  3. C.SHR
  4. D.SAL
Q183
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Shift InstructionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
True or False: The shift instructions SHR (Shift Logical Right) and SAL (Shift Arithmetic Left) perform identical bit operations.
๐Ÿ’ป assembly Snippet
shr ax, 1  ; Shift Right
sal ax, 1  ; Shift Left
  1. A.TRUE
  2. B.FALSE
Q184
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Stack OperationsMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Explain the functions of the Stack Pointer (SP) and Base Pointer (BP) registers in the 8086 microprocessor, and specify their default segment associations.
๐Ÿ’ป assembly Snippet
; Stack Frame Access using BP and SP
push bp
mov bp, sp       ; Set up stack frame reference
mov ax, [bp + 4] ; Access parameter passed on stack relative to SS
Q185
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Explain how basic binary multiplication can be performed using shifting and addition operations (the Shift-and-Add algorithm).
๐Ÿ’ป assembly Snippet
; Shift-and-Add Binary Multiplication Concept
mov ax, 0      ; Accumulator for result
mov bx, 5      ; Multiplicand
mov cx, 3      ; Multiplier
Q186
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Compare Shift Logical Right (SHR) and Shift Logical Left (SHL) / Shift Arithmetic Left (SAL) instructions in 8086 assembly language in terms of bit insertion, shift direction, and Carry Flag updates.
๐Ÿ’ป assembly Snippet
; SHR and SHL/SAL Examples
mov ax, 0x0008  ; AX = 8 (0000 0000 0000 1000b)
shr ax, 1       ; AX = 4, CF = 0 (Logical Right Shift)
shl ax, 1       ; AX = 8, CF = 0 (Logical Left Shift)
Q187
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingHardโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
What is the primary difference between Shift Logical Right (SHR) and Shift Arithmetic Right (SAR) in 8086 assembly language, and why is SAR required for signed integers?
๐Ÿ’ป assembly Snippet
; Signed vs Unsigned Right Shift Comparison
mov al, -8      ; AL = 0xF8 (1111 1000b in 2's complement)
shr al, 1       ; AL = 0x7C (0111 1100b = +124 decimal) -> Incorrect signed division!
mov al, -8      ; AL = 0xF8
sar al, 1       ; AL = 0xFC (1111 1100b = -4 decimal)   -> Correct signed division!
Q188
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingEasyโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Explain the operations of Rotate Right (ROR) and Rotate Left (ROL) instructions in 8086 assembly language, detailing bit movements, operand bit-widths, and Carry Flag (CF) updates.
๐Ÿ’ป assembly Snippet
; ROR and ROL Instruction Usage
mov al, 0x81    ; AL = 1000 0001b
ror al, 1       ; AL = 1100 0000b (0xC0), CF = 1
rol al, 1       ; AL = 1000 0001b (0x81), CF = 1
Q189
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
How do Rotate Through Carry Right (RCR) and Rotate Through Carry Left (RCL) instructions operate in 8086 assembly language, and why are they described as 9-bit or 17-bit rotations?
๐Ÿ’ป assembly Snippet
; RCR and RCL Usage Example
clc             ; Clear Carry Flag (CF = 0)
mov al, 0x81    ; AL = 1000 0001b
rcr al, 1       ; CF inserted at MSB: AL = 0100 0000b (0x40), CF = 1
rcl al, 1       ; CF (1) inserted at LSB: AL = 1000 0001b (0x81), CF = 0
Q190
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Bit Manipulation & ShiftingMediumโญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Outline the systematic steps of the Shift-and-Add Multiplication Algorithm implemented in 8086 assembly language.
๐Ÿ’ป assembly Snippet
; 8086 Shift-and-Add Multiplication Algorithm
mov ax, 0          ; Initialize result accumulator
mov bx, 13         ; Multiplicand
mov cx, 5          ; Multiplier

mult_loop:
shr cx, 1          ; Shift LSB of multiplier into CF
jnc skip_addition
add ax, bx         ; Add multiplicand if bit was 1

skip_addition:
shl bx, 1          ; Always shift multiplicand left
cmp cx, 0
jnz mult_loop      ; Repeat until multiplier is 0