1.

What is the output of this program?
#include 
using namespace std;
void SequenceFun(int StopNumber)
{
int N;
N = 1;
while (true)
{
if (N >= StopNumber)
throw N;
cout << N;
N++;
}
}
int main(void)
{
try
{
SequenceFun(5);
}
catch(int ExNumber)
{
cout < cout << "Exception occur with value: " << ExNumber;
}
return 0;
}

A. Runtime Error
B. Compilation Error
C. prints first 4 numbers
D. prints first 4 numbers and throws exception at 5
E. None of these
Answer» E. None of these


Discussion

No Comment Found

Related MCQs