11.
Which of the following is a static polymorphism mechanism?
a) Function overloading
b) Operator overloading
c) Templates
d) All of the mentioned
Answer: d
Explanation:
All the options mentioned above uses static polymorphism mechanism. As the conflicts in all these types of functions are resolved during compile-time.
12.
Which of the following is true?
I) All operators in C++ can be overloaded.
II) The basic meaning of an operator can be changed.
a) I only
b) II only
c) Both I and II
d) Neither I nor II
Answer: d
Explanation:
Both statements are false because all the operators of C++ cannot be overloaded and the basic meaning of an operator cannot be changed, we can only give new meaning to an operator.
13.
Which of the following is not a type of inheritance?
a) Multiple
b) Multilevel
c) Distributive
d) Hierarchical
Answer: c
Explanation:
Distributive is not a type of inheritance whereas others are a type of inheritance having their own meaning.
14.
What happens if a class does not have a name?
a) It will not have a constructor
b) It will not have a destructor
c) It is not allowed
d) It will neither have a constructor or destructor
Answer: b
Explanation:
A class without a name will not have a destructor. The object is made so constructor is required but the destructor is not. Check the code below:
#include <iostream>
using namespace std;
class
{
public:
void func()
{
cout<<“Hello world”;
}
}a;
int main(int argc, char const *argv[])
{
a.func();
return 0;
}
15.
Which of the following statement is true?
I) In Procedural programming languages, all function calls are resolved at compile-time
II) In Object Oriented programming languages, all function calls are resolved at compile-time
a) I only
b) II only
c) Both I and II
d) Neither I nor II
Answer: a
Explanation:
In Procedural programming like C we don’t have the concept of polymorphism, therefore, all the function calls are resolved at the compile-time but in case of OOP languages sue to polymorphism concept all function calls are not resolved at compile-time.