What is the output of the program? #include <iostream> #include <string> using namespace std; int main () { string s1 = "Hello", s2 = "World"; s2 = s1 + s2; cout << s2; return 0; }
Answer(s): B
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() { int *t; t = new int[2]; for (int i=0; i<2; i++) { t[i]=0; } cout << t[1]; }
Answer(s): A
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() { int x=2, *y, z=3; y = &z; cout<<x**y*x***y; return 0; }
Answer(s): D
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; #define DEF_A 0 int main(int argc, char *argv[]) { cout << DEF_A; return 0; }
What happens when you attempt to compile and run the following code? #include <iostream> #include <exception> using namespace std; class myClass : public exception { virtual const char* what() const throw() { return "My exception."; } } obj; int main () { try { throw obj; } catch (exception& e) { cout << e.what() << endl; } return 0; }
Post your Comments and Discuss C++ Institute CPA exam prep with other Community members:
Our website is free, but we have to fight against AI bots and content theft. We're sorry for the inconvenience caused by these security measures. You can access the rest of the CPA content, but please register or login to continue.