Arrays interview questions

21 real Arrays questions from the PHP bank, as asked in Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd — free to start.

1. What is Associative array?

Junior
  1. A.an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
  2. B.iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
  3. C.applies a given callback to each element of one or more input arrays and returns a new array of the returned values
  4. D.the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
Reveal the answer + AI explanation — free account

2. Which term means: "an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes"?

Junior
  1. A.Associative array
  2. B.Array unpacking
  3. C.array_filter
  4. D.Copy on write
Reveal the answer + AI explanation — free account

3. Which statement is correct?

Junior
  1. A.Associative array — assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
  2. B.Associative array — applies a given callback to each element of one or more input arrays and returns a new array of the returned values
  3. C.Associative array — an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
  4. D.Associative array — the optimization where an assigned array shares memory with its source until one of them is modified, at which point a separate copy is created
Reveal the answer + AI explanation — free account

4. What is array_map?

Junior
  1. A.returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
  2. B.an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
  3. C.applies a given callback to each element of one or more input arrays and returns a new array of the returned values
  4. D.the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
Reveal the answer + AI explanation — free account

6. Which statement is correct?

Junior
  1. A.array_map — the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
  2. B.array_map — applies a given callback to each element of one or more input arrays and returns a new array of the returned values
  3. C.array_map — assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
  4. D.array_map — iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
Reveal the answer + AI explanation — free account

7. What is array_filter?

Mid
  1. A.returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
  2. B.an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
  3. C.iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
  4. D.the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
Reveal the answer + AI explanation — free account

8. Which term means: "returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys"?

Mid
  1. A.Copy on write
  2. B.array_filter
  3. C.array_map
  4. D.Array unpacking
Reveal the answer + AI explanation — free account

9. Which statement is correct?

Mid
  1. A.array_filter — returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
  2. B.array_filter — applies a given callback to each element of one or more input arrays and returns a new array of the returned values
  3. C.array_filter — assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
  4. D.array_filter — the optimization where an assigned array shares memory with its source until one of them is modified, at which point a separate copy is created
Reveal the answer + AI explanation — free account

10. What is array_reduce?

Mid
  1. A.assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
  2. B.returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
  3. C.iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
  4. D.an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
Reveal the answer + AI explanation — free account

11. Which term means: "iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element"?

Mid
  1. A.array_map
  2. B.Copy on write
  3. C.Array unpacking
  4. D.array_reduce
Reveal the answer + AI explanation — free account

12. Which statement is correct?

Mid
  1. A.array_reduce — the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
  2. B.array_reduce — iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
  3. C.array_reduce — the optimization where an assigned array shares memory with its source until one of them is modified, at which point a separate copy is created
  4. D.array_reduce — returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
Reveal the answer + AI explanation — free account

13. What is Array unpacking?

Mid
  1. A.an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
  2. B.the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
  3. C.returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
  4. D.applies a given callback to each element of one or more input arrays and returns a new array of the returned values
Reveal the answer + AI explanation — free account

14. Which term means: "the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1"?

Mid
  1. A.array_filter
  2. B.Array unpacking
  3. C.array_reduce
  4. D.Associative array
Reveal the answer + AI explanation — free account

15. Which statement is correct?

Mid
  1. A.Array unpacking — returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
  2. B.Array unpacking — iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
  3. C.Array unpacking — assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
  4. D.Array unpacking — the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
Reveal the answer + AI explanation — free account

16. What is List destructuring?

Mid
  1. A.an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
  2. B.iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
  3. C.the optimization where an assigned array shares memory with its source until one of them is modified, at which point a separate copy is created
  4. D.assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
Reveal the answer + AI explanation — free account

17. Which term means: "assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment"?

Mid
  1. A.array_map
  2. B.List destructuring
  3. C.Associative array
  4. D.Copy on write
Reveal the answer + AI explanation — free account

18. Which statement is correct?

Mid
  1. A.List destructuring — the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
  2. B.List destructuring — assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
  3. C.List destructuring — iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
  4. D.List destructuring — applies a given callback to each element of one or more input arrays and returns a new array of the returned values
Reveal the answer + AI explanation — free account

19. What is Copy on write?

Senior
  1. A.applies a given callback to each element of one or more input arrays and returns a new array of the returned values
  2. B.the optimization where an assigned array shares memory with its source until one of them is modified, at which point a separate copy is created
  3. C.assigning array elements to several individual variables at once using the square-bracket or list construct on the left of an assignment
  4. D.iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
Reveal the answer + AI explanation — free account

20. Which term means: "the optimization where an assigned array shares memory with its source until one of them is modified, at which point a separate copy is created"?

Senior
  1. A.array_reduce
  2. B.Array unpacking
  3. C.array_filter
  4. D.Copy on write
Reveal the answer + AI explanation — free account

21. Which statement is correct?

Senior
  1. A.Copy on write — an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
  2. B.Copy on write — the spread three-dot syntax used inside an array literal to merge or expand the elements of another array, supporting string keys since PHP 8.1
  3. C.Copy on write — the optimization where an assigned array shares memory with its source until one of them is modified, at which point a separate copy is created
  4. D.Copy on write — applies a given callback to each element of one or more input arrays and returns a new array of the returned values
Reveal the answer + AI explanation — free account

Free to start

Answers, AI explanations, and a scored voice mock interview

Sign up free to check your answers with explanations, ask the AI tutor anything on any question, and take one full AI mock interview — scored like a real panel.

Practice Arrays free