Question
abstract class student
{
public : int marks;
calc_grade();
}
class topper:public student
{
public : calc_grade()
{
return 10;
}
};
class average:public student
{
public : calc_grade()
{
return 20;
}
};
class failed{ int marks; };
a.
Only class student can show polymorphism
b.
Only class student and topper together can show polymorphism
c.
All class student, topper and average together can show polymorphism
d.
Class failed should also inherit class student for this code to work for polymorphism
Posted under Object Oriented Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Which class/set of classes can illustrate polymorphism in the following code:
Similar Questions
Discover Related MCQs
Q. Which type of function among the following shows polymorphism?
View solution
Q. In case of using abstract class or function overloading, which function is supposed to be called first?
View solution
Q. Which among the following can’t be used for polymorphism?
View solution
Q. Which among the following can show polymorphism?
View solution
Q. Polymorphism is possible in C language.
View solution
Q. Which problem may arise if we use abstract class functions for polymorphism?
View solution
Q. Which among the following is not true for polymorphism?
View solution
Q. If 2 classes derive one base class and redefine a function of base class, also overload some operators inside class body. Among these two things of function and operator overloading, where is polymorphism used?
View solution
Q. Which among the following best describes encapsulation?
View solution
Q. If data members are private, what can we do to access them from the class object?
View solution
Q. While using encapsulation, which among the following is possible?
View solution
Q. Which feature can be implemented using encapsulation?
View solution
Q. Find which of the following uses encapsulation?
View solution
Q. Encapsulation helps in writing ___________ classes in java
View solution
Q. Which among the following should be encapsulated?
View solution
Q. How can Encapsulation be achieved?
View solution
Q. Which among the following violates the principle of encapsulation almost always?
View solution
Q. Which among the following would destroy the encapsulation mechanism if it was allowed in programming?
View solution
Q. Which among the following can be a concept against encapsulation rules?
View solution
Q. Encapsulation is the way to add functions in a user defined structure.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!