Pseudo-code · Question 6 · Medium

What will be the output of the following pseudocode? (Note: &, | and ^ are bitwise AND, OR and XOR.)

Integer a, b, c
Set a = 12, b = 7
c = a ^ b
a = c ^ a
Print a + c
  1. 23
  2. 18
  3. 19
  4. 11
Answer and explanation

Answer: B. 18

Explanation: c = 12 ^ 7 = 1100 ^ 0111 = 1011 = 11. Then a = 11 ^ 12 = 1011 ^ 1100 = 0111 = 7. a + c = 7 + 11 = 18.

Previous: What will be the output of the following pseudocode? (Note: / denotes integer… · Next: What will be the output of the following pseudocode? (Note: for-loop bounds…

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

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