C++ Certified Associate Programmer (CPA) - CPPL Exam Questions
Last updated on June 20, 2026
using namespace std;
int main()
{
string s1[]= {"Hello" , "World" };
for (int i=0; i<2; i++) {
cout << s1[i];
}
return( 0 );
}
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
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;
}
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
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?
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
using namespace std;
class BaseClass
{
public:
int *ptr;
BaseClass(int
~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:";
}
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
int tab[10];
to join the discussion
No discussions yet. Be the first to ask!
Delete Comment
Are you sure? This action cannot be undone.
Finish Practice?
Are you sure you want to finish? This will end your practice session.