Multiple Choice
What is the output of the following program?
#include <iostream>
using namespace std;
class TestClass
{
private:
int val;
void showVal()
{ cout << val << endl; }
public:
TestClass(int x)
{ val = x; }
};
int main()
{
TestClass test(77) ;
test.showVal() ;
return 0;
}
A) The program runs, but with no output.
B) 77
C) 0
D) The program will not compile.
Correct Answer:

Verified
Correct Answer:
Verified
Q7: You must declare all data members of
Q23: When you dereference an object pointer, use
Q26: This type of member function may be
Q26: Whereas object-oriented programming centers around the object,
Q31: A class may have this many default
Q32: Assuming that Rectangle is a class name,
Q36: When an object is defined without an
Q39: This is used to protect important data.<br>A)public
Q40: If you do not declare an access
Q42: A C++ class is similar to one