New Year Sale 2026! 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 6 Question 54 Discussion

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

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

#include

#include

using namespace std;

class A

{

int a,b;

public:

A & operator =(const A & c) { a = c.a; return *this;}

A():a(0),b(0){}

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

int getA() {return a;} int getB() {return b;}

};

int main ()

{

vectorv;

A a;

a.setA(10); a.setB(11);

v.push_back(a);

A b = v.front(); v.pop_back();

cout<

return 0;

}

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Ben
4 months ago
I agree, that operator overload is fine, but the syntax is wrong.
upvoted 0 times
...
Shawn
4 months ago
Wait, is that really how you set values? Seems off!
upvoted 0 times
...
Trina
4 months ago
Definitely a compilation error, can't use '?>' like that.
upvoted 0 times
...
Paris
4 months ago
I think it should output 11 10 if it compiles!
upvoted 0 times
...
Raul
4 months ago
Looks like a compilation error due to the 'this?>a' syntax.
upvoted 0 times
...
Stevie
5 months ago
I’m leaning towards option B, the compilation error, but I also recall that if it compiles, it should output the values set in the object.
upvoted 0 times
...
Sonia
5 months ago
I practiced a similar question where we had to check the output of a vector with custom objects. I feel like it should output 11 10, but I'm not completely confident.
upvoted 0 times
...
Phillip
5 months ago
I think there might be a compilation error because of the `this?>a` syntax in the setter methods. That looks wrong to me.
upvoted 0 times
...
Olive
5 months ago
I remember something about the operator overloading, but I'm not sure if the assignment operator is implemented correctly.
upvoted 0 times
...
Cecilia
5 months ago
Okay, I've got this. The question is asking for the other command, not the rolemod command. So the answer must be one of the auditconfig options. B looks like the best fit - it sets the audit policy to capture the executed commands.
upvoted 0 times
...
Alfreda
5 months ago
Hmm, this looks like a tricky one. I'll need to think through the requirements carefully to make sure I choose the right components.
upvoted 0 times
...
Louis
5 months ago
I think we need to ensure redundancy is maintained while upgrading, but I'm not clear on whether we should upgrade APICs first or go for the leaf switches.
upvoted 0 times
...
Rolland
5 months ago
The key here is understanding how the Cisco WSA processes identification profiles. I think the answer is D - AsyncOS processes them alphabetically, but I'll double-check that in my notes to be sure.
upvoted 0 times
...
Raymon
5 months ago
Alright, I've got a strategy for this. I'll eliminate the options I'm sure are wrong, then make an educated guess on the remaining one.
upvoted 0 times
...

Save Cancel