C++ Institute C++ Certified Professional Programmer CPP Question # 7 Topic 1 Discussion

C++ Institute C++ Certified Professional Programmer CPP Question # 7 Topic 1 Discussion

CPP Exam Topic 1 Question 7 Discussion:
Question #: 7
Topic #: 1

What happens when you attempt to compile and run the following code?

#include

#include <algorithm>

#include

using namespace std;

class A {

int a;

public:

A(int a) : a(a) {}

int getA() const { return a; } void setA(int a) { this?>a = a; }

};

int main () {

int t[] = {1,2,3,2,3,5,1,2,7,3,2,1,10, 4,4,5};

deque d (t,t+15);

int number = count(d.begin(), d.end(), 2);

cout<< number<

return 0;

}

Program outputs:


A.

4


B.

3


C.

2


D.

0


E.

compilation error


Get Premium CPP Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.