Array Conversion
What is the result of converting an integer to an array?
- An empty array.
- An array with the integer as the only element at index 0.
- An array with the integer as the key and null as the value.
- An array of digits from the integer.
- It generates an error
Array Key Types
What data types are valid for keys in an array?
- Only integers.
- Only strings.
- Integers, strings, and objects.
- Integers and strings.
- Only floats.
Array Key Overwriting
If multiple elements in an array declaration use the same key, which value is retained?
- The first value.
- The last value.
- The value that is the shortest string.
- A merged value based on the values.
- All values are retained in an array.
Array Indexing without Key
When creating an indexed array without specifying a key, what key is automatically assigned to each new element?
- Zero.
- The increment of the largest previously used integer key.
- A random integer.
- Null.
- A default empty string.
Accessing Non-Existent Key
What happens when you attempt to access an array key that has not been defined?
- It returns zero.
- It generates an error and returns null.
- It creates the key with a value of null.
- It returns an empty string.
- It returns an undefined result.
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?
- An error will be thrown, as the variable must first be initiated.
- The variable is created as an array.
- The variable stays as null.
- A string will be created.
- A boolean false is returned.
Removing Array Elements
Which function should be used to remove a key-value pair from an array?
- delete()
- remove()
- unset()
- discard()
- pop()
Array Destructuring
What happens to array elements during destructuring if a variable is not provided for them?
- They are automatically assigned to a default variable.
- An error is thrown.
- They are ignored.
- They are set to null.
- They are skipped over.
Array Unpacking
Which function's semantics does array unpacking with the spread operator follow?
- array_merge()
- array_combine()
- array_splice()
- array_push()
- array_replace()
Array Comparison
Which function is used to compare arrays and find the differences between them?
- array_compare()
- array_equal()
- array_diff()
- array_intersect()
- array_similarity()