Exam 13: Introduction to Classes

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

A __________ is a member function that is automatically called when a class object is __________.

Free
(Multiple Choice)
4.9/5
(44)
Correct Answer:
Verified

A

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

Free
(Multiple Choice)
4.8/5
(27)
Correct Answer:
Verified

B

A private member function is useful for tasks that are internal to the class but it is not directly called by statements outside the class.

Free
(True/False)
4.8/5
(39)
Correct Answer:
Verified

True

The following code shows an example of __________ class Point { Private: Double y = 5.70; Double z = 3.0; Public: Public member functions go here... };

(Multiple Choice)
4.9/5
(23)

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.9/5
(33)

When the body of a member function is defined inside a class declaration, it is said to be

(Multiple Choice)
4.9/5
(34)

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

(True/False)
4.9/5
(38)

A class is a(n) __________ that is defined by the programmer.

(Multiple Choice)
4.9/5
(32)

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

(Multiple Choice)
4.8/5
(35)

More than one destructor function may be defined for a class.

(True/False)
4.7/5
(36)

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

(Multiple Choice)
4.7/5
(34)

Members of the class object are accessed with the

(Multiple Choice)
4.9/5
(33)

The constructor function's return type is

(Multiple Choice)
4.9/5
(36)

The constructor function may not accept arguments.

(True/False)
4.9/5
(37)

The type of member function that may be called from a statement outside the class is

(Multiple Choice)
4.9/5
(25)

In-place member initialization no longer is available in C++11.

(True/False)
4.9/5
(39)

You must use the private access specification for all data members of a class.

(True/False)
4.8/5
(33)

In object-oriented programming, the object encapsulates both the data and the functions that operate on the data.

(True/False)
4.8/5
(28)

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

(True/False)
4.9/5
(26)

Which of the following is used to protect important data?

(Multiple Choice)
5.0/5
(36)
Showing 1 - 20 of 54
close modal

Filters

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