×

Special Offer! Sale of the Month | Extra 20% OFF - Ends In Coupon code: TEL20

Free Practice C++ Institute CPA-21-02 Exam Questions 2025

Stay ahead with 100% Free CPA C++ Certified Associate Programmer CPA-21-02 Dumps Practice Questions

Page:    1 / 52      
Total 257 Questions | Updated On: Apr 11, 2025
Add To Cart
Question 1

How could you pass arguments to functions? 


Answer: A,B,C
Question 2

What happens when you attempt to compile and run the following code? #include using namespace std; int main() { const int x=0; const int *ptr; ptr = &x; cout<<*ptr; return 0; }


Answer: A
Question 3

What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input? #include #include using namespace std; void f(); int main() { f(); return 0; } void f() { char c; c = cin.get(); cout << c; if(c != '\n') f(); }


Answer: A
Question 4

What happens when you attempt to compile and run the following code? #include #include using namespace std; class A { protected: int y; public: int x, z; A() : x(1), y(2), z(0) {} A(int a, int b) : x(a), y(b) { z = x * y;} void Print() { cout << z; } }; class B : public A { public: int y; B() : A() {} B(int a, int b) : A(a,b) {} void Print() { cout << z; } }; int main () { A b(2,5); b.Print(); return 0; }


Answer: A
Question 5

What happens when you attempt to compile and run the following code? #include using namespace std; class BaseC { public: int *ptr; BaseC() { ptr = new int(10);} BaseC(int i) { ptr = new int(i); } ~BaseC() { delete ptr; } }; void fun(BaseC x); int main() { BaseC *o = new BaseC(5); fun(*o); } void fun(BaseC x) { cout << "Hello:"<<*x.ptr; }


Answer: C
Page:    1 / 52      
Total 257 Questions | Updated On: Apr 11, 2025
Add To Cart

© Copyrights TheExamsLab 2025. All Rights Reserved

We use cookies to ensure your best experience. So we hope you are happy to receive all cookies on the TheExamsLab.