Halloween Special 2026! Get Up to 25% OFF Practice Questions! Limited Time - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

C++ Institute CPP Exam - Topic 7 Question 34 Discussion

Posted by Lashandra on May 06, 2022 at 11:52 PM

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

#include

#include

#include

using namespace std;

class A

{

int a;

public:

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

~A() { c??;}

static int c;

};

int A::c(0);

int main ()

{

A t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8 , 9};

vectorv1(t, t+10);

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

deque d2;

d2 = d1;

cout<

return 0;

}

How many objects of type A will be created:

Suggested Answer: D

Get Premium CPP Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
7 comments · newest first
BA
Barrett 12 months ago
The static variable is a bit confusing, but I think 20 is right.
AN
Andra 1 year ago
Just 10 objects are created in the array.
LA
Lawrence 1 year ago
Wait, how can there be 40? That seems off.
DE
Devorah 1 year ago
I disagree, it's definitely 30!
EV
Eve 1 year ago
Looks like 20 objects will be created.
CA
Cassi 1 year ago
This looks like a straightforward question about the types of testing a test analyst should consider. I'll review the options carefully and choose the one that best fits the role and responsibilities of a test analyst.
DO
Donte 1 year ago
This looks straightforward. Since we're modifying the `finalMenu` array, which is a reference to `foodMenu1`, the changes should be reflected in `foodMenu1` as well. I'll go with option A.
0/2000 characters

Save Cancel