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; }
Suggested Answer: A
Get Premium CPP Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
14 comments · newest first
BE
Ben
1 year ago
I agree, that operator overload is fine, but the syntax is wrong.
SH
Shawn
1 year ago
Wait, is that really how you set values? Seems off!
TR
Trina
1 year ago
Definitely a compilation error, can't use '?>' like that.
PA
Paris
1 year ago
I think it should output 11 10 if it compiles!
RA
Raul
1 year ago
Looks like a compilation error due to the 'this?>a' syntax.
ST
Stevie
1 year 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.
SO
Sonia
1 year 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.
PH
Phillip
1 year ago
I think there might be a compilation error because of the `this?>a` syntax in the setter methods. That looks wrong to me.
OL
Olive
1 year ago
I remember something about the operator overloading, but I'm not sure if the assignment operator is implemented correctly.
CE
Cecilia
1 year 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.
AL
Alfreda
1 year 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.
LO
Louis
1 year 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.
RO
Rolland
1 year 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.
RA
Raymon
1 year 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.