Introduction to Programming MCQs with Answers
Practice important Introduction to Programming MCQs with answers and explanations.
Multiple Choice Questions
Q361: Which operator inverts the bits of its operand?
- A: Bitwise OR
- B: Bitwise XOR
- C: Bitwise AND
- D: Bitwise NOT
View Answer
D
Q362: What is the effect of the left shift operator << on a binary number?
- A: Multiplies the number by 2
- B: Divides the number by 2
- C: Adds 1 to the number
- D: Subtracts 1 from the number
View Answer
A
Q363: What is the result of 24 >> 1 where 24 in binary is 11000?
- A: 11000
- B: 1100
- C: 110
- D: 11
View Answer
B
Q364: What is the result of 12 << 1 where 12 in binary is 1100?
- A: 1100
- B: 1100
- C: 10000
- D: 110
View Answer
C
Q365: What does the NOT operator do when applied to the number 8 (1000 in binary)?
- A: 111
- B: 1000
- C: 1111
- D: 0
View Answer
A
Q366: What is a common use case of bit manipulation in operating systems?
- A: Setting file attributes
- B: Performing arithmetic calculations
- C: Sorting data
- D: Displaying text
View Answer
A
Q367: How does the XOR operator help in encrypting and decrypting passwords?
- A: It converts the password to its original form when applied twice with the same key
- B: It stores the password in plain text
- C: It changes the password to a readable format
- D: It compresses the password
View Answer
A
Q368: What is the result of XORing the binary numbers 1101 and 1011?
- A: 110
- B: 1110
- C: 100
- D: 10
View Answer
B
Q369: What does the right shift operator >> do to the binary number?
- A: Divides the number by 2
- B: Multiplies the number by 2
- C: Subtracts 1 from the number
- D: Adds 1 to the number
View Answer
A
Q370: What is the compound assignment operator for bitwise AND in C/C++?
- A: +=
- B: &=
- C: &
- D: `
View Answer
B