Test Series - java

Test Number 60/64

Q: What are the features of an Object Oriented Programming (OOPs)?
A. Inheritance
B. Encapsulation
C. Polymorphism
D. All the above
Solution: -
Q: What are the features reused using Inheritance in Java?
A. Methods
B. Variables
C. Constants
D. All the above
Solution: Variables and Methods are reused through inheritance. Constants are nothing but variables only if they hold some value. 
Q: The class that is being inherited or subclassed is called ___.
A. Subclass
B. Superclass
C. -
D. -
Solution: Superclass or Super-Class
Q: The class that inherits an already defined class is called ___.
A. Subclass
B. Superclass
C. -
D. -
Solution: Subclass
Q: Java language supports ___ type of inheritance.
A. Multiple Inheritance
B. Multi-Level Inheritance
C. -
D. -
Solution: Multi-Level Inheritance is somewhat complicated.
Q: You should use Inheritance when there is an IS-A relationship between classes. State TRUE or FALSE.
A. TRUE
B. FALSE
C. -
D. -
Solution: Yes. One simple example is ANIMAL Superclass and HORSE Subclass. HORSE is-a/is-an ANIMAL.
Q: 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
Solution: Java supports extending from only one Superclass. Multilevel inheritance is completely supported by Java. Whereas Multiple and Hybrid inheritances are based on Multiple-Superlclasses scenario and hence not supported by Java.
Q: In a Single inheritance, Class B inherits only from Class A. State TRUE or FALSE.
A. TRUE
B. FALSE
C. -
D. -
Solution: True.
Q: 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. -
Solution: -
Q: 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
Solution: Yes. The last class inherits all of the properties and methods of all of the classes above it in the chain.

You Have Score    /10