Heading: Bit Manipulation, XOR, and Disk Operations in C/C++
Q#1: What technique is used for replacing a damaged disk without shutting down the system?
(A) Bit Manipulation
(B) RAID
(C) Hot Swap
(D) XOR Swap
Answer: (C) Hot Swap
Q#2: In the XOR-based data recovery technique, how is the lost data recovered?
(A) By shutting down the system
(B) By replicating data from other disks
(C) By taking XOR of remaining bits
(D) By using a temporary third variable
Answer: (C) By taking XOR of remaining bits
Q#3: What is the purpose of Hot Plug in the context of disk replacement?
(A) Swapping two numbers
(B) Shifting binary numbers
(C) Replacing a disk without system shutdown
(D) Multiplying binary numbers
Answer: (C) Replacing a disk without system shutdown
Q#4: How are two numbers typically swapped using a third temporary variable?
(A) Exclusive OR
(B) Hot Plug
(C) Bit Manipulation
(D) Using a third temporary variable
Answer: (D) Using a third temporary variable
Q#5: In the XOR-based number swapping method, what is the sequence of statements to swap ‘a’ and ‘b’?
(A) a = a ^ b; b = b ^ a; a = a ^ b;
(B) a = a ^ b; b = b ^ a;
(C) a = a ^ b; a = a ^ b;
(D) b = b ^ a; a = a ^ b;
Answer: (B) a = a ^ b; b = b ^ a;
Q#6: How are unsigned integers declared explicitly in C?
(A) int i, j, k;
(B) unsigned int i, j, k;
(C) unsigned integers i, j, k;
(D) unsigned i, j, k;
Answer: (B) unsigned int i, j, k;
Q#7: What does the most significant bit signify in unsigned integers?
(A) Positive/Negative indicator
(B) Bit manipulation marker
(C) Encryption key
(D) Decimal point
Answer: (A) Positive/Negative indicator
Q#8: What is the primary purpose of the sample program provided?
(A) Disk encryption
(B) Bit manipulation exercises
(C) Number swapping
(D) Shift operators demonstration
Answer: (A) Disk encryption
Q#9: Which operator is used for left shift in C?
(A) >>
(B) <<
(C) &
(D) ^
Answer: (B) <<
Q#10: What does left shifting do in binary numbers?
(A) Division by 2
(B) Multiplication by 2
(C) Exclusive OR
(D) Bitwise AND
Answer: (B) Multiplication by 2
Q#11: How is left shift represented in the binary system?
(A) >>
(B) <<
(C) &
(D) ^
Answer: (B) <<
Q#12: What is the effect of right shifting a signed number with the most significant bit as 1?
(A) Becomes positive
(B) Remains negative
(C) Becomes zero
(D) Causes a system error
Answer: (B) Remains negative
Q#13: Which operator is used for right shift in C?
(A) <<
(B) >>
(C) &
(D) ^
Answer: (B) >>
Q#14: What is the primary advantage of shift operators over direct multiplication and division?
(A) Faster execution
(B) Smaller code size
(C) Easier syntax
(D) Improved precision
Answer: (A) Faster execution
Q#15: What does the XOR operator (^) do in the context of password encryption and decryption?
(A) Adds numbers
(B) Multiplies numbers
(C) Exponentiation
(D) Exclusive OR
Answer: (D) Exclusive OR
Q#16: What is the purpose of the AND, OR, and XOR operations in the program mentioned?
(A) Disk encryption
(B) Bitwise operations demonstration
(C) Swapping numbers
(D) Shift operators
Answer: (B) Bitwise operations demonstration
Q#17: How is a password encrypted in the provided sample program?
(A) Using XOR
(B) Using AND
(C) Using OR
(D) Using bit manipulation
Answer: (A) Using XOR
Q#18: What is the role of the third variable in the XOR-based number swapping method?
(A) Encryption key
(B) Temporary storage
(C) Bitwise operation
(D) XOR operation
Answer: (B) Temporary storage
Q#19: What kind of numbers are used for bit manipulations in the given paragraph?
(A) Signed integers
(B) Decimal numbers
(C) Floating-point numbers
(D) Unsigned integers
Answer: (D) Unsigned integers
Q#20: What does Hot Swap refer to in the context of disk replacement?
(A) Swapping two numbers without a third variable
(B) Replacing a disk without system shutdown
(C) Shifting binary numbers
(D) Encryption and decryption
Answer: (B) Replacing a disk without system shutdown