Arrays — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Arrays — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
12
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
15 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
12
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress | 0/12 answered
✓ 0 correct
✗ 0 wrong
0% score
🎉 Set complete! All 12 questions answered.
Question 1 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Question 2 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function returns an array consisting of associative key/value pairs?
Question 3 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Array values are keyed by ______ values (called indexed arrays) or using ______ values (called associative arrays). Of course, these key methods can be combined as well.
Question 4 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will the following script output? <?php $array = array (1, 2, 3, 5, 8, 13, 21, 34, 55); $sum = 0; for ($i = 0; $i < 5; $i++) { $sum += $array[$array[$i]]; } echo $sum; ?>
Question 5 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What elements will the following script output? <?php $array = array ( true => 'a', 1 => 'b' ) ; var_dump ( $array ) ; ?>
Question 6 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which array function checks if the specified key exists in the array?
Question 7 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
There are three different kind of arrays:
Question 8 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Absent any actual need for choosing one method over the other, does passing arrays by value to a read-only function reduce performance compared to passing them by reference?
Question 9 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Assume you would like to sort an array in ascending order by value while preserving key associations. Which of the following PHP sorting functions would you use?
Question 10 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What function computes the difference of arrays?
Question 11 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What functions count elements in an array? 1. count 2. Sizeof 3. Array_Count 4. Count_array
Question 12 of 12
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What array will you get if you convert an object to an array?
✓ Link copied to clipboard
Continue Your Practice
Next Practice Set → Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡 Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.