Deck 12: Adding Functionality to Your Classes

Full screen (f)
exit full mode
Question
Static member ____ can only access static data members and other static member ____ of the class.

A) functions, functions
B) objects, variables
C) variables, functions
D) references, variables
Use Space or
up arrow
down arrow
to flip the card.
Question
When overloading the insertion operator to process a Complex object, it s important to understand that you re overloading an operator in the ____ class.

A) istream
B) Complex
C) operator
D) ostream
Question
The ____ of an identifier defines the portion of a program where the identifier can be accessed.

A) scope
B) reach
C) section
D) block
Question
As each class is defined, it gets its own block of memory for its data members.
Question
A nonmember function can access private class data members as a(n) ____.

A) operator
B) friend
C) static function
D) privileged function
Question
In this statement: double RoomDimension::TotalSqFootage = 0.0; TotalSqFootage is a(n) ____.

A) static variable
B) class
C) method
D) namespace
Question
Conversion from a built-in type to a class type is made using a(n) ____ constructor.

A) object conversion
B) type conversion
C) copy
D) type exchange
Question
The initial class used as the basis for the derived class is referred to as the subclass.
Question
An object s data member takes precedence over a global variable of the same name.
Question
An implicit conversion occurs in C++ s operations.
Question
____ class variables are allocated memory locations independent of any object being instantiated.

A) Global
B) Extern
C) Static
D) Register
Question
A derived class object can be assigned to a base class object.
Question
Class member functions are global in the file where they re defined but can be called only for objects created from the class.
Question
Inheritance allows redefining how member functions of related classes operate based on the class object being referenced.
Question
Overloading the insertion ( >) operators for class use requires creating operator functions that use these symbols but have a parameter list that includes a class ____.

A) reference
B) object
C) data type
D) address
Question
You cannot create static member functions in C++.
Question
The function used to overload the ostream insertion operator is referred to as a(n) ____.

A) user-defined function
B) static function
C) friend function
D) operator function
Question
In multiple inheritance, a derived type has two or more base types.
Question
With the introduction of user-defined data types, there are ____ possibilities for conversion between data types.

A) two
B) three
C) four
D) eight
Question
Converting from a class to a class is done in the same manner as a conversion from a class to a built-in data type.
Question
Assigning a floating-point value to an integer variable is an example of a(n) ____ conversion.

A) implicit
B) functional
C) operation
D) explicit
Question
Basing function selection on the object making the call is the classic definition of ____ behavior.

A) inherited
B) object-oriented
C) instantiated
D) polymorphic
Question
Setting up a conversion makes sense only when there s a(n) ____ relationship between data types.

A) meaningful
B) inverse
C) virtual
D) inherited
Question
A conversion operator function uses the name of a(n) ____.

A) member function
B) instance variable
C) built-in data type
D) object
Question
The cout stream object s insertion operator function can be ____________________ to process user-defined class objects.
Question
One step in modifying cin to handle the Complex class is to provide access to the Complex class data. This is achieved by declaring the extraction operator function as a(n) ____________________ in the Complex class.
Question
If a base class member has a protected access and the derived class s access specifier is public , the derived class member is ____ to its class.

A) public
B) global
C) protected
D) private
Question
When a derived class object is assigned to a base class object, only the set of all the ____ class data members is assigned.

A) base
B) instantiated
C) private
D) derived
Question
Including a declaration for the second class before the first class s definition is formally called a(n) ____.

A) prior declaration
B) forward declaration
C) namespace declaration
D) including declaration
Question
A built-in to built-in conversion is handled by C++ s implicit conversion rules or its explicit ___________________ operator.
Question
Casting from a base to a derived class requires a(n) ____ to initialize the derived class members that aren t in the base class.

A) destructor
B) mutator
C) operator
D) constructor
Question
Dynamic binding determines which function should be called at runtime, based on the ____ type making the call.

A) object
B) class
C) function
D) operator
Question
____ is the capability of deriving one class from another class.

A) Overloading
B) Redefinition
C) Polymorphism
D) Inheritance
Question
A ____ function tells the compiler to create a pointer to a function but not fill in the pointer s value until the function is actually called.

A) bound
B) virtual
C) pointer
D) member
Question
All ____ data members come into existence before any objects are created.

A) public
B) static
C) virtual
D) local
Question
Because a(n) ____________________ function can be called explicitly after all objects have been declared, it can be used as a cast independent of its initialization purpose.
Question
Overriding a base member function by using an overloaded derived member function is an example of ____.

A) inheritance
B) scoping
C) polymorphism
D) derivation
Question
In a(n) ____ language, data and operations can be incorporated together in such a way that data values can be isolated and accessed through the specified class functions, but inheritance is not required.

A) class
B) object-based
C) object-bound
D) class-bound
Question
Conversion from a class type to a built-in type is made by using a ____ function.

A) copy operator
B) reference
C) type constructor
D) conversion operator
Question
In the assignment b = a; where a is a user-defined data type and b is a built in type, the conversion to the built in type is ____________________.
Question
In class to class conversion, including a conversion operator function with the second class s name in the first class creates a problem if the second class hasn t been ____________________.
Question
The feature of object-oriented languages called ____________________ allows redefining how member functions of related classes operate, based on the object being referenced.
Question
There are two categories of scope: local and ____________________.
Question
Class data members are ____________________ in scope to objects created from the class.
Question
____________________ access permits access only to member or friend functions, and allows any derived class to inherit this restriction.
Question
In the absence of a derived class constructor, the compiler automatically calls the default ____________________ class constructor first.
Question
C++ requires declaring static variables in the class ____________________ section.
Question
In normal function calls, ____________________ binding is used, meaning the determination of which function is called is made at compile time.
Question
The first line of the declaration section of a derived class must include an access specifier and a(n) ____________________ class name.
Question
A static variable with ____________________ access may be assigned a value or altered by a member function anywhere after the static variable s definition.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 12: Adding Functionality to Your Classes
1
Static member ____ can only access static data members and other static member ____ of the class.

A) functions, functions
B) objects, variables
C) variables, functions
D) references, variables
A
2
When overloading the insertion operator to process a Complex object, it s important to understand that you re overloading an operator in the ____ class.

A) istream
B) Complex
C) operator
D) ostream
D
3
The ____ of an identifier defines the portion of a program where the identifier can be accessed.

A) scope
B) reach
C) section
D) block
A
4
As each class is defined, it gets its own block of memory for its data members.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
A nonmember function can access private class data members as a(n) ____.

A) operator
B) friend
C) static function
D) privileged function
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
In this statement: double RoomDimension::TotalSqFootage = 0.0; TotalSqFootage is a(n) ____.

A) static variable
B) class
C) method
D) namespace
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
Conversion from a built-in type to a class type is made using a(n) ____ constructor.

A) object conversion
B) type conversion
C) copy
D) type exchange
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
The initial class used as the basis for the derived class is referred to as the subclass.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
An object s data member takes precedence over a global variable of the same name.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
An implicit conversion occurs in C++ s operations.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
____ class variables are allocated memory locations independent of any object being instantiated.

A) Global
B) Extern
C) Static
D) Register
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
A derived class object can be assigned to a base class object.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
Class member functions are global in the file where they re defined but can be called only for objects created from the class.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
Inheritance allows redefining how member functions of related classes operate based on the class object being referenced.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
Overloading the insertion ( >) operators for class use requires creating operator functions that use these symbols but have a parameter list that includes a class ____.

A) reference
B) object
C) data type
D) address
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
You cannot create static member functions in C++.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
The function used to overload the ostream insertion operator is referred to as a(n) ____.

A) user-defined function
B) static function
C) friend function
D) operator function
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
In multiple inheritance, a derived type has two or more base types.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
With the introduction of user-defined data types, there are ____ possibilities for conversion between data types.

A) two
B) three
C) four
D) eight
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
Converting from a class to a class is done in the same manner as a conversion from a class to a built-in data type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
Assigning a floating-point value to an integer variable is an example of a(n) ____ conversion.

A) implicit
B) functional
C) operation
D) explicit
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
Basing function selection on the object making the call is the classic definition of ____ behavior.

A) inherited
B) object-oriented
C) instantiated
D) polymorphic
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
Setting up a conversion makes sense only when there s a(n) ____ relationship between data types.

A) meaningful
B) inverse
C) virtual
D) inherited
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
A conversion operator function uses the name of a(n) ____.

A) member function
B) instance variable
C) built-in data type
D) object
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
The cout stream object s insertion operator function can be ____________________ to process user-defined class objects.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
One step in modifying cin to handle the Complex class is to provide access to the Complex class data. This is achieved by declaring the extraction operator function as a(n) ____________________ in the Complex class.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
If a base class member has a protected access and the derived class s access specifier is public , the derived class member is ____ to its class.

A) public
B) global
C) protected
D) private
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
When a derived class object is assigned to a base class object, only the set of all the ____ class data members is assigned.

A) base
B) instantiated
C) private
D) derived
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
Including a declaration for the second class before the first class s definition is formally called a(n) ____.

A) prior declaration
B) forward declaration
C) namespace declaration
D) including declaration
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
A built-in to built-in conversion is handled by C++ s implicit conversion rules or its explicit ___________________ operator.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
Casting from a base to a derived class requires a(n) ____ to initialize the derived class members that aren t in the base class.

A) destructor
B) mutator
C) operator
D) constructor
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Dynamic binding determines which function should be called at runtime, based on the ____ type making the call.

A) object
B) class
C) function
D) operator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
____ is the capability of deriving one class from another class.

A) Overloading
B) Redefinition
C) Polymorphism
D) Inheritance
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
A ____ function tells the compiler to create a pointer to a function but not fill in the pointer s value until the function is actually called.

A) bound
B) virtual
C) pointer
D) member
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
All ____ data members come into existence before any objects are created.

A) public
B) static
C) virtual
D) local
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
Because a(n) ____________________ function can be called explicitly after all objects have been declared, it can be used as a cast independent of its initialization purpose.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
Overriding a base member function by using an overloaded derived member function is an example of ____.

A) inheritance
B) scoping
C) polymorphism
D) derivation
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
In a(n) ____ language, data and operations can be incorporated together in such a way that data values can be isolated and accessed through the specified class functions, but inheritance is not required.

A) class
B) object-based
C) object-bound
D) class-bound
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
Conversion from a class type to a built-in type is made by using a ____ function.

A) copy operator
B) reference
C) type constructor
D) conversion operator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
In the assignment b = a; where a is a user-defined data type and b is a built in type, the conversion to the built in type is ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
In class to class conversion, including a conversion operator function with the second class s name in the first class creates a problem if the second class hasn t been ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
The feature of object-oriented languages called ____________________ allows redefining how member functions of related classes operate, based on the object being referenced.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
There are two categories of scope: local and ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
Class data members are ____________________ in scope to objects created from the class.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
____________________ access permits access only to member or friend functions, and allows any derived class to inherit this restriction.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
In the absence of a derived class constructor, the compiler automatically calls the default ____________________ class constructor first.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
C++ requires declaring static variables in the class ____________________ section.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
In normal function calls, ____________________ binding is used, meaning the determination of which function is called is made at compile time.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
The first line of the declaration section of a derived class must include an access specifier and a(n) ____________________ class name.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
A static variable with ____________________ access may be assigned a value or altered by a member function anywhere after the static variable s definition.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.