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 Exam CPA-21-02 Topic 1 Question 24 Discussion

Actual exam question for C++ Institute's CPA-21-02 exam
Question #: 24
Topic #: 1
[All CPA-21-02 Questions]

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

#include

using namespace std;

class First

{

public:

void Print(){ cout<<"from First";}

};

class Second

{

public:

void Print(){ cout<< "from Second";}

};

int main()

{

First FirstObject;

FirstObject.Print();

Second SecondObject;

SecondObject.Print();

}

Show Suggested Answer Hide Answer
Suggested Answer: D

Contribute your Thoughts:

Miesha
8 days ago
I'm not sure, but I think it will print from First twice.
upvoted 0 times
...
Carlee
8 days ago
I agree with Chauncey. The code is straightforward, and the output is exactly what I would expect.
upvoted 0 times
...
Johna
14 days ago
I agree with Esteban, the code will print from First and then from Second.
upvoted 0 times
...
Chauncey
16 days ago
The correct answer is option C. The code will print 'from Firstfrom Second' because it creates two objects, one of the 'First' class and one of the 'Second' class, and then calls the 'Print()' method on each object.
upvoted 0 times
Leila
2 days ago
B) It prints: from Firstfrom First
upvoted 0 times
...
Gearldine
4 days ago
A) It prints: from First
upvoted 0 times
...
...
Esteban
25 days ago
I think it will print from First first and then from Second.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77