Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
#include
4.
using namespace std;
5.
class Test1
6.
{
7.
virtual int Funct()
8.
{
9.
}
10.
};
11.
int main ()
12.
{
13.
try
14.
{
15.
Test1 * var = NULL;
16.
typeid (*var);
17.
}
18.
catch (std::exception& typevar)
19.
{
20.
cout
Options:
A .  NULL
B .  Exception:bad_alloc
C .  Exception:std:bad_typeid
D .  none of the mentioned
Answer: Option C

As we are using a bad type on pointers, So it is arising an error.
Output:
$ g++ exs1.cpp
$ a.out
Exception:std:bad_typeid



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers