Pseudo-code · Question 25 · Medium
What will be the output of the following pseudocode? (Note: &, ^ and >> are bitwise AND, XOR and right shift.)
Integer a, b
Set a = 29, b = 15
Print (a & b) ^ (a >> 1)
- 13
- 3
- 27
- 1
Answer and explanation
Answer: B. 3
Explanation: 29 & 15 = 11101 & 01111 = 01101 = 13, and 29 >> 1 = 14 (01110). 13 ^ 14 = 01101 ^ 01110 = 00011 = 3.
Previous: What will be the output of the following pseudocode? · Next: What will be the output of the following pseudocode?
Practise pseudo-code
Try a fresh set of pseudo-code questions with an explanation after every answer, free and without signing up: Pseudo-code practice. Or sit a full placement mock test.
More pseudo-code questions
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode? (Note: array indices…
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode? (Note: array indices…
- What will be the output of the following pseudocode?
- What will be the output of the following pseudocode? (Note: for-loop bounds…
- What will be the output of the following pseudocode? (Note: for-loop bounds…
More technical & programming practice
C Programming · Java · Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS · SQL
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge