Overriding And Overloading — Part 1 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Overriding And Overloading — Part 1 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
In Java, can a subclass override a private method from its superclass?
Correct Answer: Option D — No, private methods are not visible to subclasses
Detailed Academic Explanation:
In Java, private methods of a superclass are not accessible outside that class , including its subclasses. Since a subclass cannot see a private method of its superclass, it cannot override it. Even if a subclass declares a method with the same name and signature, it is treated as a new method , not an overridden one. Option A states a general rule but Option D gives the precise reason for why overriding is not possible. Therefore, the correct answer is Option D – No, private methods are not visible to subclasses .
💡Key Conceptual Anchor:Overriding And Overloading
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, can a subclass overload a method from its superclass?
Correct Answer: Option D — None of These
Detailed Academic Explanation:
Method overloading occurs when two or more methods in the same class (or subclass and superclass) have the same name but different parameter lists. In Java, a subclass can overload a method from its superclass by defining a method with the same name but a different parameter list. Option A is incorrect because a method marked as private in the superclass is not visible to the subclass, so it cannot be directly overloaded. Option B and C are incorrect because method overloading is a fundamental feature of Java and is fully supported. Therefore, the correct answer is Option D: None of These since none of the given options correctly describe method overloading in Java.
💡Key Conceptual Anchor:Overriding And Overloading
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output? class A{ static void method(){ System.out.println("Class A method"); } } class B extends A{ static void method(){ System.out.println("Class B method"); } } public class Test{ public static void main(String args[]){ A a = new B(); a.method(); } }
Correct Answer: Option A — Class A method
Detailed Academic Explanation:
Overriding in Java simply means that the particular method would be called based on the run time type of the object and not on the compile time type. But in the above case the methods are static which means access to them is always resolved during compile time only using the compile time type information. Accessing them using object references is just an extra liberty given by the designers of Java.
💡Key Conceptual Anchor:Overriding And Overloading
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output? class A{ int i = 10; public void printValue(){ System.out.print("Value-A"); } } class B extends A{ int i = 12; public void printValue(){ System.out.print("Value-B"); } } public class Test{ public static void main(String args[]){ A a = new B(); a.printValue(); System.out.print(a.i); } }
Correct Answer: Option B — Value-B 10
Detailed Academic Explanation:
If you create object of subclass with reference of super class like ( A a = new B();) then subclass method and super class variable will be executed.
💡Key Conceptual Anchor:Overriding And Overloading
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Determine output: class A{ public void printValue(){ System.out.println("Value-A"); } } class B extends A{ public void printNameB(){ System.out.println("Name-B"); } } class C extends A{ public void printNameC(){ System.out.println("Name-C"); } } public class Test{ public static void main (String[] args){ B b = new B(); C c = new C(); newPrint(b); newPrint(c); } public static void newPrint(A a){ a.printValue(); } }
Correct Answer: Option B — Value-A Value-A
Detailed Academic Explanation:
Class B extended Class A therefore all methods of Class A will be available to class B except private methods. Class C extended Class A therefore all methods of Class A will be available to class C except private methods.
💡Key Conceptual Anchor:Overriding And Overloading
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the output for the below code? class A{ private void printName(){ System.out.println("Value-A"); } } class B extends A{ public void printName(){ System.out.println("Name-B"); } } public class Test{ public static void main (String[] args){ B b = new B(); b.printName(); } }
Correct Answer: Option B — Name-B
Detailed Academic Explanation:
You can not override private method , private method is not availabe in subclass . In this case printName() method a class A is not overriding by printName() method of class B. printName() method of class B different method. So you can call printName() method of class B.
💡Key Conceptual Anchor:Overriding And Overloading
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of method overloading in Java?
Correct Answer: Option D — 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 “What is the purpose of method overloading in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In method overriding, which keyword is used in the child class to indicate that a method is intended to override a superclass method?
Correct Answer: Option C — @Override
Detailed Academic Explanation:
@Override is the correct answer to “In method overriding, which keyword is used in the child class to indicate that a method is intended to override a superclass method”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What happens when a subclass tries to override a final method from the superclass in Java?
Correct Answer: Option B — It results in a compilation error
Detailed Academic Explanation:
It results in a compilation error is the correct answer to “What happens when a subclass tries to override a final method from the superclass in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In method overloading, what must be different between the overloaded methods in the same class?
Correct Answer: Option D — The number or type of parameters
Detailed Academic Explanation:
The number or type of parameters is the correct answer to “In method overloading, what must be different between the overloaded methods in the same class”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which method is called during method overriding in Java if the superclass method is invoked using the "super" keyword?
Correct Answer: Option A — The superclass method
Detailed Academic Explanation:
The superclass method is the correct answer to “Which method is called during method overriding in Java if the superclass method is invoked using the "super" keyword”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the following code snippet? class Parent { void display() { System.out.println("Parent"); } } class Child extends Parent { void display() { System.out.println("Child"); } } public class Main { public static void main(String[] args) { Parent obj = new Child(); obj.display(); } }
Correct Answer: Option C — Child
Detailed Academic Explanation:
Child is the correct answer to “What is the result of the following code snippet? class Parent { void display() { System.out.println("Parent"); } } class Child extends Parent { void display() { System.out.println("Child"); } } public class Main { public static void main(String[] args) { Parent obj = new Child(); obj.display(); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, what is the return type of a method that does not return any value?
Correct Answer: Option B — void
Detailed Academic Explanation:
void is the correct answer to “In Java, what is the return type of a method that does not return any value”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the difference between method overloading and method overriding in Java?
Correct Answer: Option C — Method overloading involves multiple methods with the same name in the same class, while method overriding involves redefining a superclass method in a subclass
Detailed Academic Explanation:
Method overloading involves multiple methods with the same name in the same class, while method overriding involves redefining a superclass method in a subclass is the correct answer to “What is the difference between method overloading and method overriding in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In method overriding, is it mandatory for the return type of the subclass method to be the same as the superclass method?
Correct Answer: Option A — Yes, it must be the same
Detailed Academic Explanation:
Yes, it must be the same is the correct answer to “In method overriding, is it mandatory for the return type of the subclass method to be the same as the superclass method”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the "super" keyword in method overriding?
Correct Answer: Option D — To call the superclass method
Detailed Academic Explanation:
To call the superclass method is the correct answer to “What is the purpose of the "super" keyword in method overriding”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the "@Override" annotation in Java?
Correct Answer: Option C — To indicate that a method is intended to override a superclass method
Detailed Academic Explanation:
To indicate that a method is intended to override a superclass method is the correct answer to “What is the purpose of the "@Override" annotation in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In method overloading, can methods have the same name and the same parameter types if their return types are different?
Correct Answer: Option C — No, it is not allowed
Detailed Academic Explanation:
No, it is not allowed is the correct answer to “In method overloading, can methods have the same name and the same parameter types if their return types are different”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Can a method be both overloaded and overridden in the same class in Java?
Correct Answer: Option A — Yes, as long as the method names are the same
Detailed Academic Explanation:
Yes, as long as the method names are the same is the correct answer to “Can a method be both overloaded and overridden in the same class in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In method overloading, can methods have the same name and the same return type if their parameter types are different?
Correct Answer: Option D — Yes, it is allowed
Detailed Academic Explanation:
Yes, it is allowed is the correct answer to “In method overloading, can methods have the same name and the same return type if their parameter types are different”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the "super" keyword in method overloading?
Correct Answer: Option C — To call the superclass constructor
Detailed Academic Explanation:
To call the superclass constructor is the correct answer to “What is the purpose of the "super" keyword in method overloading”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, can a method be overloaded by changing only the return type?
Correct Answer: Option D — No, the return type cannot be changed
Detailed Academic Explanation:
No, the return type cannot be changed is the correct answer to “In Java, can a method be overloaded by changing only the return type”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of method hiding in Java?
Correct Answer: Option A — Creating a static method with the same name as a superclass method
Detailed Academic Explanation:
Creating a static method with the same name as a superclass method is the correct answer to “What is the purpose of method hiding in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In method overriding, is it mandatory for the method name in the subclass to be the same as the method name in the superclass?
Correct Answer: Option D — Yes, it must be the same
Detailed Academic Explanation:
Yes, it must be the same is the correct answer to “In method overriding, is it mandatory for the method name in the subclass to be the same as the method name in the superclass”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What happens when a subclass tries to override a static method from the superclass in Java?
Correct Answer: Option C — It results in a compilation error
Detailed Academic Explanation:
It results in a compilation error is the correct answer to “What happens when a subclass tries to override a static method from the superclass in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In method overloading, can methods have the same name and the same parameter types if their access modifiers are different?
Correct Answer: Option B — No, it is not allowed
Detailed Academic Explanation:
No, it is not allowed is the correct answer to “In method overloading, can methods have the same name and the same parameter types if their access modifiers are different”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of method overriding in Java?
Correct Answer: Option C — Redefining a superclass method in a subclass to provide a specific implementation
Detailed Academic Explanation:
Redefining a superclass method in a subclass to provide a specific implementation is the correct answer to “What is the purpose of method overriding in Java”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In Java, can a subclass override a protected method from its superclass?
Correct Answer: Option D — Yes, as long as it's in the same package
Detailed Academic Explanation:
Yes, as long as it's in the same package is the correct answer to “In Java, can a subclass override a protected method from its superclass”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is output of the program? class Test{ public void display(int x, double y){ System.out.println(x+y); } public double display(int p, double q){ return (p+q); } public static void main(String args[]){ Test test = new Test(); test.display(4, 5.0); System.out.println(test.display(4, 5.0)); } }
Correct Answer: Option C — Compilation Error
Detailed Academic Explanation:
Compilation Error is the correct answer to “What is output of the program? class Test{ public void display(int x, double y){ System.out.println(x+y); } public double display(int p, double q){ return (p+q); } public static void main(String args[]){ Test test = new Test(); test.display(4, 5.0); System.out.println(test.display(4, 5.0)); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
what is the result of the following piece of code: public class Person{ public void talk(){ System.out.print("I am a Person"); } } public class Student extends Person{ public void talk(){ System.out.print("I am a Student"); } } public class Test{ public static void main(String args[]){ Person p = new Student(); p.talk(); } }
Correct Answer: Option B — I am a Student
Detailed Academic Explanation:
I am a Student is the correct answer to “what is the result of the following piece of code: public class Person{ public void talk(){ System.out.print("I am a Person"); } } public class Student extends Person{ public void talk(){ System.out.print("I am a Student"); } } public class Test{ public static void main(String args[]){ Person p = new Student(); p.talk(); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following program code? class Rectangle{ public int area(int length, int width){ return length*width; } } class Square extends Rectangle{ public int area(long length, long width){ return (int) Math.pow(length, 2); } } public class Test{ public static void main(String args[]){ Square r = new Square(); System.out.println(r.area(5 , 4)); } }
Correct Answer: Option B — Will compile and run printing out 20
Detailed Academic Explanation:
Will compile and run printing out 20 is the correct answer to “What will be the output of the following program code? class Rectangle{ public int area(int length, int width){ return length*width; } } class Square extends Rectangle{ public int area(long length, long width){ return (int) Math.pow(length, 2); } } public class Test{ public static void main(String args[]){ Square r = new Square(); System.out.println(r.area(5 , 4)); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
____________ method cannot be overridden.
Correct Answer: Option C — final
Detailed Academic Explanation:
final is the correct answer to “____________ method cannot be overridden.”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these keywords can be used to prevent Method overriding?
Correct Answer: Option D — final
Detailed Academic Explanation:
final is the correct answer to “Which of these keywords can be used to prevent Method overriding”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java program? final class A { int i; } class B extends A { int j; System.out.println(j + " " + i); } class inheritance { public static void main(String args[]) { B obj = new B(); obj.display(); } }
Correct Answer: Option D — Compilation Error
Detailed Academic Explanation:
Compilation Error is the correct answer to “What will be the output of the following Java program? final class A { int i; } class B extends A { int j; System.out.println(j + " " + i); } class inheritance { public static void main(String args[]) { B obj = new B(); obj.display(); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java program? class Alligator { public static void main(String[] args) { int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}}; int [][]y = x; System.out.println(y[2][1]); } }
Correct Answer: Option C — 7
Detailed Academic Explanation:
7 is the correct answer to “What will be the output of the following Java program? class Alligator { public static void main(String[] args) { int []x[] = {{1,2}, {3,4,5}, {6,7,8,9}}; int [][]y = x; System.out.println(y[2][1]); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class overload { int x; int y; void add(int a) { x = a + 1; } void add(int a , int b) { x = a + 2; } } class Overload_methods { public static void main(String args[]) { overload obj = new overload(); int a = 0; obj.add(6, 7); System.out.println(obj.x); } }
Correct Answer: Option C — 8
Detailed Academic Explanation:
8 is the correct answer to “What will be the output of the following Java code? class overload { int x; int y; void add(int a) { x = a + 1; } void add(int a , int b) { x = a + 2; } } class Overload_methods { public static void main(String args[]) { overload obj = new overload(); int a = 0; obj.add(6, 7); System.out.println(obj.x); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the process of defining a method in a subclass having same name & type signature as a method in its superclass?
Correct Answer: Option B — Method overriding
Detailed Academic Explanation:
Method overriding is the correct answer to “What is the process of defining a method in a subclass having same name & type signature as a method in its superclass”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class A { public void m1 (int i,float f) { System.out.println(" int float method"); } public void m1(float f,int i); { System.out.println("float int method"); } public static void main(String[]args) { A a=new A(); a.m1(20,20); } }
Correct Answer: Option C — compile time error
Detailed Academic Explanation:
compile time error is the correct answer to “What will be the output of the following Java code? class A { public void m1 (int i,float f) { System.out.println(" int float method"); } public void m1(float f,int i); { System.out.println("float int method"); } public static void main(String[]args) { A a=new A(); a.m1(20,20); } }”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?
Correct Answer: Option D — super()
Detailed Academic Explanation:
super() is the correct answer to “Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the process of defining two or more methods within same class that have same name but different parameters declaration?
Correct Answer: Option A — method overloading
Detailed Academic Explanation:
method overloading is the correct answer to “What is the process of defining two or more methods within same class that have same name but different parameters declaration”. This question is standard in competitive examination syllabi for Overriding And Overloading.
💡Key Conceptual Anchor:Overriding And Overloading
✓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.