What happens when you attempt to compile and run the following code?#include <iostream>#include <string>using namespace std;class B;class A {int age;public:A () { age=5; };friend class B;};class B {string name;public:B () { name="Bob"; };void Print(A ob) {cout << name << ob.age;}};int main () {A a;B b;
Answer(s): A
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;int main(){int i = 1;if (--i==1) {cout << i;} else {cout << i-1;}return 0;}
Answer(s): C
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;void fun(int &i);int main(){int i=2;fun(i);cout<<i;return 0;}void fun(int &i){i+=2;}
What happens when you attempt to compile and run the following code?#include <iostream>using namespace std;int fun(int x);int main() {cout << fun(0);return 0;}int fun(int x) {if(x > 0)return fun(x-1);else return 100;}
Post your Comments and Discuss C++ Institute CPA-21-02 exam prep with other Community members:
MG Commented on July 22, 2025 the questions are very helpful after completing the study materials and before exam! Thanks UNITED STATES
Priya Arora Commented on July 22, 2025 Excellent practice questions INDIA
Preethi Commented on July 22, 2025 these questions are very useful for the preparation INDIA
Preethi Commented on July 22, 2025 These are very helpful INDIA
unknown Commented on July 21, 2025 informative questions Anonymous
Tech Dude Commented on July 21, 2025 going strong UNITED STATES
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.