Loading

Q1.

Which of the following types of inheritance is directly supported by Java classes?

A. Multiple inheritance

B. Single inheritance

C. Hybrid inheritance

D. None of the above

Q2.

What is the main reason Java does not support multiple inheritance with classes?

A. To simplify syntax

B. To avoid memory leaks

C. To prevent ambiguity caused by the diamond problem

D. Because of runtime errors

Q3.

 Which type of inheritance is shown below?


class A { }

class B extends A { }

class C extends B { }

A. Single inheritance

B. Multiple inheritance

C. Hierarchical inheritance

D. Multilevel inheritance


Q4.

In hierarchical inheritance, which of the following is true?

A. A single class is inherited by multiple classes

B. Multiple classes inherit from multiple classes

C. Only interfaces can be used

D. Java does not allow it

Q5.

How is hybrid inheritance implemented in Java?

A. Using multiple extends keywords

B. Using both classes and interfaces together

C. Using only abstract classes

D. Java does not allow hybrid inheritance at all