Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
void test(int x)
4.
{
5.
try
6.
{
7.
if (x > 0)
8.
throw x;
9.
else
10.
throw 'x';
11.
}
12.
catch(int x)
13.
{
14.
cout
Options:
A .  integer:10character:x
B .  integer:10
C .  character:x
D .  none of the mentioned
Answer: Option A

We are passing the integer and character and catching it by using multiple catch statement.
Output:
$ g++ gex3.cpp
$ a.out
integer:10character:x



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers