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 5 Question 14 Discussion

Posted by Timothy on May 07, 2022 at 10:10 AM

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

#include

#include

using namespace std;

class A

{

int a;

public:

A():a(0){} A(int a){ this?>a = a;}

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

int getA() {return a;}

};

ostream &operator<<(ostream & cout, A & a)

{

cout<< a.getA();

return cout;

}

int main ()

{

vectorv(5, new A());

v.push_back(new A(1));

vector::iterator it;

for(it = v.begin(); it != v.end(); it++)

{

cout<<*it<<" ";

}

cout<

return 0;

}

Suggested Answer: E

Get Premium CPP Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
8 comments · newest first
GE
Georgiana 11 months ago
Wait, are we sure about that? Looks sketchy to me.
TH
Theola 12 months ago
It should output 0 0 0 0 0 1 if it compiles!
JO
Jolene 12 months ago
I thought it would just output 0s, but now I'm not so sure.
WI
Wilbert 1 year ago
Totally agree, that syntax is wrong!
ER
Erinn 1 year ago
The code has a compilation error due to `this?>a`.
FR
France 1 year ago
Okay, let me think this through. The question is asking about the result of the firewall traffic inspection, so I'll need to analyze the details provided in the log data to figure out which security profile or policy action was responsible.
TI
Timmy 1 year ago
I remember practicing a similar question where we discussed RDS security features, and whitelist access was definitely mentioned as a valid option.
JO
Johna 1 year ago
Hmm, I'm a bit confused on this one. I know the sysctl command has something to do with kernel parameters, but I'm not sure which directory they're actually modified in. I'll have to think this through carefully.
0/2000 characters

Save Cancel