Problem Solving with Arrays and Strings Quiz Quiz

  1. Find Element Index

    What is the index of the first occurrence of the letter 'e' in the string 'cheese'?

    1. 2
    2. 1
    3. 3
    4. 0
    5. 4
  2. Reverse an Array

    Given the array [1, 2, 3, 4, 5], what is the result after reversing it?

    1. [5, 4, 3, 2, 1]
    2. [1, 2, 3, 4, 5]
    3. [2, 1, 3, 4, 5]
    4. [1, 3, 2, 4, 5]
    5. [5, 3, 1, 2, 4]
  3. Finding Maximum Value

    What is the largest value in the array [-5, 7, 2, 0, -10]?

    1. 7
    2. 2
    3. 0
    4. -5
    5. -10
  4. Array Sorting

    If you sort the array [3, 11, 5, 1] in ascending order, what is the result?

    1. [1, 3, 5, 11]
    2. [11, 5, 3, 1]
    3. [3, 5, 1, 11]
    4. [1, 5, 3, 11]
    5. [1, 11, 3, 5]
  5. Counting Occurrences

    How many times does the character 'a' appear in the string 'assignment'?

    1. 1
    2. 2
    3. 3
    4. 0
    5. 5
  6. Concatenation of Strings

    What is the result of concatenating 'code' and 'cademy'?

    1. codecademy
    2. codeacademy
    3. codeacademey
    4. code ca demy
    5. codecadem
  7. Searching in Array

    Given the array ['apple', 'banana', 'grape', 'kiwi'], which element is at index 2?

    1. grape
    2. apple
    3. kiwi
    4. banana
    5. prape
  8. Splitting a String

    If you split the string 'fast,quick,slow' by the comma, what is the element at index 1?

    1. quick
    2. fast
    3. slow
    4. fastquick
    5. slwo
  9. Joining Array Elements

    What is the result of joining the array ['dog', 'cat', 'owl'] with a dash - separator?

    1. dog-cat-owl
    2. dogcatowl
    3. dog,cat,owl
    4. dog owl cat
    5. dog-owl-cat
  10. Removing an Element from Array

    If you remove the element at index 1 from the array [10, 20, 30, 40], what is the new array?

    1. [10, 30, 40]
    2. [20, 30, 40]
    3. [10, 20, 40]
    4. [10, 30]
    5. [20, 40, 10]