Exam 13: Introduction to Classes

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

One purpose that constructor functions are often used for is to allocate memory that will be needed by the object.

(True/False)
4.8/5
(74)

What is the output of the following program? #include <iostream> using namespace std; class TestClass { \quad public: \quad\quad TestClass(int x) \quad\quad { cout << x << endl; } \quad\quad TestClass() \quad\quad { cout << "Hello!" << endl; } }; int main() { \quad TestClass test; \quad return 0; }

(Multiple Choice)
4.8/5
(88)

If you do not declare an access specification, the default for members of a class is

(Multiple Choice)
4.9/5
(90)

Assuming that Rectangle is a class name, the statement Rectangle *BoxPtr;

(Multiple Choice)
4.8/5
(85)

This is used to protect important data.

(Multiple Choice)
5.0/5
(78)

Whereas object-oriented programming centers around the object, procedural programming centers around functions.

(True/False)
4.9/5
(79)

This type of member function may be called only from a function that is a member of the same class.

(Multiple Choice)
4.9/5
(78)

What is the output of the following program? #include <iostream> using namespace std; class TestClass { \quad private: \quad\quad int val; \quad\quad void showVal() \quad\quad { cout << val << endl; } \quad public: \quad\quad TestClass(int x) \quad\quad { val = x; } }; int main() { \quad TestClass test(77); \quad test.showVal(); \quad return 0; }

(Multiple Choice)
4.9/5
(62)

When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.

(True/False)
4.8/5
(67)

When you dereference an object pointer, use the

(Multiple Choice)
4.7/5
(83)

A class may have this many default constructor(s).

(Multiple Choice)
4.9/5
(75)

A C++ class is similar to one of these.

(Multiple Choice)
4.8/5
(69)

You must declare all data members of a class before you declare member functions.

(True/False)
4.9/5
(81)

The constructor function may not accept arguments.

(True/False)
4.9/5
(78)

If a local variable and a global variable have the same name within the same program, the _______ resolution operator must be used.

(Multiple Choice)
4.7/5
(68)

This directive is used to create an "include guard," which allows a program to be conditionally compiled. This prevents a header file from accidentally being included more than once.

(Multiple Choice)
4.9/5
(81)

If you do not declare a destructor function, the compiler will furnish one automatically.

(True/False)
4.8/5
(85)

This type of member function may be called from a statement outside the class.

(Multiple Choice)
4.8/5
(79)

When a member function is defined outside of the class declaration, the function name must be qualified with the:

(Multiple Choice)
4.8/5
(76)

This is automatically called when an object is destroyed.

(Multiple Choice)
4.9/5
(77)
Showing 21 - 40 of 46
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)