Skip to main content

Array — Part 2 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Array — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.

Questions
15
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
18 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
15

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

Live Progress | 0/15 answered
✓ 0 correct ✗ 0 wrong 0% score
Question 1 of 15
★ FPSC ★ PPSC

What is the purpose of the Arrays.fill() method in Java?

Question 2 of 15
★ FPSC ★ PPSC

In Java, what is the purpose of the Arrays.equals() method?

Question 3 of 15
★ FPSC ★ PPSC

Determine output: public class Test{ public static void main(String[] args){ int[] x = {1, 2, 3, 4}; int[] y = x; x = new int[2]; for(int i = 0; i < x.length; i++) System.out.print(y[i] + " "); } }

Question 4 of 15
★ FPSC ★ PPSC

Analyze the following code and choose the correct answer. int[] arr = new int[5]; arr = new int[6];

Question 5 of 15
★ FPSC ★ PPSC

When you pass an array to a method, the method receives ________ .

Question 6 of 15
★ FPSC ★ PPSC

Which of these operators is used to allocate memory to array variable in Java?

Question 7 of 15
★ FPSC ★ PPSC

Which of these is an incorrect array declaration?

Question 8 of 15
★ FPSC ★ PPSC

What will be the output of the following Java code? int arr[] = new int [5]; System.out.print(arr);

Question 9 of 15
★ FPSC ★ PPSC

What will be the output of the following Java code? class array_output { public static void main(String args[]) { int array_variable [] = new int[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = i; System.out.print(array_variable[i] + " "); i++; } } }

Question 10 of 15
★ FPSC ★ PPSC

What will be the output of the following Java code? class evaluate { public static void main(String args[]) { int arr[] = new int[] {0 , 1, 2, 3, 4, 5, 6, 7, 8, 9}; int n = 6; n = arr[arr[n] / 2]; System.out.println(arr[n] / 2); } }

Question 11 of 15
★ FPSC ★ PPSC

What will be the output of the following Java code? class array_output { public static void main(String args[]) { char array_variable [] = new char[10]; for (int i = 0; i < 10; ++i) { array_variable[i] = 'i'; System.out.print(array_variable[i] + ""); } } }

Question 12 of 15
★ FPSC ★ PPSC

What will be the output of the following Java code? class multidimention_array { public static void main(String args[]) { int arr[][] = new int[3][]; arr[0] = new int[1]; arr[1] = new int[2]; arr[2] = new int[3]; int sum = 0; for (int i = 0; i < 3; ++i) for (int j = 0; j < i + 1; ++j) arr[i][j] = j + 1; for (int i = 0; i < 3; ++i) for (int j = 0; j < i + 1; ++j) sum + = arr[i][j]; System.out.print(sum); } }

Question 13 of 15
★ FPSC ★ PPSC

Which of these is necessary to specify at time of array initialization?

Question 14 of 15
★ FPSC ★ PPSC

What will be the output of the following Java code? class array_output { public static void main(String args[]) { int array_variable[][] = {{ 1, 2, 3}, { 4 , 5, 6}, { 7, 8, 9}}; int sum = 0; for (int i = 0; i < 3; ++i) for (int j = 0; j < 3 ; ++j) sum = sum + array_variable[i][j]; System.out.print(sum / 5); } }

Question 15 of 15
★ FPSC ★ PPSC

Which of these is an incorrect Statement?

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 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.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →