Skip to main content

Constructors And Methods — Part 2 MCQs with Explanations

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

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

Verified Practice Questions

Interactive test mode with detailed academic worked solutions

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

Which keyword is used to declare a method that cannot be overridden in Java?

Question 2 of 40
★ FPSC ★ PPSC

What is method hiding in Java?

Question 3 of 40
★ FPSC ★ PPSC

What is the purpose of the "return" statement in a method in Java?

Question 4 of 40
★ FPSC ★ PPSC

In Java, can a method have the same name as the class?

Question 5 of 40
★ FPSC ★ PPSC

What is method signature in Java?

Question 6 of 40
★ FPSC ★ PPSC

In Java, which access modifier allows a method to be accessed from any class in any package?

Question 7 of 40
★ FPSC ★ PPSC

What is a non-static (instance) method in Java?

Question 8 of 40
★ FPSC ★ PPSC

In Java, what does the "final" keyword indicate when used with a method?

Question 9 of 40
★ FPSC ★ PPSC

What is the difference between a method declaration and a method definition in Java?

Question 10 of 40
★ FPSC ★ PPSC

In Java, what is the purpose of method overloading?

Question 11 of 40
★ FPSC ★ PPSC

What will be the return type of a method that not returns any value?

Question 12 of 40
★ FPSC ★ PPSC

In which area of memory, the system stores parameters and local variables whenever a method is invoked?

Question 13 of 40
★ FPSC ★ PPSC

Which of the modifier can't be used for constructors?

Question 14 of 40
★ FPSC ★ PPSC

The variables declared in a class for the use of all methods of the class are called

Question 15 of 40
★ FPSC ★ PPSC

The finalize() method is called just prior to

Question 16 of 40
★ FPSC ★ PPSC

The main method should be static for the reason

Question 17 of 40
★ FPSC ★ PPSC

Given the following piece of code: class Person{ public int number; } public class Test{ public void doIt(int i , Person p){ i = 5; p.number = 8; } public static void main(String args[]){ int x = 0; Person p = new Person(); new Test().doIt(x, p); System.out.println(x + " " + p.number); } } What is the result?

Question 18 of 40
★ FPSC ★ PPSC

Which of the following statements regarding static methods are correct? 1. Static methods are difficult to maintain, because you can not change their implementation. 2. Static methods can be called using an object reference to an object of the class in which this method is defined. 3. Static methods are always public, because they are defined at class-level. 4. Static methods do not have direct access to non-static methods which are defined inside the same class.

Question 19 of 40
★ FPSC ★ PPSC

Determine output: class MyClass{ int i; int j; public MyClass(int i, int j){ this.i = i; this.j = j; } public void call(){ System.out.print("One"); } } public class Test{ public static void main(String args[]){ MyClass m = new MyClass(); //line 1 m.call(); //line 2 } }

Question 20 of 40
★ FPSC ★ PPSC

class A{ A(String s){} A(){} } class B extends A{ B(){} B(String s){ super(s); } void test(){ // insert code here } } Which of the below code can be insert at line 7 to make clean compilation ?

Question 21 of 40
★ FPSC ★ PPSC

Which of these is a legal definition of a method named examveda assuming it throws IOException, and returns void. Also assume that the method does not take any arguments. Select the one correct answer.

Question 22 of 40
★ FPSC ★ PPSC

Which component is responsible to run java program?

Question 23 of 40
★ FPSC ★ PPSC

Which of the below is not a Java Profiler?

Question 24 of 40
★ FPSC ★ PPSC

What is true about constructor?

Question 25 of 40
★ FPSC ★ PPSC

Which statement is true about java?

Question 26 of 40
★ FPSC ★ PPSC

What is not the use of "this" keyword in Java?

Question 27 of 40
★ FPSC ★ PPSC

When does method overloading is determined?

Question 28 of 40
★ FPSC ★ PPSC

Which of these operators is used to allocate memory for an object?

Question 29 of 40
★ FPSC ★ PPSC

What is true about Class.getInstance()?

Question 30 of 40
★ FPSC ★ PPSC

Method overriding is combination of inheritance and polymorphism?

Question 31 of 40
★ FPSC ★ PPSC

Which exception is thrown when java is out of memory?

Question 32 of 40
★ FPSC ★ PPSC

What is Recursion in Java?

Question 33 of 40
★ FPSC ★ PPSC

Which function is used to perform some action when the object is to be destroyed?

Question 34 of 40
★ FPSC ★ PPSC

Which of these statement is incorrect?

Question 35 of 40
★ FPSC ★ PPSC

What will be the output of the following Java code? class box { int width; int height; int length; int volume; void finalize() { volume = width*height*length; System.out.println(volume); } protected void volume() { volume = width*height*length; System.out.println(volume); } } class Output { public static void main(String args[]) { box obj = new box(); obj.width=5; obj.height=5; obj.length=6; obj.volume(); } }

Question 36 of 40
★ FPSC ★ PPSC

Which of the following is a garbage collection technique?

Question 37 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class recursion { int func (int n) { int result; if (n == 1) return 1; result = func (n - 1); return result; } } class Output { public static void main(String args[]) { recursion obj = new recursion() ; System.out.print(obj.func(5)); } }

Question 38 of 40
★ FPSC ★ PPSC

What is true about private constructor?

Question 39 of 40
★ FPSC ★ PPSC

Where is a new object allocated memory?

Question 40 of 40
★ FPSC ★ PPSC

What will be the output of the following Java program? class box { int width; int height; int length; int volume; void volume() { volume = width*height*length; } } class Output { public static void main(String args[]) { box obj = new box(); obj.height = 1; obj.length = 5; obj.width = 5; obj.volume(); System.out.println(obj.volume); } }

✓ 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 →