Arrays interview questions

21 Arrays questions from the PHP bank, written for Indian campus drives and tech interviews. Every question has a verified answer and an AI-tutor explanation on placd.

Free to start: the 2-minute IT readiness check — six questions and a result.

Take the free IT readiness check

or take a mock interview set up for this area

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

5. Which term means: "applies a given callback to each element of one or more input arrays and returns a new array of the returned values"?

Junior
  1. A.array_map
  2. B.array_filter
  3. C.Array unpacking
  4. D.Copy on write

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

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

Answer + AI explanation with Pro

Free to start

Start with a free readiness check

Sign up free for the 2-minute IT readiness check and a scored result. Answers, explanations and the AI tutor on every Arrays question come with Pro.

Take the free IT readiness check

or take a mock interview set up for this area

24,000+ questions & coding problemsSoftware & IT16,274 questionsGovernment jobs26 examsAptitudenew questions every timeAI practice interviewwith feedback65 topics to practiseMechanical1,149 questionsGATE ME9 papersEngineering Mathematics381 questions2-minute checkfreeDSA Problems1,422Civil1,005 questionsGATE CE9 papersCS Fundamentals1,209 questionsYour scores6 skillsSystem Design25Electrical / EEE1,047 questionsGATE EE9 papersRun your codeC++ · Java · PythonLow-Level Design144Electronics & Comm.975 questionsGATE EC9 papersAI help on every questionFull-Stack6,282Chemical1,005 questionsGATE CH9 papersAI whiteboardsystem designWork abroadEurope · remote · transfersESE ME1 paperGATE practice papers2019–2026ESE CE1 paperDate alertsbefore the last dateESE EE1 paperBehavioural courseHR round practiceESE ET1 paperResume optimizerProSSC JE ME1 paperApplication trackerSSC JE CE1 paperCompany-wise prepSSC JE EE1 paperRole roadmapsRRB JE1 subjectPriced in ₹UPI · cardsISRO SC1 paperGATE CS9 papersIBPS SO IT1 paperUGC NET CS1 paperSSC CGL26 papersIBPS PO26 papersRRB NTPC26 papersSSC CHSL26 papersIBPS Clerk26 papersSBI Clerk26 papersRRB Group D26 papersSSC CPO26 papersSSC GD26 papers