Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute CPP Exam - Topic 1 Question 19 Discussion

What happens when you attempt to compile and run the following code? Choose all that apply.#include #include #include using namespace std;class A{int a;public:A(int a) {this?>a = a; c++;}A(const A & a) {this?>a = a.a; c++;}~A() { c??;}static int c;};int A::c(0);int main (){A* t[] = {new A(1), new A(2), new A(3),new A(4), new A(5)};vectorv1(t, t+10);dequed1(v1.begin(), v1.end());d1.clear();v1.clear();cout
B) there are 5 A objects created, and D) program will display 5
A) there are 15 A objects created,
C) for all object A the destructor is called

C++ Institute CPP Exam - Topic 1 Question 19 Discussion

Actual exam question for C++ Institute's CPP exam
Question #: 19
Topic #: 1
[All CPP Questions]

What happens when you attempt to compile and run the following code? Choose all that apply.

#include

#include

#include

using namespace std;

class A

{

int a;

public:

A(int a) {this?>a = a; c++;}

A(const A & a) {this?>a = a.a; c++;}

~A() { c??;}

static int c;

};

int A::c(0);

int main ()

{

A* t[] = {new A(1), new A(2), new A(3),new A(4), new A(5)};

vectorv1(t, t+10);

dequed1(v1.begin(), v1.end());

d1.clear();

v1.clear();

cout<

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: B, D

Contribute your Thoughts:

0/2000 characters
Lindy
7 months ago
Yeah, the destructor should be called for each object.
upvoted 0 times
...
Charolette
7 months ago
I thought it would show 0 since they get cleared.
upvoted 0 times
...
Laurel
7 months ago
Wait, does the destructor get called for all of them?
upvoted 0 times
...
Lili
8 months ago
Totally agree, the constructor runs 5 times.
upvoted 0 times
...
Alpha
8 months ago
There are 5 A objects created.
upvoted 0 times
...
Denae
8 months ago
Alright, this seems straightforward. The export policy shows that R1 is advertising an aggregate route, so the AS path should be 65540.
upvoted 0 times
...
Jaime
8 months ago
I want to say it's the security group tag number, but was it specific to ports or users? That's what confuses me.
upvoted 0 times
...
Hyman
8 months ago
Hmm, I'm a bit unsure about this one. The options seem similar, but I think the key is understanding the difference between information and knowledge. Let me think this through carefully.
upvoted 0 times
...

Save Cancel