ALU (Arithmetic Logic Unit) MCQs

By: Prof. Dr. Fazal Rehman Shamil | Last updated: September 20, 2024

What is the primary function of the Arithmetic Logic Unit (ALU) in a CPU?
A) To manage memory operations
B) To perform arithmetic and logical operations
C) To fetch instructions from memory
D) To control input/output operations
Answer: B

Which operations are typically performed by the ALU?
A) Memory allocation and deallocation
B) Arithmetic operations and logical comparisons
C) Data storage and retrieval
D) Instruction fetching and decoding
Answer: B

What kind of operation is NOT typically handled by the ALU?
A) Addition
B) Subtraction
C) Data transfer
D) Logical AND
Answer: C

Which part of the ALU is responsible for performing bitwise operations?
A) Arithmetic Unit
B) Logic Unit
C) Control Unit
D) Register Unit
Answer: B

How does the ALU handle an overflow condition in arithmetic operations?
A) It generates a carry flag
B) It generates an overflow flag
C) It ignores the overflow
D) It stops the computation
Answer: B

What does the ALU use to store the result of an arithmetic operation?
A) Instruction Register
B) Data Register
C) Accumulator
D) Program Counter
Answer: C

Which register in the ALU is used to hold temporary data during calculations?
A) Accumulator
B) Memory Address Register
C) Stack Pointer
D) Program Counter
Answer: A

What type of operations does the ALU perform for logical instructions?
A) Comparisons and bitwise manipulations
B) Memory management
C) Instruction decoding
D) Data transfer
Answer: A

In which component of the ALU are arithmetic operations such as addition and subtraction performed?
A) Arithmetic Unit
B) Control Unit
C) Logic Unit
D) Register Unit
Answer: A

How does the ALU communicate the result of an operation to other parts of the CPU?
A) Through data buses
B) By updating the accumulator
C) By sending it to cache memory
D) By writing to the instruction register
Answer: B

Which flag does the ALU use to indicate a result that is zero?
A) Overflow Flag
B) Carry Flag
C) Zero Flag
D) Sign Flag
Answer: C

What type of logical operation does the ALU perform with the logical OR instruction?
A) Bitwise comparison of two operands
B) Addition of two numbers
C) Subtraction of two numbers
D) Multiplication of two numbers
Answer: A

How does the ALU handle signed arithmetic operations?
A) By using two’s complement representation
B) By using absolute values
C) By using unsigned representation
D) By ignoring the sign bit
Answer: A

What does the ALU do when performing a logical shift operation?
A) Shifts bits left or right and fills with zeroes
B) Shifts bits left or right and fills with ones
C) Rotates bits left or right
D) Performs arithmetic addition
Answer: A

Which operation would NOT be performed by the ALU?
A) Bitwise AND
B) Logical NOT
C) Memory write
D) Integer addition
Answer: C

What does the ALU use to handle the result of a subtraction operation?
A) Carry Flag
B) Overflow Flag
C) Zero Flag
D) Sign Flag
Answer: B

How does the ALU determine if a comparison operation is true or false?
A) By setting the carry flag
B) By updating the comparison flag
C) By writing to cache memory
D) By performing bitwise operations
Answer: B

What is the function of the carry flag in the ALU?
A) To indicate an overflow in addition operations
B) To indicate a borrow in subtraction operations
C) To signal if the result is larger than the maximum value
D) To indicate that an operation has been performed
Answer: A

In which part of the ALU would you find the logic for performing bitwise XOR operations?
A) Arithmetic Unit
B) Logic Unit
C) Control Unit
D) Register Unit
Answer: B

What is the primary purpose of the accumulator in relation to the ALU?
A) To store intermediate results of arithmetic and logical operations
B) To hold addresses for memory access
C) To manage instruction execution
D) To handle data transfer between devices
Answer: A

Which flag in the ALU is set if an arithmetic operation results in a negative number?
A) Overflow Flag
B) Zero Flag
C) Carry Flag
D) Sign Flag
Answer: D

What is the purpose of the zero flag in the ALU?
A) To indicate that the result of an operation is zero
B) To signal an overflow condition
C) To manage data transfer
D) To store temporary data
Answer: A

How does the ALU perform a bitwise NOT operation?
A) By flipping all the bits of an operand
B) By shifting bits left
C) By adding one to the operand
D) By subtracting one from the operand
Answer: A

Which ALU operation is used to test if a number is positive or negative?
A) Addition
B) Subtraction
C) Bitwise AND
D) Sign Flag Checking
Answer: D

How does the ALU manage multiple arithmetic operations simultaneously?
A) By using a pipeline architecture
B) By performing operations sequentially
C) By storing intermediate results in cache
D) By increasing clock speed
Answer: A

Which ALU component is responsible for handling logical operations like AND, OR, and NOT?
A) Arithmetic Unit
B) Logic Unit
C) Control Unit
D) Register Unit
Answer: B

What happens if the ALU encounters an overflow during an addition operation?
A) It sets the overflow flag
B) It generates a carry-out
C) It halts the CPU
D) It ignores the overflow
Answer: A

What is the effect of a left shift operation in the ALU?
A) It multiplies the number by 2 for each shift position
B) It divides the number by 2 for each shift position
C) It performs bitwise OR operation
D) It performs bitwise XOR operation
Answer: A

How does the ALU handle logical operations on binary numbers?
A) By using bitwise manipulation
B) By performing arithmetic calculations
C) By decoding instructions
D) By storing data in memory
Answer: A

What role does the ALU play in the execution of conditional instructions?
A) It evaluates conditions and sets flags accordingly
B) It manages memory access
C) It performs data transfer
D) It handles input/output operations
Answer: A

Which flag in the ALU indicates a borrow condition in subtraction operations?
A) Carry Flag
B) Zero Flag
C) Overflow Flag
D) Borrow Flag
Answer: A

How does the ALU perform a bitwise AND operation?
A) By comparing each bit of two operands and setting the result bit to 1 if both bits are 1
B) By adding corresponding bits of two operands
C) By subtracting bits of two operands
D) By shifting bits left
Answer: A

What type of shift operation would move bits to the right while filling the vacated positions with zeroes?
A) Logical Shift
B) Arithmetic Shift
C) Circular Shift
D) Bitwise Shift
Answer: A

How does the ALU handle operations involving floating-point numbers?
A) By using a separate Floating Point Unit (FPU)
B) By performing integer arithmetic
C) By storing floating-point results in cache
D) By converting floating-point to integer format
Answer: A

What is the primary function of the Arithmetic Unit within the ALU?
A) To perform arithmetic calculations such as addition and subtraction
B) To manage data transfer
C) To decode instructions
D) To perform logical operations
Answer: A

How does the ALU determine if an addition operation has resulted in a carry-out?
A) By checking the carry flag
B) By updating the accumulator
C) By reading from the instruction register
D) By examining the overflow flag
Answer: A

What does the ALU do during a bitwise XOR operation?
A) Sets a bit to 1 if the corresponding bits of the operands are different
B) Sets a bit to 1 if both corresponding bits are 1
C) Sets a bit to 1 if both corresponding bits are 0
D) Sets a bit to 0 if either corresponding bit is 1
Answer: A

Which operation does the ALU perform to check if a result is even or odd?
A) Bitwise AND with 1
B) Addition
C) Subtraction
D) Logical OR
Answer: A

What role does the ALU play in handling integer division?
A) It performs the division using integer arithmetic
B) It converts integers to floating-point format
C) It stores the quotient in memory
D) It manages floating-point calculations
Answer: A

Which flag in the ALU indicates that an arithmetic operation has resulted in a negative result?
A) Zero Flag
B) Overflow Flag
C) Carry Flag
D) Sign Flag
Answer: D

What does the ALU do when a logical shift right operation is performed?
A) It shifts all bits to the right and fills the leftmost bits with zeroes
B) It shifts all bits to the left and fills the rightmost bits with zeroes
C) It rotates bits to the right
D) It performs a bitwise NOT operation
Answer: A

How does the ALU handle multiple arithmetic operations using pipelining?
A) By processing multiple operations in overlapping stages
B) By executing operations sequentially
C) By storing results in cache
D) By increasing the clock frequency
Answer: A

Which part of the ALU performs the operations for addition and subtraction?
A) Arithmetic Unit
B) Logic Unit
C) Control Unit
D) Register Unit
Answer: A

How does the ALU use the status flags to control program flow?
A) By using flags to determine if conditional branches should be taken
B) By updating memory addresses
C) By managing data transfer
D) By storing intermediate results
Answer: A

What is the purpose of a logical shift left operation in the ALU?
A) To multiply the number by powers of two
B) To divide the number by powers of two
C) To perform bitwise XOR
D) To perform bitwise AND
Answer: A

Which ALU operation is typically used to determine if two numbers are equal?
A) Bitwise AND
B) Bitwise OR
C) Bitwise XOR
D) Equality comparison
Answer: D

What is the primary function of the carry flag in relation to subtraction operations in the ALU?
A) To indicate if a borrow occurred during subtraction
B) To signal an overflow condition
C) To show the result is zero
D) To manage data transfer
Answer: A

What does the ALU do when a logical NOT operation is performed?
A) It flips each bit of the operand
B) It adds one to the operand
C) It subtracts one from the operand
D) It shifts the operand left
Answer: A

Which ALU flag is set when a result is larger than the maximum value that can be represented?
A) Overflow Flag
B) Carry Flag
C) Zero Flag
D) Sign Flag
Answer: A

What does the ALU use to store intermediate results of complex operations?
A) Accumulator
B) Memory Address Register
C) Stack Pointer
D) Data Register
Answer: A

Which ALU operation is used to calculate the difference between two numbers?
A) Subtraction
B) Addition
C) Multiplication
D) Division
Answer: A

What role does the ALU play in handling bitwise operations?
A) It performs bitwise manipulations such as AND, OR, and XOR
B) It manages arithmetic calculations
C) It performs data transfer operations
D) It decodes instructions
Answer: A

How does the ALU indicate that an arithmetic operation resulted in a value that fits within the expected range?
A) By setting the carry flag
B) By clearing the overflow flag
C) By updating the accumulator
D) By writing to cache memory
Answer: B

Which flag is set if an ALU operation results in a result that is equal to zero?
A) Zero Flag
B) Overflow Flag
C) Carry Flag
D) Sign Flag
Answer: A

What is the purpose of an arithmetic unit within the ALU?
A) To execute arithmetic operations such as addition and subtraction
B) To perform logical operations
C) To handle data transfers
D) To manage program control
Answer: A

How does the ALU use the sign flag to indicate the result of an operation?
A) By showing if the result is positive or negative
B) By indicating an overflow condition
C) By signaling if the result is zero
D) By managing the carry-out condition
Answer: A

What does a bitwise shift left operation in the ALU effectively do?
A) Multiplies the value by 2 for each bit position shifted
B) Divides the value by 2 for each bit position shifted
C) Performs bitwise NOT
D) Performs bitwise XOR
Answer: A

How does the ALU perform multiplication operations?
A) By using iterative addition
B) By using bitwise shifts
C) By employing floating-point arithmetic
D) By directly using multiplication circuitry
Answer: A

What is the main difference between a logical shift and an arithmetic shift in the ALU?
A) Logical shifts fill the vacated bit positions with zeroes, while arithmetic shifts preserve the sign bit
B) Arithmetic shifts fill the vacated bit positions with zeroes, while logical shifts preserve the sign bit
C) Logical shifts perform multiplication, while arithmetic shifts perform addition
D) Arithmetic shifts are used for comparisons, while logical shifts are used for data transfers
Answer: A

How does the ALU handle a result that is larger than the maximum value that can be represented in its current format?
A) By setting the overflow flag
B) By generating a carry-out
C) By rounding the result
D) By truncating the result
Answer: A

What kind of data does the ALU primarily manipulate?
A) Binary data
B) Text data
C) Floating-point data
D) Alphanumeric data
Answer: A

Which ALU flag indicates whether an arithmetic operation has resulted in a result larger than the maximum value that can be represented?
A) Overflow Flag
B) Carry Flag
C) Zero Flag
D) Sign Flag
Answer: A

How does the ALU perform a bitwise OR operation?
A) By setting a bit to 1 if either operand has a 1 in that bit position
B) By setting a bit to 1 if both operands have a 1 in that bit position
C) By setting a bit to 0 if either operand has a 1 in that bit position
D) By shifting bits left
Answer: A

What does the ALU do during a bitwise XOR operation?
A) It sets a bit to 1 if the corresponding bits of the operands are different
B) It sets a bit to 1 if both corresponding bits are 1
C) It sets a bit to 1 if both corresponding bits are 0
D) It sets a bit to 0 if either bit is 1
Answer: A

Which ALU operation is used to check if a result is negative?
A) Bitwise AND
B) Bitwise OR
C) Checking the sign flag
D) Logical shift
Answer: C

What is the effect of a bitwise NOT operation performed by the ALU?
A) Flips all the bits of the operand
B) Adds one to the operand
C) Subtracts one from the operand
D) Shifts bits left
Answer: A

Which flag in the ALU is set when an addition operation results in a value that exceeds the maximum range?
A) Overflow Flag
B) Carry Flag
C) Zero Flag
D) Sign Flag
Answer: A

What does the ALU do when a bitwise AND operation is performed?
A) Sets a bit to 1 if both operands have a 1 in that bit position
B) Sets a bit to 0 if either operand has a 1 in that bit position
C) Sets a bit to 1 if either operand has a 1 in that bit position
D) Sets a bit to 0 if both operands have a 0 in that bit position
Answer: A

How does the ALU handle comparisons between two operands?
A) By setting flags based on the result of the comparison
B) By performing arithmetic operations
C) By storing the result in memory
D) By transferring data to output
Answer: A

Which component within the ALU performs the actual arithmetic and logical operations?
A) Arithmetic Unit
B) Control Unit
C) Register Unit
D) Memory Unit
Answer: A

What is the role of the carry flag in the context of subtraction operations?
A) It indicates whether a borrow occurred during subtraction
B) It shows if the result is zero
C) It indicates an overflow condition
D) It manages intermediate results
Answer: A

Which ALU operation is used to determine if two numbers are not equal?
A) Bitwise XOR
B) Bitwise AND
C) Bitwise OR
D) Equality comparison
Answer: A

What is the primary role of the accumulator in relation to the ALU?
A) To hold intermediate results of arithmetic and logical operations
B) To manage data transfer between memory and CPU
C) To store program instructions
D) To handle input/output operations
Answer: A

How does the ALU handle results that exceed the range of representable values in integer arithmetic?
A) By setting the overflow flag
B) By rounding the result
C) By ignoring the excess
D) By truncating the result
Answer: A

Read More Computer Architecture MCQs

  1. SET 1: Computer Architecture MCQs
  2. SET 2: Computer Architecture MCQs
  3. SET 3: Computer Architecture MCQs
  4. SET 4: Computer Architecture MCQs
  5. SET 5: Computer Architecture MCQs
  6. SET 6: Computer Architecture MCQs
  7. SET 7: Computer Architecture MCQs
  8. SET 8: Computer Architecture MCQs
  9. SET 9: Computer Architecture MCQs