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
A.an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
B.iteratively boils an array down to a single accumulated value by applying a callback that receives the running carry and the current element
C.applies a given callback to each element of one or more input arrays and returns a new array of the returned values
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
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
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
C.Associative array — an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
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
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
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
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
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
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"?
A.array_filter — returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
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
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
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
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"?
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
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
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
D.array_reduce — returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
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"?
A.Array unpacking — returns a new array containing only the elements for which the supplied callback returns a truthy value, preserving the original keys
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
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
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
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"?
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
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
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
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
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"?
A.Copy on write — an ordered map that uses arbitrary string or integer keys to associate values, rather than only sequential integer indexes
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
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
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
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.