Online Access Free CPA-21-02 Exam Questions

Exam Code:CPA-21-02
Exam Name:CPA - C++ Certified Associate Programmer
Certification Provider:C++ Institute
Free Question Number:256
Posted:Nov 29, 2026
Rating
100%

Question 1

What happens when you attempt to compile and run the following code?

Question 2

Which code, inserted at line 10, generates the output "2?1"?
#include <iostream>
#include <string>
using namespace std;
class A {
protected:
int y;
public:
int z;
};
//insert code here
public:
void set() {
y = 2;
z = 3;
}
void Print() { cout << y << z; }
};
int main () {
B b;
b.set();
b.z = ?1;
b.Print();
return 0;
}

Question 3

What happens when you attempt to compile and run the following code?

Question 4

What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
char *s = "ABCDEF";
cout << s+2;
return 0;
}

Question 5

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;
b.Print(a);
return 0;
}

Add Comments

Your email address will not be published. Required fields are marked *

insert code
Type the characters from the picture.