MCQ Single Best Answer Easy

QWhat do we say when a class B can extend another class A?

ID: #4994 Javascript Classes MCQ 166 views
Question Info
#4994Q ID
EasyDifficulty
Javascript Classes MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A A is the superclass and B is the subclass
  • B B is the superclass and A is the subclass
  • C Both A and B are the superclass
  • D Both A and B are the subclass
Correct Answer: Option A

Explanation

In object-oriented programming, a subclass is a class that is derived from another class, called the superclass. The subclass inherits properties and methods from the superclass and can also have additional properties and methods of its own.
The subclass is also called an extension of the superclass, because it extends the functionality of the superclass with additional features.

For example, consider the following class hierarchy:
class A {
// Properties and methods of class A
}

class B extends A {
// Properties and methods of class B
}

Here, A is the superclass and B is the subclass. B is derived from A and inherits all of the properties and methods of A. B can also have additional properties and methods of its own.

In this example, A is the superclass and B is the subclass. In the scenario you described, A would also be the superclass and B would be the subclass.

Share This Question

Challenge a friend or share with your study group.