Skills101
← All practice quizzes

Bit Manipulation Quiz

8 questions10 minPass: 60%+10 XP on first pass

Binary, AND/OR/XOR, shifts, the XOR single-number trick and n & (n − 1).

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    What is 5 ^ 3 (XOR)?

  2. Question 2

    What is 6 & 3 (AND)?

  3. Question 3

    What is 1 << 4?

  4. Question 4

    Every number appears twice except one. Which operation finds the single number in O(1) space?

  5. Question 5

    What does n & (n − 1) do?

  6. Question 6Select all that apply

    Which numbers are powers of two? (select all that apply)

  7. Question 7

    How many 1 bits does 13 have?

  8. Question 8

    In Java, which shift fills with 0s even for negative numbers?