Question 1 of 25
Hints left: 3
Q1
What is meant by multiple inheritance?
Q2
Which type of polymorphism is achieved by function overriding in C++?
Q3
What is the order of Destructors call when the object of derived class B is declared, provided class B is derived from class A?
Q4
Which type of polymorphism is achieved by function overloading in C++?
Q5
The concept of deciding which function to invoke during runtime is called . . . . . . . .
Q6
What happens if a virtual function is not overridden in the derived class in C++?
Q7
How is polymorphism implemented in C++?
Q8
What are the things are inherited from the base class?
Q9
What will be the output of the following C++ code? #include <iostream> using namespace std; class polygon { protected: int width, height; public: void set_values (int a, int b) { width = a; height = b;} }; class output1 { public: void output (int i); }; void output1::output (int i) { cout << i << endl; } class rectangle: public polygon, public output1 { public: int area () { return (width * height); } }; class triangle: public polygon, public output1 { public: int area () { return (width * height / 2); } }; int main () { rectangle rect; triangle trgl; rect.set_values (4, 5); trgl.set_values (4, 5); rect.output (rect.area()); trgl.output (trgl.area()); return 0; }
Q10
Which keyword is used to achieve runtime polymorphism in C++?
Q11
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; class Mammal { public: virtual void Define(){ cout<<"I'm a Mammal\n"; } }; class Human: public Mammal { public: void Define(){ cout<<"I'm a Human\n"; } }; class Male: public Human { public: void Define(){ cout<<"I'm a Male\n"; } }; class Female: public Human { public: void Define(){ cout<<"I'm a Female\n"; } }; int main(int argc, char const *argv[]) { Mammal *M; Male m; Female f; *M = m; M->Define(); return 0; }
Q12
What is dynamic polymorphism in C++?
Q13
In C++, can a derived class have its own definition of a function that is already defined in the base class?
Q14
Which symbol is used to create multiple inheritances?
Q15
What is function overloading in C++?
Q16
Which type of inheritance is necessary for achieving polymorphism in C++?
Q17
What is the order of Constructors call when the object of derived class B is declared, provided class B is derived from class A?
Q18
If a class is derived privately from a base class then . . . . . . . .
Q19
What is the use of the 'virtual' keyword in C++?
Q20
What is polymorphism in C++?
Q21
Virtual functions in C++ tells the compiler to perform . . . . . . . . on such functions.
Q22
What is the role of a virtual destructor in C++?
Q23
How many specifiers are used to derive a class?
Q24
What will be the output of the following C++ code? #include <iostream> #include <string> using namespace std; class A { int a, b; float d; public: void change(int i){ a = i; } void value_of_a(){ cout<<a; } }; class B: private A { }; int main(int argc, char const *argv[]) { B b; cout<<sizeof(B); return 0; }
Q25
Which concept of OOPs is shown by Virtual Functions?