Java Inheritance Interview MCQ Questions and Answers

Study and learn Interview MCQ Questions and Answers on Inheritance in Java. You can know about Multilevel and Multiple Inheritances. Attend job interviews easily with these Multiple Choice Questions. You can print these Questions in default mode to conduct exams directly. You can download these MCQs in PDF format by Choosing Print Option first and Save as PDF option next using any Web Browser.

Go through Java Theory Notes on Inheritance before reading these objective questions.



1) What are the features of an Object Oriented Programming (OOPs)?
A) Inheritance
B) Encapsulation
C) Polymorphism
D) All the above
Answer [=]
Answer[=]
2) What are the features reused using Inheritance in Java?
A) Methods
B) Variables
C) Constants
D) All the above
Answer [=]
Answer[=]
3) The class that is being inherited or subclassed is called ___.
A) Subclass
B) Superclass
C) -
D) -
Answer [=]
Answer[=]
4) The class that inherits an already defined class is called ___.
A) Subclass
B) Superclass
C) -
D) -
Answer [=]
Answer[=]
5) Java language supports ___ type of inheritance.
A) Multiple Inheritance
B) Multi-Level Inheritance
C) -
D) -
Answer [=]
Answer[=]
6) You should use Inheritance when there is an IS-A relationship between classes. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
7) What are the types of Inheritances (Whether Java supports or not) available in Object-Oriented Programming Languages?
A) Single Inheritance
B) Multi-Level Inheritance, Hierarchical Inheritance
C) Multiple Inheritance, Hybrid Inheritance
D) All the above
Answer [=]
Answer[=]


 

8) In a Single inheritance, Class B inherits only from Class A. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
9) In a Multi Level Inheritance Class-C inherits from Class-B and Class-B inherits from Class-A. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
10) In a Multi-Level Inheritance in Java, the last subclass inherits methods and properties of ____.
A) Only one immediate Superclass
B) Few classes above it.
C) All classes above it
D) None
Answer [=]
Answer[=]
11) When a Class inherits two superclasses (not in Java), it is called ____ inheritance.
A) Multilevel inheritance
B) Single Inheritance
C) Multiple Inheritance
D) None
Answer [=]
Answer[=]
12) A Subclass can become a Superclass to another class extending from it in Java. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
13) You can not inherit a Superclass'es constructor even after using inheritance in Java. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
14) Find Superclass and Subclass in the below Java code snippet?
class B
{
  void show(){}
}
class A
{
  void hide(){}
}
A) B is superclass and A is subclass.
B) A is superclass and B is a subclass.
C) There is no superclass or subclass present.
D) None
Answer [=]
Answer[=]


 

15) Find Superclass and Subclass in the below Java program?
class Liquid
{
  void pour(){}
}
class Juice extends Liquid
{
  void filter(){}
}
A) The Liquid is a superclass and Juice is a subclass.
B) The Liquid is a Subclass and Juice is a Superclass.
C) There is no superclass or subclass
D) None
Answer [=]
Answer[=]
16) Which is the keyword used to implement inheritance in Java?
A) extends
B) implements
C) instanceof
D) None
Answer [=]
Answer[=]
17) What is the output of the below Java program with inheritance?
class Sweet
{
  void price()
  {
    System.out.print("Sweet=$10 ");
  }
}
class Sugar extends Sweet
{
  void price()
  {
    super.price();
    System.out.print("Sugar=$20");
  }
}
public class JavaInheritance1
{
  public static void main(String[] args)
  {
    Sugar su = new Sugar();
    su.price();
  }
}
A) Sweet=$10 Sugar=$20
B) Sweet=$10 Sugar=$10
C) Sweet=$20 Sugar=$20
D) Compiler error
Answer [=]
Answer[=]
18) Can you call it a full-fledged inheritance of using ABSTRACT classes and INTERFACES in Java?
A) NO
B) YES
C) -
D) -
Answer [=]
Answer[=]
19) To control inheritance to different classes and levels, Java provides ____.
A) Return types like the void, int, float, double and other object types
B) Static keyword
C) Access modifiers like default, public, protected, private
D) None
Answer [=]
Answer[=]
20) To stop or block inheriting a given class, the ___ keyword is used before the class.
A) static
B) private
C) final
D) none of the above
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad

 

Try Some Java Books

Book Price
1. Java - The Complete Reference  Check Price
2. Core Java: An Integrated Approach, Black Book Check Price
3. Java All-in-One for Dummies Check Price
4. OCP Java SE 8: Programmer II Check Price
5. Programming with Java Check Price
6. Head First Java Check Price

We may get some affiliate commission for the above purchases.