Abstract Classes In Java: Trivia Quiz!

10 Questions | Total Attempts: 530

SettingsSettingsSettings
Please wait...
Abstract Classes In Java: Trivia Quiz!

.


Questions and Answers
  • 1. 
    What is an abstract class?
    • A. 

      An abstract class is one without any child classes.

    • B. 

      An abstract class is any parent class with more than one child class

    • C. 

      An abstract class is a class which has at least one abstract method which cannot be instantiated.

    • D. 

      Is a "base class"

  • 2. 
    What is an abstract method?
    • A. 

      Is any method in an abstract class

    • B. 

      Is a method which cannot be inherited

    • C. 

      A method which is not implemented. The implementation for this method needs to be done in a non abstract class which extends this class.

    • D. 

      Is a method in the child class that overrids a parent method

  • 3. 
    Can an abstract class define both abstract methods and non-abstract methods?
    • A. 

      Yes - the child classes will inherit both

    • B. 

      Yes - but the child classes do not inherit the abstract methods

    • C. 

      No--it must have all abstract methods

    • D. 

      No--it must have all one or the other

  • 4. 
    Does a subclass that extends an abstract class have to give implementation to all the abstract methods of the superclass?
    • A. 

      Not necessarily if the sub class is going to be declared abstract

    • B. 

      Yes-an abstract parent must have abstract children

    • C. 

      No--an abstract parent mu have no children at all

    • D. 

      Yes --all children of an abstract parent must be non-abstract

  • 5. 
    What is an interface?
    • A. 

      A class with at least one abstract methods

    • B. 

      A collection of abstract methods and constants

    • C. 

      A super class with abstract method

    • D. 

      A sub class with abstract method

  • 6. 
    What is Polymorphism in Java?
    • A. 

      An object which has abstract method

    • B. 

      Multiple inheritance - polymorphism

    • C. 

      Hiding under a different name

    • D. 

      The feature of deciding which overridden method will be used at the run time of a prgram

  • 7. 
    In order for the following code to be correct, what must be the type of the reference variable card? ____________________ card; card=new Valentine("Joe",14); card=new Holiday("Bob"); card=new Birthday("Emily",12);
    • A. 

      Valentine

    • B. 

      Holilday

    • C. 

      Birthday

    • D. 

      Card

  • 8. 
    Dynamic Binding or Late Binding is:
    • A. 

      Connecting the method and the parameters

    • B. 

      Because of overridden method and the use of the appropriate method during execution

    • C. 

      Because of overloaded methods

    • D. 

      When formal parameters and actual parameters differ

  • 9. 
    What determines what method is run in the following?Card crd=new Birthday("Lucinda",42);crd.greeting();
    • A. 

      The reference type of the object reference variable

    • B. 

      The type of the object

    • C. 

      The type of the class

    • D. 

      The Type of the constructors

  • 10. 
    Interfaces can contain _________________ and _____________________ and abstract classes can contain _____________________ ,  ______________________and at least ___  ____________________________________   __________________
    • A. 

      Variables, constants,abstract methods and non abstract methods

    • B. 

      Abstract methods,constants,instance variables, implemented methods and one abstract method

    • C. 

      Constants, implemented methods, variables, abstract methods, overridden methods