What is the output of the program if character 2 is supplied as input?#include <iostream>using namespace std;int main () {int c;cin >> c;try{switch (c){case 1:throw 20;case 2:throw 5.2f;}}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;}
Answer(s): D
What is the output of the program if character 4 is supplied as input?#include <iostream>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;}
Which code, inserted at line 14, generates the output "3.14 10"?#include <iostream>using namespace std;namespace myNamespace1{int x = 5;int y = 10;}namespace myNamespace2{float x = 3.14;float y = 1.5;}int main () {//insert code here cout << x << " " << y;return 0;}
What is the output of the program?#include <iostream>#include <string>using namespace std;int main(){string s1[]= {"Hello" , "World" };for (int i=0; i<2; i++) {cout << s1[i];}return( 0 );}
Answer(s): A
Post your Comments and Discuss C++ Institute CPA-21-02 exam with other Community members:
Subash commented on October 21, 2024 I am planning to take this exam. Are these 257 questions enough to clear it? Also, does each section have a passing percentage, or is it based on the overall ? INDIA upvote
Our website is free, but we have to fight against bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the CPA-21-02 content, but please register or login to continue.