Classes And Objects In C Plus Plus - Study Mode

[#136] Which keyword is used to create a copy constructor in C++?
Correct Answer

(D) None of the above

[#137] What is the purpose of a copy constructor in C++?
Correct Answer

(C) To initialize an object using another object

[#138] What happens if a class does not explicitly declare any constructors in C++?
Correct Answer

(D) A default constructor is provided by the compiler

[#139] What is a destructor in C++?
Correct Answer

(A) A special member function that destroys objects

[#140] What will be the output of the following C++ code? #include <iostream>
#include <string>
using namespace std

int main(int argc, char const *argv[])
{
string str

cin>>str

cout<<str

return 0

}
Correct Answer

(B) Input provided by the user