Chapter quiz · Arrays & Strings

Test what you learned.

8 questions on Arrays & Strings. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Arrays — Chapter Quiz

Eight questions on array method complexities, two-pointer, sliding window, prefix sums, and JS string quirks.

0/ 9
  1. Question 1
    1

    What is the time complexity of Array.prototype.shift() in JavaScript?

  2. Question 2
    2

    The two-pointer technique for finding a pair that sums to a target in a sorted array works because:

  3. Question 3
    3

    A sliding window of variable size is typically expanded or shrunk based on:

  4. Question 4
    4

    Given a prefix-sum array pre where pre[i] = nums[0] + … + nums[i-1], what is the sum of nums[l..r] (inclusive, 0-indexed)?

  5. Question 5
    5

    Kadane's algorithm solves which problem in O(n)?

  6. Question 6
    6

    In JavaScript, strings are mutable — you can change individual characters using bracket notation like str[0] = 'X'.

  7. Question 7
    7

    The Dutch National Flag algorithm, invented by Dijkstra, sorts an array of three distinct values using ___ pointers.

  8. Question 8
    8

    Which statements about JavaScript strings and Unicode are correct? (Select all that apply)

    Select all that apply.

Pick an answer — instant feedback as you go.