Array and String Wizardry Quiz Quiz

  1. String Reversal

    Which of the following methods correctly reverses a string in Python?

    1. string.reverse()
    2. string[::-1]
    3. reversed(string)
    4. string.inverse()
    5. string.backwards()
  2. Array Duplicates

    How can you efficiently find duplicate elements in an array?

    1. Using a nested loop with O(n^2) complexity.
    2. Sorting the array and comparing adjacent elements.
    3. Using a set to store unique elements and identify duplicates.
    4. All of the above.
    5. None of the above
  3. String Case Conversion

    Which method is used to convert a string to uppercase in JavaScript?

    1. toUpperCase()
    2. toUpper()
    3. string.upperCase()
    4. upperCase()
    5. toBig()
  4. Array Searching

    Which search algorithm is most efficient for searching a sorted array?

    1. Linear Search
    2. Binary Search
    3. Bubble Sort
    4. Selection Sort
    5. Exponential Search
  5. String Splitting

    Which of the following correctly splits the string 'apple,banana,cherry' into an array using the comma as a delimiter in most programming languages?

    1. string.split()
    2. string.partition(',')
    3. string.split(',')
    4. string.separate(',')
    5. string.break(',')
  6. Array Rotation

    What is the time complexity of rotating an array by one position to the right?

    1. O(1)
    2. O(log n)
    3. O(n)
    4. O(n log n)
    5. O(n^2)
  7. String Concatenation

    In Java, which operator is commonly used for string concatenation?

    1. -
    2. *
    3. .
    4. +
    5. /
  8. Array Filtering

    Which array method is used to create a new array containing only elements that satisfy a specific condition in JavaScript?

    1. map()
    2. reduce()
    3. filter()
    4. forEach()
    5. sort()
  9. Palindrome Check

    Which of the following strings is a palindrome?

    1. programming
    2. algorithm
    3. level
    4. computer
    5. internet
  10. String Searching

    Which string method is used to find the index of the first occurrence of a substring within a string in Python?

    1. find()
    2. search()
    3. index()
    4. substring()
    5. locate()