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
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to declare a method that cannot be overridden in Java?
Correct Answer: Option A — final
Detailed Academic Explanation:
final is the correct answer to “Which keyword is used to declare a method that cannot be overridden in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is method hiding in Java?
Correct Answer: Option A — Defining a new method with the same name in a subclass
Detailed Academic Explanation:
Defining a new method with the same name in a subclass is the correct answer to “What is method hiding in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the "return" statement in a method in Java?
Correct Answer: Option B — To indicate that the method should return a value
Detailed Academic Explanation:
To indicate that the method should return a value is the correct answer to “What is the purpose of the "return" statement in a method in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, can a method have the same name as the class?
Correct Answer: Option A — Yes, it is a constructor
Detailed Academic Explanation:
Yes, it is a constructor is the correct answer to “In Java, can a method have the same name as the class”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is method signature in Java?
Correct Answer: Option A — The method name and its parameter types
Detailed Academic Explanation:
The method name and its parameter types is the correct answer to “What is method signature in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, which access modifier allows a method to be accessed from any class in any package?
Correct Answer: Option A — public
Detailed Academic Explanation:
public is the correct answer to “In Java, which access modifier allows a method to be accessed from any class in any package”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is a non-static (instance) method in Java?
Correct Answer: Option A — A method that belongs to an instance of a class
Detailed Academic Explanation:
A method that belongs to an instance of a class is the correct answer to “What is a non-static (instance) method in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, what does the "final" keyword indicate when used with a method?
Correct Answer: Option A — The method cannot be overridden in subclasses
Detailed Academic Explanation:
The method cannot be overridden in subclasses is the correct answer to “In Java, what does the "final" keyword indicate when used with a method”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the difference between a method declaration and a method definition in Java?
Correct Answer: Option A — Declaration specifies method name, return type, and parameters; definition provides the implementation
Detailed Academic Explanation:
Declaration specifies method name, return type, and parameters; definition provides the implementation is the correct answer to “What is the difference between a method declaration and a method definition in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, what is the purpose of method overloading?
Correct Answer: Option A — Defining multiple methods with the same name but different parameters
Detailed Academic Explanation:
Defining multiple methods with the same name but different parameters is the correct answer to “In Java, what is the purpose of method overloading”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the return type of a method that not returns any value?
Correct Answer: Option A — void
Detailed Academic Explanation:
void is the correct answer to “What will be the return type of a method that not returns any value”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In which area of memory, the system stores parameters and local variables whenever a method is invoked?
Correct Answer: Option C — Stack
Detailed Academic Explanation:
Stack is the correct answer to “In which area of memory, the system stores parameters and local variables whenever a method is invoked”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the modifier can't be used for constructors?
Correct Answer: Option C — static
Detailed Academic Explanation:
static is the correct answer to “Which of the modifier can't be used for constructors”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The variables declared in a class for the use of all methods of the class are called
Correct Answer: Option C — instance variables
Detailed Academic Explanation:
instance variables is the correct answer to “The variables declared in a class for the use of all methods of the class are called”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The finalize() method is called just prior to
Correct Answer: Option D — Before garbage collection.
Detailed Academic Explanation:
Before garbage collection. is the correct answer to “The finalize() method is called just prior to”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The main method should be static for the reason
Correct Answer: Option C — It can be executed without creating any instance of the class.
Detailed Academic Explanation:
It can be executed without creating any instance of the class. is the correct answer to “The main method should be static for the reason”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 17 of 40
★ FPSC
★ PPSC
★ 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?
Correct Answer: Option A — 0 8
Detailed Academic Explanation:
0 8 is the correct answer to “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”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 18 of 40
★ FPSC
★ PPSC
★ 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.
Correct Answer: Option B — 2 and 4
Detailed Academic Explanation:
2 and 4 is the correct answer to “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.”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 19 of 40
★ FPSC
★ PPSC
★ 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 } }
Correct Answer: Option B — Compilation fails due to an error on line 1
Detailed Academic Explanation:
Compilation fails due to an error on line 1 is the correct answer to “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 } }”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 20 of 40
★ FPSC
★ PPSC
★ 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 ?
Correct Answer: Option A — A a = new B()
Detailed Academic Explanation:
A a = new B() is the correct answer to “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”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 21 of 40
★ FPSC
★ PPSC
★ 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.
Correct Answer: Option B — void examveda() throws IOException{}
Detailed Academic Explanation:
void examveda() throws IOException{} is the correct answer to “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.”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which component is responsible to run java program?
Correct Answer: Option D — JRE
Detailed Academic Explanation:
JRE is the correct answer to “Which component is responsible to run java program”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the below is not a Java Profiler?
Correct Answer: Option A — JVM
Detailed Academic Explanation:
JVM is the correct answer to “Which of the below is not a Java Profiler”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is true about constructor?
Correct Answer: Option B — It can take any number of parameters
Detailed Academic Explanation:
It can take any number of parameters is the correct answer to “What is true about constructor”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which statement is true about java?
Correct Answer: Option A — Platform independent programming language
Detailed Academic Explanation:
Platform independent programming language is the correct answer to “Which statement is true about java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is not the use of "this" keyword in Java?
Correct Answer: Option D — Passing itself to method of the same class
Detailed Academic Explanation:
Passing itself to method of the same class is the correct answer to “What is not the use of "this" keyword in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
When does method overloading is determined?
Correct Answer: Option B — At compile time
Detailed Academic Explanation:
At compile time is the correct answer to “When does method overloading is determined”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these operators is used to allocate memory for an object?
Correct Answer: Option C — new
Detailed Academic Explanation:
new is the correct answer to “Which of these operators is used to allocate memory for an object”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is true about Class.getInstance()?
Correct Answer: Option D — Class.getInstance creates object if class does not have any constructor
Detailed Academic Explanation:
Class.getInstance creates object if class does not have any constructor is the correct answer to “What is true about Class.getInstance()”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Method overriding is combination of inheritance and polymorphism?
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “Method overriding is combination of inheritance and polymorphism”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which exception is thrown when java is out of memory?
Correct Answer: Option C — OutOfMemoryError
Detailed Academic Explanation:
OutOfMemoryError is the correct answer to “Which exception is thrown when java is out of memory”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is Recursion in Java?
Correct Answer: Option C — Recursion is a process of defining a method that calls itself repeatedly
Detailed Academic Explanation:
Recursion is a process of defining a method that calls itself repeatedly is the correct answer to “What is Recursion in Java”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which function is used to perform some action when the object is to be destroyed?
Correct Answer: Option A — finalize()
Detailed Academic Explanation:
finalize() is the correct answer to “Which function is used to perform some action when the object is to be destroyed”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these statement is incorrect?
Correct Answer: Option A — Every class must contain a main() method
Detailed Academic Explanation:
Every class must contain a main() method is the correct answer to “Which of these statement is incorrect”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 35 of 40
★ FPSC
★ PPSC
★ 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(); } }
Correct Answer: Option A — 150
Detailed Academic Explanation:
150 is the correct answer to “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(); } }”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is a garbage collection technique?
Correct Answer: Option B — Mark and sweep model
Detailed Academic Explanation:
Mark and sweep model is the correct answer to “Which of the following is a garbage collection technique”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 37 of 40
★ FPSC
★ PPSC
★ 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)); } }
Correct Answer: Option B — 1
Detailed Academic Explanation:
1 is the correct answer to “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)); } }”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is true about private constructor?
Correct Answer: Option A — Private constructor ensures only one instance of a class exist at any point of time
Detailed Academic Explanation:
Private constructor ensures only one instance of a class exist at any point of time is the correct answer to “What is true about private constructor”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Where is a new object allocated memory?
Correct Answer: Option A — Young space
Detailed Academic Explanation:
Young space is the correct answer to “Where is a new object allocated memory”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
Question 40 of 40
★ FPSC
★ PPSC
★ 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); } }
Correct Answer: Option C — 25
Detailed Academic Explanation:
25 is the correct answer to “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); } }”. This question is standard in competitive examination syllabi for Constructors And Methods.
💡Key Conceptual Anchor:Constructors And Methods
✓Link copied to clipboard
Continue Your Practice
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.