Practice high-yield Programming & Software Development MCQs on Inheritence — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
35
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
42 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
35
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/35 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 35 questions answered.
Question 1 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Using which of the following, multiple inheritance in Java can be implemented?
Correct Answer: Option A — Interfaces
Detailed Academic Explanation:
Interfaces is the correct answer to “Using which of the following, multiple inheritance in Java can be implemented”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 2 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which two classes use the Shape class correctly? A. public class Circle implements Shape { private int radius; } B. public abstract class Circle extends Shape { private int radius; } C. public class Circle extends Shape { private int radius; public void draw(); } D. public abstract class Circle implements Shape { private int radius; public void draw(); } E. public class Circle extends Shape { private int radius; public void draw() { /* code here */ } } F. public abstract class Circle implements Shape { private int radius; public void draw() { /* code here */ } }
Correct Answer: Option A — B,E
Detailed Academic Explanation:
B,E is the correct answer to “Which two classes use the Shape class correctly? A. public class Circle implements Shape { private int radius; } B. public abstract class Circle extends Shape { private int radius; } C. public class Circle extends Shape { private int radius; public void draw(); } D. public abstract class Circle implements Shape { private int radius; public void draw(); } E. public class Circle extends Shape { private int radius; public void draw() { /* code here */ } } F. public abstract class Circle implements Shape { private int radius; public void draw() { /* code here */ } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 3 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these method of Object class is used to obtain class of an object at run time?
Correct Answer: Option C — Class getclass()
Detailed Academic Explanation:
Class getclass() is the correct answer to “Which of these method of Object class is used to obtain class of an object at run time”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 4 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If a class inheriting an abstract class does not define all of its function then it will be known as?
Correct Answer: Option A — Abstract
Detailed Academic Explanation:
Abstract is the correct answer to “If a class inheriting an abstract class does not define all of its function then it will be known as”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 5 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
If super class and subclass have same variable name, which keyword should be used to use super class?
Correct Answer: Option A — super
Detailed Academic Explanation:
super is the correct answer to “If super class and subclass have same variable name, which keyword should be used to use super class”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 6 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
A class member declared protected becomes a member of subclass of which type?
Correct Answer: Option B — private member
Detailed Academic Explanation:
private member is the correct answer to “A class member declared protected becomes a member of subclass of which type”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 7 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these method of Object class can clone an object?
Correct Answer: Option C — Object clone()
Detailed Academic Explanation:
Object clone() is the correct answer to “Which of these method of Object class can clone an object”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 8 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
All classes in Java are inherited from which class?
Correct Answer: Option D — java.lang.Object
Detailed Academic Explanation:
java.lang.Object is the correct answer to “All classes in Java are inherited from which class”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 9 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java program? abstract class A { int i; abstract void display(); } class B extends A { int j; void display() { System.out.println(j); } } class Abstract_demo { public static void main(String args[]) { B obj = new B(); obj.j=2; obj.display(); } }
Correct Answer: Option B — 2
Detailed Academic Explanation:
2 is the correct answer to “What will be the output of the following Java program? abstract class A { int i; abstract void display(); } class B extends A { int j; void display() { System.out.println(j); } } class Abstract_demo { public static void main(String args[]) { B obj = new B(); obj.j=2; obj.display(); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 10 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class A { int i; void display() { System.out.println(i); } } class B extends A { int j; void display() { System.out.println(j); } } class method_overriding { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }
Correct Answer: Option C — 2
Detailed Academic Explanation:
2 is the correct answer to “What will be the output of the following Java code? class A { int i; void display() { System.out.println(i); } } class B extends A { int j; void display() { System.out.println(j); } } class method_overriding { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 11 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class Output { public static void main(String args[]) { Object obj = new Object(); System.out.print(obj.getclass()); } }
Correct Answer: Option C — class java.lang.Object
Detailed Academic Explanation:
class java.lang.Object is the correct answer to “What will be the output of the following Java code? class Output { public static void main(String args[]) { Object obj = new Object(); System.out.print(obj.getclass()); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 12 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is used for implementing inheritance through an interface?
Correct Answer: Option D — implements
Detailed Academic Explanation:
implements is the correct answer to “Which of the following is used for implementing inheritance through an interface”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 13 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these is correct way of inheriting class A by class B?
Correct Answer: Option C — class B extends A {}
Detailed Academic Explanation:
class B extends A {} is the correct answer to “Which of these is correct way of inheriting class A by class B”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 14 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java program? class A { public int i; public int j; A() { i = 1; j = 2; } } class B extends A { int a; B() { super(); } } class super_use { public static void main(String args[]) { B obj = new B(); System.out.println(obj.i + " " + obj.j) } }
Correct Answer: Option A — 1 2
Detailed Academic Explanation:
1 2 is the correct answer to “What will be the output of the following Java program? class A { public int i; public int j; A() { i = 1; j = 2; } } class B extends A { int a; B() { super(); } } class super_use { public static void main(String args[]) { B obj = new B(); System.out.println(obj.i + " " + obj.j) } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 15 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these packages contains abstract keyword?
Correct Answer: Option A — java.lang
Detailed Academic Explanation:
java.lang is the correct answer to “Which of these packages contains abstract keyword”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 16 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these class relies upon its subclasses for complete implementation of its methods?
Correct Answer: Option B — abstract class
Detailed Academic Explanation:
abstract class is the correct answer to “Which of these class relies upon its subclasses for complete implementation of its methods”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 17 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these keywords can be used to prevent inheritance of a class?
Correct Answer: Option D — final
Detailed Academic Explanation:
final is the correct answer to “Which of these keywords can be used to prevent inheritance of a class”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 18 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Static members are not inherited to subclass.
Correct Answer: Option B — False
Detailed Academic Explanation:
False is the correct answer to “Static members are not inherited to subclass.”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 19 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these keywords are used to define an abstract class?
Correct Answer: Option B — abstract
Detailed Academic Explanation:
abstract is the correct answer to “Which of these keywords are used to define an abstract class”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 20 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java program? class A { int i; void display() { System.out.println(i); } } class B extends A { int j; void display() { System.out.println(j); } } class inheritance_demo { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }
Correct Answer: Option C — 2
Detailed Academic Explanation:
2 is the correct answer to “What will be the output of the following Java program? class A { int i; void display() { System.out.println(i); } } class B extends A { int j; void display() { System.out.println(j); } } class inheritance_demo { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 21 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java program? class A { int i; } class B extends A { int j; void display() { super.i = j + 1; System.out.println(j + " " + i); } } class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }
Correct Answer: Option C — 2 3
Detailed Academic Explanation:
2 3 is the correct answer to “What will be the output of the following Java program? class A { int i; } class B extends A { int j; void display() { super.i = j + 1; System.out.println(j + " " + i); } } class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 22 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these is not abstract?
Correct Answer: Option A — Thread
Detailed Academic Explanation:
Thread is the correct answer to “Which of these is not abstract”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 23 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Does Java support multiple level inheritance?
Correct Answer: Option A — True
Detailed Academic Explanation:
True is the correct answer to “Does Java support multiple level inheritance”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 24 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class A { public int i; private int j; } class B extends A { void display() { super.j = super.i + 1; System.out.println(super.i + " " + super.j); } } class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; 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 code? class A { public int i; private int j; } class B extends A { void display() { super.j = super.i + 1; System.out.println(super.i + " " + super.j); } } class inheritance { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 25 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class A { public int i; protected int j; } class B extends A { int j; void display() { super.j = 3; System.out.println(i + " " + j); } } class Output { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }
Correct Answer: Option A — 1 2
Detailed Academic Explanation:
1 2 is the correct answer to “What will be the output of the following Java code? class A { public int i; protected int j; } class B extends A { int j; void display() { super.j = 3; System.out.println(i + " " + j); } } class Output { public static void main(String args[]) { B obj = new B(); obj.i=1; obj.j=2; obj.display(); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 26 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); System.out.print(obj1.toString()); } }
Correct Answer: Option C — String associated with obj1
Detailed Academic Explanation:
String associated with obj1 is the correct answer to “What will be the output of the following Java code? class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); System.out.print(obj1.toString()); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 27 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of this keyword must be used to inherit a class?
Correct Answer: Option D — extends
Detailed Academic Explanation:
extends is the correct answer to “Which of this keyword must be used to inherit a class”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 28 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these class is superclass of every class in Java?
Correct Answer: Option B — Object class
Detailed Academic Explanation:
Object class is the correct answer to “Which of these class is superclass of every class in Java”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 29 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of these keywords cannot be used for a class which has been declared final?
Correct Answer: Option A — abstract
Detailed Academic Explanation:
abstract is the correct answer to “Which of these keywords cannot be used for a class which has been declared final”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 30 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java program? class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); A obj2 = new A(); System.out.print(obj1.equals(obj2)); } }
Correct Answer: Option A — false
Detailed Academic Explanation:
false is the correct answer to “What will be the output of the following Java program? class A { int i; int j; A() { i = 1; j = 2; } } class Output { public static void main(String args[]) { A obj1 = new A(); A obj2 = new A(); System.out.print(obj1.equals(obj2)); } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 31 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What would be the result if a class extends two interfaces and both have a method with same name and signature? Lets assume that the class is not implementing that method.
Correct Answer: Option B — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What would be the result if a class extends two interfaces and both have a method with same name and signature? Lets assume that the class is not implementing that method.”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 32 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is used for implementing inheritance through class?
Correct Answer: Option C — extends
Detailed Academic Explanation:
extends is the correct answer to “Which of the following is used for implementing inheritance through class”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 33 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?
Correct Answer: Option B — Private
Detailed Academic Explanation:
Private is the correct answer to “In order to restrict a variable of a class from inheriting to subclass, how variable should be declared”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 34 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is not type of inheritance?
Correct Answer: Option B — Double inheritance
Detailed Academic Explanation:
Double inheritance is the correct answer to “What is not type of inheritance”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
Question 35 of 35
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following Java code? class A { public int i; public int j; A() { i = 1; j = 2; } } class B extends A { int a; B() { super(); } } class super_use { public static void main(String args[]) { B obj = new B(); System.out.println(obj.i + " " + obj.j) } }
Correct Answer: Option A — 1 2
Detailed Academic Explanation:
1 2 is the correct answer to “What will be the output of the following Java code? class A { public int i; public int j; A() { i = 1; j = 2; } } class B extends A { int a; B() { super(); } } class super_use { public static void main(String args[]) { B obj = new B(); System.out.println(obj.i + " " + obj.j) } }”. This question is standard in competitive examination syllabi for Inheritence.
💡Key Conceptual Anchor:Inheritence
✓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.