Exit CPA-21-02 CPA - C++ Certified Associate Programmer
Question 2 of 5
0% complete
Q2 Single choice

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

#include <iostream>
using namespace std;

class First

{

public:

First() { cout << "Constructor";}

~First() { cout << "Destructor";}

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

};

int main()

{

First FirstObject;

FirstObject.Print();

}

  • A

    It prints: Constructorfrom First

  • B

    It prints: Constructorfrom FirstDestructor

  • C

    It prints: Constructorfrom FirstDestructorDestructor

  • D

    Compilation error at line 16