Java Abstract Class Interview MCQ Questions and Answers

Study and learn Interview MCQ Questions and Answers on Abstract Class in Java. 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 Abstract Classes before reading these objective questions.



1) An abstract class in Java can be created using the keyword ____.
A) final
B) interface
C) abstract
D) static
Answer [=]
Answer[=]
2) To create an Abstract class, the keyword "class" is also required. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
3) Can you create an object from an abstract class in Java?
A) Yes
B) No
C) -
D) -
Answer [=]
Answer[=]
4) Which is the opposite of an Abstract Class?
A) Interface
B) concrete class
C) -
D) -
Answer [=]
Answer[=]
5) Choose a correct implementation of an Abstract class in the below Java code?
A)
abstract class ClassA { }
B)
abstract class ClassB
{
  abstract void method();
}
C)
abstract class ClassC
{
  void method()
  {
    System.out.print("Hello Abstract Class");
  }
}
D) All the above
Answer [=]
Answer[=]
6) An abstract class in Java usually contains one or more abstract ____.
A) constructors
B) methods
C) variables
D) None
Answer [=]
Answer[=]
7) Does the below Java code with abstract method compile?
class Puppy
{
  abstract void showName();
}
A) NO
B) YES
C) -
D) -
Answer [=]
Answer[=]


 

8) What is the output of the below Java program with an abstract class?
abstract class Coffee
{
  Coffee()
  {
    System.out.println("Inside Constructor of Coffee..");
  }
}
class ColdCoffee extends Coffee
{
  ColdCoffee()
  {
    System.out.println("Inside Constructor of ColdCoffee..");
  }
}
public class AbstractClassTesting
{
  public static void main(String[] args)
  {
    ColdCoffee cf = new ColdCoffee();
  }
}
A) Compiler error
B)
Inside Constructor of Coffee..
Inside Constructor of ColdCoffee..
C)
Inside Constructor of ColdCoffee..
D)
Inside Constructor of Coffee..
Answer [=]
Answer[=]
9) What is the output of the below Java program with an abstract class?
final abstract class Bell
{  }
class DoorBell extends Bell
{
  DoorBell()
  {
    System.out.println("DoorBell ringing..");
  }
}
public class AbstractClassTesting2
{
  public static void main(String[] args)
  {
    Bell bell = new DoorBell();
  }
}
A) DoorBell ringing..
B) No output
C) Compiler error
D) None of the above
Answer [=]
Answer[=]
10) What is the output of the below Java program with an abstract class?
abstract class MathLibrary
{
  static final float PI = 3.1415f;
}

public class AbstractClassTesting3
{
  public static void main(String[] args)
  {
    System.out.println(MathLibrary.PI);
  }
}
A) No output
B) Compiler error
C) 3.1415
D) None of the above
Answer [=]
Answer[=]
11) What is the output of the below Java program with multiple abstract classes?
abstract class Editor
{
  abstract void show();
}

abstract class Author extends Editor
{
  abstract void print();
}

class Office extends Author
{
  void show()
  {
    System.out.println("Editor method");
  }
  void print()
  {
    System.out.println("Author method");
  }
}

public class AbstractClassTesting4
{
  public static void main(String[] args)
  {
    Editor ed = new Office();
    ed.show();

    Author au = new Office();
    au.print();	
  }
}
A)
Editor method
Editor method
B)
Author method
Author method
C)
Editor method
Author method
D) Compiler error
Answer [=]
Answer[=]
12) An object of multi-level inherited abstract class can not be created in memory? State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
13) An abstract class with 100% abstract methods is equivalent to ______.
A) Concrete class
B) Virtual Class
C) Interface
D) All the above
Answer [=]
Answer[=]
14) What is the output of the below Java program with an abstract class?
public abstract class AbstractClassTest5
{
  public static void main(String[] args)
  {
    System.out.println("Inside Main() method..");
  }
}
A) No output
B) Compiler error
C) Inside Main() method..
D) None of the above
Answer [=]
Answer[=]


 

15) What is the output of the below Java code with an abstract class and inner class?
public abstract class AbstractClassTest6
{
  class Anonymous
  {
    int a=5;
  }
  public static void main(String args[])
  {
    System.out.print("Inner class is present..");	
  }	
}
A) Compiler error
B) Inner class is present..
C) No output
D) None of the above
Answer [=]
Answer[=]
16) Choose a correct statement about abstract classes?
A) An abstract class can extend a concrete class
B) An abstract class can extend another abstract class
C) An abstract class can implement any number of interfaces.
D) All the above.
Answer [=]
Answer[=]
17) Choose correct statements about an Abstract class in Java?
A) An abstract class implementing an Interface, need not implement methods of an interface
B) An abstract class extending another abstract class, need not define methods of the super abstract class.
C) The first subclass of an abstract class should define all the abstract methods inherited from all the interfaces and super abstract classes.
D) All the above
Answer [=]
Answer[=]
18) Just like an Interface, you can define constants in abstract classes in Java. State TRUE or FALSE.
A) TRUE
B) FALSE
C) -
D) -
Answer [=]
Answer[=]
19) Abstract classes support ____ inheritance.
A) Multiple
B) Multilevel
C) -
D) -
Answer [=]
Answer[=]
20) An abstract class can define ____ inside of it.
A) Inner abstract class
B) Inner concrete class
C) static methods
D) All 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.