Official Bank 0/220

C++ Certified Associate Programmer (CPA) - CPPL Exam Questions

Last updated on June 20, 2026

97% Exam Compliance
220 Total Questions
1
Question
What happens when you attempt to compile and run the following code? #include #include #include
using namespace std;
int main(void)
{
string s;
s = "Test";
s.resize (s.size() ? 1);
cout< return 0;
}
Options
A It prints: Tes 3
B It prints: Test 3
C It prints: Test 4
D Compilation error
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

2
Question
What will the variable "age" be in class B?
class A {
int x;
protected:
int y;
public:
int age;
A () { age=5; };
};
class B : public A {
string name;
public:
B () { name="Bob"; };
void Print() {
cout << name << age;
}
};
Options
A None of these
B protected
C public
D private
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

3
Question
Which of the following statements are correct about an array?
int tab[10];
Select 2
Options
A It is necessary to initialize the array at the time of declaration.
B The expression tab[1] designates the very first element in the array.
C The array can store 10 elements.
D The expression tab[9] designates the last element in the array.
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

4
Question
What is the output of the program given below? #include
using namespace std;
int main (int argc, const char * argv[])
{
int i=10;
{
int i=0;
cout< }
{
i=5;
cout << i;
}
cout< return 0;
}
Options
A None of these
B 101010
C 1010
D 055
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

5
Question
What happens when you attempt to compile and run the following code? #include #include
using namespace std;
class A {
public:
string s;
A(string
Options
A None of these
B It prints: Hello
C { this?>s = s; }
};
class B {
public:
string s;
B (A
D It prints: Hello world
E Compilation error
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

Finish Practice?

Are you sure you want to finish? This will end your practice session.