C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 69 Topic 7 Discussion

C++ Institute CPA - C++ Certified Associate Programmer CPA-21-02 Question # 69 Topic 7 Discussion

CPA-21-02 Exam Topic 7 Question 69 Discussion:
Question #: 69
Topic #: 7

What is the output of the program if character 4 is supplied as input?

#include

using namespace std;

int main () {

int c;

cin >> c;

try

{

switch (c)

{

case 1:

throw 20;

case 2:

throw 5.2f;

case 3:

throw 'a';

default:

cout<<"No exception";

}

}

catch (int e)

{ cout << "int exception. Exception Nr. " << e; }

catch (float e)

{ cout << "float exception. Exception Nr. " << e; }

catch (...)

{ cout << "An exception occurred."; }

return 0;

}


A.

It prints: float exception. Exception Nr.


B.

It prints: int exception. Exception Nr.


C.

It prints: An exception occurred


D.

It prints: No exception


Get Premium CPA-21-02 Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.