Skip to main content

Inheritence — Part 2 MCQs with Explanations

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
Question 1 of 35
★ FPSC ★ PPSC

Using which of the following, multiple inheritance in Java can be implemented?

Question 2 of 35
★ 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 */ } }

Question 3 of 35
★ FPSC ★ PPSC

Which of these method of Object class is used to obtain class of an object at run time?

Question 4 of 35
★ FPSC ★ PPSC

If a class inheriting an abstract class does not define all of its function then it will be known as?

Question 5 of 35
★ FPSC ★ PPSC

If super class and subclass have same variable name, which keyword should be used to use super class?

Question 6 of 35
★ FPSC ★ PPSC

A class member declared protected becomes a member of subclass of which type?

Question 7 of 35
★ FPSC ★ PPSC

Which of these method of Object class can clone an object?

Question 8 of 35
★ FPSC ★ PPSC

All classes in Java are inherited from which class?

Question 9 of 35
★ 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(); } }

Question 10 of 35
★ 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(); } }

Question 11 of 35
★ 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()); } }

Question 12 of 35
★ FPSC ★ PPSC

Which of the following is used for implementing inheritance through an interface?

Question 13 of 35
★ FPSC ★ PPSC

Which of these is correct way of inheriting class A by class B?

Question 14 of 35
★ 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) } }

Question 15 of 35
★ FPSC ★ PPSC

Which of these packages contains abstract keyword?

Question 16 of 35
★ FPSC ★ PPSC

Which of these class relies upon its subclasses for complete implementation of its methods?

Question 17 of 35
★ FPSC ★ PPSC

Which of these keywords can be used to prevent inheritance of a class?

Question 18 of 35
★ FPSC ★ PPSC

Static members are not inherited to subclass.

Question 19 of 35
★ FPSC ★ PPSC

Which of these keywords are used to define an abstract class?

Question 20 of 35
★ 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(); } }

Question 21 of 35
★ 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(); } }

Question 22 of 35
★ FPSC ★ PPSC

Which of these is not abstract?

Question 23 of 35
★ FPSC ★ PPSC

Does Java support multiple level inheritance?

Question 24 of 35
★ 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(); } }

Question 25 of 35
★ 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(); } }

Question 26 of 35
★ 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()); } }

Question 27 of 35
★ FPSC ★ PPSC

Which of this keyword must be used to inherit a class?

Question 28 of 35
★ FPSC ★ PPSC

Which of these class is superclass of every class in Java?

Question 29 of 35
★ FPSC ★ PPSC

Which of these keywords cannot be used for a class which has been declared final?

Question 30 of 35
★ 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)); } }

Question 31 of 35
★ 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.

Question 32 of 35
★ FPSC ★ PPSC

Which of the following is used for implementing inheritance through class?

Question 33 of 35
★ FPSC ★ PPSC

In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?

Question 34 of 35
★ FPSC ★ PPSC

What is not type of inheritance?

Question 35 of 35
★ 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) } }

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