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 is the output of the program? #include #include
using namespace std;
int main()
{
string s1[]= {"Hello" , "World" };
for (int i=0; i<2; i++) {
cout << s1[i];
}
return( 0 );
}
Options
A It prints: World
B It prints: Hello
C It prints: HelloWorld
D It prints: WorldHello
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

2
Question
What happens when you attempt to compile and run the following code? #include
using namespace std;
int op(int x, int y)
{
return x?y;
}
int op(int x, float y)
{
}
return x+y;
int main()
{
int i=1, j=2, k, l;
float f=0.23;
k = op(i, j);
l = op(j, f);
cout<< k << "," << l;
return 0;
}
Options
A Compilation fails
B It prints: ?1,3
C It prints: ?1,?1
D It prints: ?1,2
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

3
Question
Given: #include #include
using namespace std;
int main () {
try
{
int * myarray= new int[1000];
}
{
catch (bad_alloc&)
cout << "Error allocating memory";
}
{
catch (exception& e)
cout << "Standard exception";
}
{
catch (...)
cout << "Unknown exception";
}
return 0;
}

What will happen if we use the operator β€œnew” and the memory cannot be allocated?
Options
A Compilation error
B It prints: Standard exception
C It prints: Error allocating memory
D It prints: Unknown exception
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

4
Question
What happens when you attempt to compile and run the following code? #include
using namespace std;
class BaseClass
{
public:
int *ptr;
BaseClass(int
Options
A Runtime error.
B It prints: Hello:
C { ptr = new int(i); }
~BaseClass() { delete ptr; delete ptr;}
void Print() { cout << *ptr; }
};
void fun(BaseClass x);
int main()
{
BaseClass o(10);
fun(o);
o.Print();
}
void fun(BaseClass
x) {
cout << "Hello:";
}
D It prints: Hello:1
E It prints: 10
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

5
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!

Finish Practice?

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