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 ‹string> #include < list> #include
using namespace std;
template void print(T start, Tend) {
while start = end) {
std:cout «< *start «<""; start++;
}
int main() (
string t1[] = "I", '2", "3", "4",'5", "6", "7", "8", "g", '10';
list string> 11(11, t1+ 10);
list 12(11);

12. reverse); 11 splice(11.end),12);

11. uniquel);
print(|1.begin(), [1.end()); cout« return O;
}
Options
A program outputs: 1 2 3 4 5 6 78910
B program outputs: 123456789 10 1098 7 654321
C compilation error
D program outputs: 12345678910987654321
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;
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!

3
Question
What happens when you attempt to compile and run the following code? #include #include < iostream> #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>v.val;} ];
ostream & operator «(ostream & out, const B &

v) { out< templatestruct Out {
ostream & out;
Out(ostream & o): out(o)(
void operator() (const T & val) { out< int main) (
B t1|= (3,2,4,1,5};
B t2[] = (5,6,8,2,1);
vector v1(10,0);
sort(t1, t1+5);
sort(t2, t2+5);
set_intersection(t1,t1+5,t2,t2+5,v1.begin());
for_each(v1.begin(), v1.end(), Out(cout));cout« return O;

Program outputs:
Options
A 1250000000
B compilation error
C 1234568210 D.5210000000
D 1234568000
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 < vector> #include #include < algorithm> #include < functional>
using namespace std;
templatestruct Out {
ostream & out;
Out(ostream & o): out(o)f}
void operator() (const T & val) {out< int main) f
int t[l= (3,2,4,1,5,6,10,8,7,9);
vector v1(t, t+10);
for_each(v1.begin(), v1.end(), bind2nd(plus(), 1));
for_each(v1.rbegin(), v1.rend(), Out(cout));cout‹ return O;

Program outputs:
Options
A 108911762534
B compilation error
C 32415610879
D 97810651423
E 435267119810
Discussion (0 comments)

to join the discussion

Community Discussion

No discussions yet. Be the first to ask!

5
Question
What will happen when you attempt to compile and run the following code? #include #include #include
using namespace std;
int main()f
int t[] = ( 3, 4, 2, 1, 6, 5, 7, 9, 8, 0);
vectorvt, t+10);
set s1(v.begin(), v.end());
s1.insert(v.begin(),v.end());
bool found = s1.find(7);
if (found)
cout«<"Element found! n";
Jelse (
cout«<"Element not found!\n";
return O;
}
Options
A changing type of variable found to int will make this code compile
B code will not compile
C program will display "Element found!"
D program will display "Element not found!\n"
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.