Official Bank 0/228

C++ Certified Professional Programmer (CPP) - CPPL Exam Questions

Last updated on June 20, 2026

97% Exam Compliance
228 Total Questions
1
Question
What happens when you attempt to compile and run the following code? #include
using namespace std;
template
void f(A &a)
cout<<1‹ void f(int &a)
course sendi int main()
int a = 1;
f(a);
return O;
}
Options
A runtime exception 116/153
B compilation error
C program displays: 1
D program displays: 2
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 < iostream> #include < algorithm> #include
using namespace std;
int main() (
int t[] = (10, 5, 9, 6, 2, 4, 7, 8, 3, 1);
map forint i=0; i <10; i++) {
}
pair p(5,5);
if (it I= m.end())
cout‹ first< else
cout«<"Not found! \n";
return 0;

Program outputs:
Options
A compilation error
B 10
C 5
D Not found!
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

3
Question
What happens when you attempt to compile and run the following code? #include #include #include algorithm>
using namespace std;
class B { int val;
public:
B(int v): val(v)(}
int getV() const (return val;} bool operator < (const B &

v) const ( return val ostream & operator «(ostream & out, const B &

v) { out< template ostream & out;
Out(ostream & o): out(o)0)
void operator() (const T & val ) {out< int main() {
int t[]=(8, 10, 5, 1, 4, 6, 2, 7, 9, 3);
set s1(t, t+10);
sort(s1.begin(), s1.end());
for_each(s1.begin(), s1.end(), Out(cout));cout‹ return O;
}

Program outputs:
Options
A 10987654321
B 81051462793 114/153
C compilation error
D 12345678910
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

4
Question
Which pieces of code inserted independently into places marked 1 and 2 will cause the program to compile and display: 0 1 2 3 4 5 6 7 8 9? Choose all that apply. #include list> #include
using namespace std;
class A { int a; public:
A(int a)( this?>a=a;}
//insert code here 1
};
//insert code here 2
template void print(T start, Tend) {
while (start!= end) {
std::cout «*start <<""; start++;
}
int main() f
A t1[] =(1, 7, 8, 4, 5 };list [1(t1, t1 + 5);
A t2[] = ( 3, 2, 6, 9, 0 };list
12(t2, t2 + 5);
11.sort();12.sort();|1.merge(12);
print(|1.begin(), 11.end());
print(I2.begin(), I2.end()); cout< return O;
}
28/153
Select 5
Options
A place 1: bool operator < (const A &
B place 1: bool operator ‹ (const A &
C { c<
D place 1: bool operator < (const A &
E ( return this?>a‹ b.a;) place 2: ostream & operator « (ostream & c, const A &
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? Choose all that apply. #include < iostream> #include #include ‹string> #include < list> #include #include
using namespace std;
class B {int val;
public: B(int v=0): val(v))
int getV) const (return val;}
operator int() const ( return val; };);
templatestruct Out (
ostream & out;
Out(ostream & o): out(o))
void operator() (const T & val) {out‹ it main
int t[] = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
fstream f("test.out", ios:: trunc|ios::out);
list |(t, t+10);
for_each(l.begin(), I.end(), Out(f));
f.close();
f.open("test.out");
for good):/{
int i;
f>>i;
cout«i«""';
f.close();
return O;
Select 5
Options
A no file will be created nor opened
B file test.out will be truncated
C program will display sequence 1 2 3 4 5 6 7 8 9 10
D file test.out will be opened writing
E file test.out will be opened for reading
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.