Question
#include <iostream>
using namespace std;
class stu
{
protected:
int rno;
public:
void get_no(int a)
{
rno = a;
}
void put_no(void)
{
}
};
class test:public stu
{
protected:
float part1,part2;
public:
void get_mark(float x, float y)
{
part1 = x;
part2 = y;
}
void put_marks()
{
}
};
class sports
{
protected:
float score;
public:
void getscore(float s)
{
score = s;
}
void putscore(void)
{
}
};
class result: public test, public sports
{
float total;
public:
void display(void);
};
void result::display(void)
{
total = part1 + part2 + score;
put_no();
put_marks();
putscore();
cout << "Total Score=" << total << "\n";
}
int main()
{
result stu;
stu.get_no(123);
stu.get_mark(27.5, 33.0);
stu.getscore(6.0);
stu.display();
return 0;
}
a.
66.5
b.
64.5
c.
62.5
d.
60.5
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program?
Similar Questions
Discover Related MCQs
Q. What is meant by containership?
View solution
Q. How many types of constructor are there in C++?
View solution
Q. How many constructors can present in a class?
View solution
Q. What should be the name of constructor?
View solution
Q. What does derived class does not inherit from the base class?
View solution
Q. What is a template?
View solution
Q. Pick out the correct statement about string template.
View solution
Q. How to declare a template?
View solution
Q. How many types of templates are there in c++?
View solution
Q. Which are done by compiler for templates?
View solution
Q. What may be the name of the parameter that the template should take?
View solution
Q. How many parameters are legal for non-type template?
View solution
Q. What is a function template?
View solution
Q. Which is used to describe the function using placeholder types?
View solution
Q. Pick out the correct statement.
View solution
Q. What can be passed by non-type template parameters during compile time?
View solution
Q. From where does the template class derived?
View solution
Q. What is meant by template parameter?
View solution
Q. Which keyword can be used in template?
View solution
Q. What is the validity of template parameters?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? 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!