Questions and Answers
- What is meant by type_info?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
Used to hold the type information returned by the typeid operator
- Which interface in the container is required for storage management?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Memory interface
- How many sets of requirements are need in designing a container?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: B
There are three sets of requirements. They are container interface requirements, Allocator interface requirements and iterator requirements.
- What is the output of this program?
#include <iostream>
using namespace std;
struct N
{
virtual void fun()
{
cout << "Class N" << endl;
}
};
struct M : N
{
virtual void fun()
{
cout << "Class M" << endl;
}
};
struct O : N
{
virtual void fun()
{
cout << "Class O" << endl;
}
};
void fun(N* argumnet)
{
M* ptr1 = dynamic_cast<M*>(argumnet);
O* ptr2 = dynamic_cast<O*>(argumnet);
if (ptr1)
ptr1 -> fun();
else if (ptr2)
ptr2 -> fun();
else
argumnet -> fun();
};
int main()
{
N Object1;
O Object2;
N* ptr1 = &Object2;
N* ptr3 = &Object1;
fun(ptr1);
fun(ptr3);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: E
In this program, We applied the dynamic casting to structure and produced the output.
- What is meant by garbage collection?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
The garbage collection attempts to reclaim memory occupied by objects that are no longer in use by the program.