Chapter 14 test 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

15) This is a special function that is called whenever a new object is created and initialized with another object's data.

copy constructor

6) When objects contain pointers, it is a good idea to create an explicit ________ function.

copy constructor

3) This operator may be used to assign one object to another.

=

2) True/False By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object.

TRUE

3) True/False When you overload an operator, you can change the operator's original meaning to something entirely different.

TRUE

7) True/False A static member variable can be used when there are no objects of the class in existence.

TRUE

1) True/False When a class declares an entire class as its friend, the friendship status is reciprocal. That is, each class's member functions have free access to the other's private members.

FALSE

12) True/False You may overload any C++ operator, and you may use the operator function to define non-standard operators, such as @ and ^.

FALSE

14) True/False In C++, if you overload the < operator, you must also overload the > operator.

FALSE

15) True/False A non-static member function may not access a static member variable.

FALSE

4) True/False If you overload the prefix ++ operator, the postfix ++ operator is automatically overloaded.

FALSE

5) True/False A public data member may be declared a friend of a private function.

FALSE

6) True/False C++ permits you to overload the sizeof operator and the this pointer.

FALSE

8) True/False When you overload the << operator, you must also overload the >> operator.

FALSE

9) True/False You can overload the conditional operator to make it function as an unconditional operator.

FALSE

10) True/False A static member function does not need to be called by a specific object of the class.

TRUE

11) True/False It is possible to declare an entire class as a friend of another class.

TRUE

13) True/False The this pointer is a special built-in pointer that is automatically passed as a hidden argument to all non-static member functions.

TRUE

16) True/False The this pointer is automatically passed to non-static member functions of a class.

TRUE

10) It is a good idea to make a copy constructor's parameters ________ by specifying the ________ key word in the parameter list.

constant, const

16) If you do not furnish one of these a default will be provided for you by the compiler.

copy constructor constructor C) destructor

24) In the following function header: FeetInches FeetInches::operator++(int) the word (int) is known as a(n):

dummy parameter

23) A(n) ________ informs the compiler that a class will be declared later in the program.

forward declaration

14) This type of function is not a member of a class, but it has access to the private members of the class.

friend

20) Object composition is useful for creating this type of relationship between classes.

has a

1) Each object of a class has its own copy of the class's ________.

member variables

8) When a class contains an instance of another class, it is known as ________.

object composition

22) When you overload an operator, you cannot change the number of ________ taken by the operator.

operands

18) To overload the + operator, you would write a function named ________.

operator +

17) When you redefine the way a standard operator works when it is used with class objects, you have ________ the operator.

overloaded

21) An ________ operator can work with programmer-defined data types.

overloaded

9) If you do not furnish one of these, an automatic memberwise copy will be performed when one object is assigned to another object.

overloaded assignment operator

4) C++ requires that a copy constructor's parameter be a(n) ________.

reference object

11) A reason to overload the ________ is to write classes that have array-like behaviors.

square brackets [ ] operator

5) C++ allows you to redefine the way ________ work when used with class objects.

standard operators

12) If a member variable is declared ________, all objects of that class have access to that variable.

static

13) A member function that is declared ________ may not access any non-static data members in the class.

static

2) This type of member variable may be accessed before any objects of the class have been created.

static

19) This is a special built-in pointer that is available to a class's member functions.

this pointer

7) A good reason for overloading an operator is to enable it to ________.

work in its usual way, but with programmer-defined data types


Set pelajaran terkait

NUR 101: Test 4 - Chapter 3 - Communication

View Set

Chapter 5 - Audit Evidence and Documentation

View Set

1.1 Quiz Chapter 1-Definition of Health

View Set

Chapter 20: Assessment of Respiratory Function

View Set

**REVIEW GOOD! Chapter 12: Wong Health Promotion of the Preschooler and Family 53Qw/exp

View Set

World geography southwest asia test study

View Set

Chapter 17 Section 3: Birth of the American Republic

View Set

Final Substance Abuse and Addiction MM 640

View Set