Chapter quiz · Greedy & Bit Manipulation

Test what you learned.

8 questions on Greedy & Bit Manipulation. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Greedy Algorithms & Bit Manipulation — Chapter Quiz

Eight questions on interval scheduling, Huffman coding, JS bitwise int32 coercion, bit tricks, popcount, and BigInt.

0/ 9
  1. Question 1
    1

    The interval scheduling maximisation problem (select the maximum number of non-overlapping intervals) is solved greedily by:

  2. Question 2
    2

    Huffman coding produces an optimal prefix-free code by:

  3. Question 3
    3

    What happens when you apply a bitwise operator (e.g., |, &, ^, ~) to a JavaScript number?

  4. Question 4
    4

    How do you check whether the k-th bit (0-indexed from LSB) of an integer n is set?

  5. Question 5
    5

    The expression n & (n - 1) is useful for:

  6. Question 6
    6

    JavaScript's Number type can exactly represent all integers up to 2⁵³ − 1 (Number.MAX_SAFE_INTEGER).

  7. Question 7
    7

    To perform safe integer arithmetic on values larger than Number.MAX_SAFE_INTEGER in JavaScript, you should use the ___ type.

  8. Question 8
    8

    Which of the following are valid bit manipulation tricks in JavaScript? (Select all that apply)

    Select all that apply.

Pick an answer — instant feedback as you go.