Array u0026 String Manipulation Mastery Quiz Quiz

  1. Reverse Array Elements

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

    1. [2, 4, 1, 3]
    2. [2, 1, 4, 3]
    3. [4, 3, 1, 2]
    4. [3, 4, 1, 2]
    5. [2, 4, 3, 1]
  2. String Split

    What is the result of splitting the string 'hello world' by a space character?

    1. ['hello', 'world']
    2. ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']
    3. ['helloworld']
    4. ['hello world']
    5. ['hello', '', 'world']
  3. Array Length

    If arr = [7, 'a', 9, 2], what does arr.length return?

    1. 4
    2. 5
    3. 3
    4. 2
    5. arr.lenght
  4. String Concatenation

    Which of the following correctly concatenates 'Java' and 'Script' in most programming languages?

    1. 'Java' + 'Script'
    2. 'Java' u0026 'Script'
    3. 'Java'.join('Script')
    4. 'Java'.concatinate('Script')
    5. 'Java'.add('Script')
  5. Finding Index

    Given fruits = ['apple', 'banana', 'cherry'], what is the index of 'cherry'?

    1. 2
    2. 1
    3. 3
    4. 0
    5. -1
  6. Array Push

    If nums = [1, 2, 3] and we perform nums.push(4), what is the new array?

    1. [1, 2, 3, 4]
    2. [4, 1, 2, 3]
    3. [1, 2, 3]
    4. [1, 2, 3];4
    5. [1, 2, 3, 4, 5]
  7. Substring Extraction

    What does 'computer'.substring(3, 6) return?

    1. 'put'
    2. 'com'
    3. 'comp'
    4. 'puter'
    5. 'pute'
  8. Removing Last Array Element

    What is left in arr = ['red', 'green', 'blue'] after calling arr.pop()?

    1. ['red', 'green']
    2. ['red', 'blue']
    3. ['green', 'blue']
    4. ['red']
    5. ['green']
  9. Case Conversion

    If you apply the toUpperCase() method to the string 'array', what do you get?

    1. 'ARRAY'
    2. 'Array'
    3. 'array'
    4. 'Arrray'
    5. 'aRRAY'
  10. Accessing Characters

    How do you access the third character of the string 'Python'?

    1. 'Python'[2]
    2. 'Python'[1]
    3. 'Python'.charAt(3)
    4. 'Python'.at(2)
    5. 'Python'.get(3)