Curious about Actual C++ Institute CCP Programmer (CPP) Exam Questions?
Here are sample C++ Institute CPP - C++ Certified Professional Programmer (CPP) Exam questions from real exam. You can get more C++ Institute CCP Programmer (CPP) Exam premium practice questions at TestInsights.
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
#include
using namespace std;
int main() {
int t[] = { 3, 4, 2, 1, 6, 5, 7, 9, 8, 0 };
vector
map
for (vector
stringstream s;s << *i << *i;
m.insert(pair
}
pair
range = m.equal_range(6);
for (map
cout << i?>first << " ";
}
return 0;
}
Correct : A
Start a Discussions
What happens when you attempt to compile and run the following code? Choose all possible answers.
#include
using namespace std;
class C {
public:
int _c;
C():_c(0){}
C(int c) { _c = c;}
C operator+=(C & b) {
C tmp; tmp._c = _c+b._c;
return tmp;
} };
ostream & operator<<(ostream & c, const C & v) {
c< template class A { T_v; public: A() {} A(T v): _v(v){} T getV() { return _v; } void add(T & a) { _v+=a; } }; int main() { A A a.add(C()); cout << a.getV() < return 0; }
Correct : A, C
Start a Discussions
What happens when you attempt to compile and run the following code? Choose all that apply.
#include
#include
using namespace std;
int main ()
{
vector
v1.push_back(3);
cout< return 0; }
Correct : C, D
Start a Discussions
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
bool mycomparison (int first, int second){return first>second;}
template
void print(T start, T end) {
while (start != end) {
std::cout << *start << " "; start++;
}
}
int main()
{
int t1[] ={ 1, 7, 8, 4, 5 };
list
int t2[] ={ 3, 2, 6, 9, 0 };
list
l1.sort(mycomparison);
l2.sort(mycomparison);
l1.merge(l2,mycomparison);
print(l1.begin(), l1.end());
print(l2.begin(), l2.end()); cout< return 0; }
Correct : A
Start a Discussions
What happens when you attempt to compile and run the following code?
#include
#include
#include
#include
using namespace std;
class B { int val;
public:
B(int v=0):val(v){}
int getV() const {return val;}
B operator +(const B &b )const { return B(val + b.val);} };
ostream & operator <<(ostream & out, const B & v) { out< template ostream & out; Out(ostream & o): out(o){} void operator() (const T & val ) { out< template A operator() (const A & a, const A & b) const { return a+b; }}; int main() { int t[]={1,2,3,4,5,6,7,8,9,10}; vector v1(t, t+10); vector v2(10); transform(v1.begin(), v1.end(), v2.begin(), bind1st(ptr_fun (Add()), 1)); for_each(v2.rbegin(), v2.rend(), Out(cout));cout< return 0; } Program outputs:
Correct : E
Start a Discussions
Total 228 questions