Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
void PrintSequence(int StopNum)
4.
{
5.
int Num;
6.
Num = 1;
7.
while (true)
8.
{
9.
if (Num >= StopNum)
10.
throw Num;
11.
cout
Options:
A .  Exceptions are not suitable for critical points in code.
B .  Exception are suitable for critical points in code.
C .  Both a & b
D .  none of the mentioned
Answer: Option A

Answer:c
Explanation:In this program, We are printing one and raising a exception at 2.
Output:
$ g++ gex4.cpp
$ a.out
1
exception: 2



Was this answer helpful ?
Next Question

Submit Solution

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

Latest Videos

Latest Test Papers