Suppose the Polygon class has a method named area which is abstract. Which of th
ID: 3844302 • Letter: S
Question
Suppose the Polygon class has a method named area which is abstract. Which of the following statements must be true? I. Polygon must be made an abstract class. ll. The area method in Polygon must have no body. Ill. Polygon objects cannot be instantiated. IV. Any class derived from Polygon must override the area method if a programmer wants to instantiate objects of that class I only ll only Ill only IV only I and II only I and Ill only I and IV only II and Ill only ll and IV only Ill and IV only I, II, and Ill only I, II, and IV only I, III and IV only II, III, and IV only all of the statements are true none of the statements are trueExplanation / Answer
Ans N. II, III, IV only.
reason:
If a class has a abstarct method then it will bw either a Abstarct class or Interface.
And in both the cases we can't make instances for Abstract or Interface, so optin three is right.
now ,
Abstarct methods are just Blueprint ,they are not defined inside its parent class. so whenever we override these methods we must have to define it. hence option IV is right.
now As i say Abstract method has no body defined . it has only return type and ,its name and paramaters name. hence it justifies the option II.
Incase of Option I we cant say that this is a abstract class or Interface bcz both contains Abstract classes.
Interface is fully abstracted and Abstact class is partialyy abstracted.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.