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 1 โ€“ 10 of 198 Questions
Page 1 of 20
Q1
๐Ÿ“ Short Q๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.5. Bitwise Logical OperationsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Which flags in the flags register are affected by the bitwise AND instruction in x86 assembly language?
๐Ÿ’ป assembly Snippet
mov al, 0x0F
and al, 0xF0
Q2
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.5. Bitwise Logical OperationsHard๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Write a procedure 'ConvertBinaryToDecimal' in x86 assembly language that receives the memory address of an ASCII string containing a binary number via the stack. The function should parse the binary string, calculate its equivalent decimal integer value, and print the resulting decimal number on the screen. For example, string '11011' prints 27 and string '1001' prints 9.
๐Ÿ’ป assembly Snippet
push bin_str
call ConvertBinaryToDecimal
Q3
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Conditional JumpsMedium๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Consider the following pseudo-code and write the corresponding optimal x86 assembly code for it: if (al > bl) AND (bl > cl) { cx = 1 }
๐Ÿ’ป assembly Snippet
if (al > bl) AND (bl > cl)
{
    cx = 1
}
Q4
๐Ÿง  Long Problem๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.5. Bitwise Logical OperationsHard๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Write an x86 assembly language program to swap every adjacent pair of bits in the AX register. For example, if AX = 0x9999 (1001100110011001 in binary), then after execution AX must contain 0x6666 (0110011001100110 in binary).
๐Ÿ’ป assembly Snippet
; Example input: AX = 0x9999
mov bx, ax
and ax, 0xAAAA
shr ax, 1
and bx, 0x5555
shl bx, 1
or ax, bx
Q5
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Bit Manipulation and Shift InstructionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Suppose the AL register contains the decimal value 5. Performing two bitwise left shifts (SHL AL, 2) produces which decimal value?
๐Ÿ’ป assembly Snippet
MOV AL, 5
SHL AL, 2
  1. A.20
  2. B.5
  3. C.10
  4. D.15
Q6
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.2. Arithmetic Instructions and DivisionEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
For the execution of the 8-bit division instruction 'DIV BL', where is the implied 16-bit dividend stored?
๐Ÿ’ป assembly Snippet
DIV BL
  1. A.AX
  2. B.BX
  3. C.CX
  4. D.DX
Q7
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Bit Manipulation and Shift InstructionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
In a Rotate Through Carry Right (RCR) instruction applied on a 16-bit word operand, how many total bits effectively participate in the rotation ring?
๐Ÿ’ป assembly Snippet
RCR AX, 1
  1. A.17 bits rotation
  2. B.16 bits rotation
  3. C.1 bit rotation
  4. D.8 bits rotation
Q8
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Bit Manipulation and Shift InstructionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
When the binary representation of the decimal number 35 is shifted to the right by two bit positions (35 >> 2), what is the resulting decimal value?
๐Ÿ’ป assembly Snippet
MOV AL, 35
SHR AL, 2
  1. A.8
  2. B.17
  3. C.35
  4. D.70
Q9
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Bit Manipulation and Shift InstructionsEasy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
Which rotation instruction moves every bit one position to the right, inserting the bit dropped from the right (LSB) into the left (MSB) while also copying it into the Carry Flag?
๐Ÿ’ป assembly Snippet
ROR AL, 1
  1. A.None of the given
  2. B.ROL
  3. C.RCR
  4. D.RCL
Q10
โ“ MCQ๐Ÿ“˜ CS401๐Ÿ“‘ Lec 4๐Ÿท๏ธ 4.1. Shift Instructions (SHL vs SAL)Easy๐Ÿ”โญ๐Ÿ’ก๐Ÿ“„๐ŸŽ“VU๐Ÿ›๏ธVU
The SHL (Shift Logical Left) and SAL (Shift Arithmetic Left) assembly instructions perform identical binary operations. (True/False)
๐Ÿ’ป assembly Snippet
SHL AL, 1
SAL AL, 1
  1. A.True
  2. B.False