Array and String Mastery Quiz Quiz

  1. Array Conversion

    What is the result of converting an integer to an array?

    1. An empty array.
    2. An array with the integer as the only element at index 0.
    3. An array with the integer as the key and null as the value.
    4. An array of digits from the integer.
    5. It generates an error
  2. Array Key Types

    What data types are valid for keys in an array?

    1. Only integers.
    2. Only strings.
    3. Integers, strings, and objects.
    4. Integers and strings.
    5. Only floats.
  3. Array Key Overwriting

    If multiple elements in an array declaration use the same key, which value is retained?

    1. The first value.
    2. The last value.
    3. The value that is the shortest string.
    4. A merged value based on the values.
    5. All values are retained in an array.
  4. Array Indexing without Key

    When creating an indexed array without specifying a key, what key is automatically assigned to each new element?

    1. Zero.
    2. The increment of the largest previously used integer key.
    3. A random integer.
    4. Null.
    5. A default empty string.
  5. Accessing Non-Existent Key

    What happens when you attempt to access an array key that has not been defined?

    1. It returns zero.
    2. It generates an error and returns null.
    3. It creates the key with a value of null.
    4. It returns an empty string.
    5. It returns an undefined result.
  6. Array Creation

    If a variable does not exist, and you try to assign a value to it using empty square brackets, how will the array be created?

    1. An error will be thrown, as the variable must first be initiated.
    2. The variable is created as an array.
    3. The variable stays as null.
    4. A string will be created.
    5. A boolean false is returned.
  7. Removing Array Elements

    Which function should be used to remove a key-value pair from an array?

    1. delete()
    2. remove()
    3. unset()
    4. discard()
    5. pop()
  8. Array Destructuring

    What happens to array elements during destructuring if a variable is not provided for them?

    1. They are automatically assigned to a default variable.
    2. An error is thrown.
    3. They are ignored.
    4. They are set to null.
    5. They are skipped over.
  9. Array Unpacking

    Which function's semantics does array unpacking with the spread operator follow?

    1. array_merge()
    2. array_combine()
    3. array_splice()
    4. array_push()
    5. array_replace()
  10. Array Comparison

    Which function is used to compare arrays and find the differences between them?

    1. array_compare()
    2. array_equal()
    3. array_diff()
    4. array_intersect()
    5. array_similarity()