Deck 8: Class Features and Design Issues

Full screen (f)
exit full mode
Question
____ functions perform some action or service, such as sorting data or searching for data.

A) Inspector
B) Predicate
C) Mutator
D) Auxiliary
Use Space or
up arrow
down arrow
to flip the card.
Question
____ functions return information about an object's state, or display some or all of an object's attributes.

A) Inspector
B) Manager
C) Mutator
D) Auxiliary
Question
The one's complement operator (____) is the operator that makes every bit become its opposite.

A) !
B) ^
C) ~
D) %
Question
isUpper() is a typical example of a(n) ____ function.

A) manager
B) auxiliary
C) inspector
D) predicate
Question
getName() is a typical example of a(n) ____ function.

A) manager
B) auxiliary
C) inspector
D) predicate
Question
____ functions change an object's state or attributes.

A) Inspector
B) Manager
C) Mutator
D) Auxiliary
Question
A ____ is a collection of useful classes.

A) library
B) superclass
C) class hierarchy
D) module
Question
A ____ function has the same name as its class, preceded with a tilde.

A) constructor
B) manager
C) predicate
D) destructor
Question
An initialization list is the part of the constructor header to the left of the colon.
Question
The one's complement operator is also called the bitwise complement operator.
Question
A ____ constructor makes a local copy.

A) default
B) non-default
C) copy
D) bitwise
Question
The composition relationship is called an "is-a" relationship.
Question
A ____ function has the same name as its class.

A) constructor
B) manager
C) predicate
D) mutator
Question
A(n) ____ is an internal name for the group of statements that make up the definition of a class.

A) #ifndef name
B) #define name
C) #ifdef name
D) #include name
Question
Several destructors can exist for each class.
Question
sortAscending() is a typical example of a(n) ____ function.

A) manager
B) auxiliary
C) inspector
D) predicate
Question
Coupling is either tight coupling or loose coupling, depending on how much one function depends on information from another.
Question
____ functions create and destroy objects for you.

A) Constructor
B) Manager
C) Mutator
D) Auxiliary
Question
All constructors are public.
Question
____ functions test the truth of some condition.

A) Inspector
B) Predicate
C) Mutator
D) Auxiliary
Question
If you want to create an array of class objects such as House aHouse[3] , the class must have a default ____________________.
Question
What does it mean to overload a constructor?
Question
A(n) ____________________ constructor is one that does not require any arguments.
Question
How do constructor functions differ from other member functions?
Question
____ refers to how well the operations in a function relate to one another.

A) Encapsulation
B) Abstraction
C) Cohesion
D) Coupling
Question
The ____ directive means that you have reached the end of the block of code that you are defining.

A) #define
B) #endif
C) #ifdef
D) #ifndef
Question
The C++ directive ____ allows you to test whether a class has already been defined in a project; it means "if not defined."

A) #define
B) #endif
C) #ifdef
D) #ifndef
Question
____ cohesion occurs when all of the function operations contribute to the performance of only one task.

A) Functional
B) Procedural
C) Complete
D) Default
Question
Using an object within another object is known as ____________________.
Question
____ are simple routines that do nothing (or very little).

A) Prototypes
B) Initialization lists
C) Stubs
D) Auxiliary functions
Question
Implement a default constructor for the following class:
class Employee
{
private:
int idNum;
double hourlyRate;
public:
Employee();
void setIdNum(const int);
void setHourlyRate(const double);
int getIdNum();
double getHourlyRate();
};
Question
What are the four special member functions that every C++ class object automatically has?
Question
Why is it a good idea to implement your own default constructor, rather than letting C++ provide one?
Question
What does the default destructor of a class do?
Question
____ is a measure of the strength of the connection between two functions; it expresses the extent to which information is exchanged by functions.

A) Encapsulation
B) Abstraction
C) Cohesion
D) Coupling
Question
The following code shows an example of ____:
Double square(double number)
{
Return (number * number);
}

A) coupling
B) tight coupling
C) loose coupling
D) functional cohesion
Question
Why must a constructor have the same name as its class?
Question
In highly ____________________ functions, all operations are related.
Question
A(n) ____________________ list provides constructor-required values for the member-objects.
Question
A(n) ____________________ constructor is one that requires at least one argument.
Question
Match between columns
object contained within another class
member-object
object contained within another class
auxiliary function
object contained within another class
inspector function
object contained within another class
copy constructor
object contained within another class
mutator function
object contained within another class
destructor
object contained within another class
manager function
object contained within another class
predicate function
object contained within another class
constructor
Question
In the software industry, what is RAD?
Question
Match between columns
executes when you pass an object as an argument to a function
member-object
executes when you pass an object as an argument to a function
auxiliary function
executes when you pass an object as an argument to a function
inspector function
executes when you pass an object as an argument to a function
copy constructor
executes when you pass an object as an argument to a function
mutator function
executes when you pass an object as an argument to a function
destructor
executes when you pass an object as an argument to a function
manager function
executes when you pass an object as an argument to a function
predicate function
executes when you pass an object as an argument to a function
constructor
Question
Why should you avoid using digits in a variable, function or class name?
Question
Match between columns
is called automatically each time an object is destroyed
member-object
is called automatically each time an object is destroyed
auxiliary function
is called automatically each time an object is destroyed
inspector function
is called automatically each time an object is destroyed
copy constructor
is called automatically each time an object is destroyed
mutator function
is called automatically each time an object is destroyed
destructor
is called automatically each time an object is destroyed
manager function
is called automatically each time an object is destroyed
predicate function
is called automatically each time an object is destroyed
constructor
Question
Match between columns
is called automatically each time an object is created
member-object
is called automatically each time an object is created
auxiliary function
is called automatically each time an object is created
inspector function
is called automatically each time an object is created
copy constructor
is called automatically each time an object is created
mutator function
is called automatically each time an object is created
destructor
is called automatically each time an object is created
manager function
is called automatically each time an object is created
predicate function
is called automatically each time an object is created
constructor
Question
Match between columns
performs initialization and cleanup
member-object
performs initialization and cleanup
auxiliary function
performs initialization and cleanup
inspector function
performs initialization and cleanup
copy constructor
performs initialization and cleanup
mutator function
performs initialization and cleanup
destructor
performs initialization and cleanup
manager function
performs initialization and cleanup
predicate function
performs initialization and cleanup
constructor
Question
Match between columns
also known as a facilitator
member-object
also known as a facilitator
auxiliary function
also known as a facilitator
inspector function
also known as a facilitator
copy constructor
also known as a facilitator
mutator function
also known as a facilitator
destructor
also known as a facilitator
manager function
also known as a facilitator
predicate function
also known as a facilitator
constructor
Question
Match between columns
also known as an implementor
member-object
also known as an implementor
auxiliary function
also known as an implementor
inspector function
also known as an implementor
copy constructor
also known as an implementor
mutator function
also known as an implementor
destructor
also known as an implementor
manager function
also known as an implementor
predicate function
also known as an implementor
constructor
Question
Match between columns
tests the truth of some condition
member-object
tests the truth of some condition
auxiliary function
tests the truth of some condition
inspector function
tests the truth of some condition
copy constructor
tests the truth of some condition
mutator function
tests the truth of some condition
destructor
tests the truth of some condition
manager function
tests the truth of some condition
predicate function
tests the truth of some condition
constructor
Question
Match between columns
also called an access function
member-object
also called an access function
auxiliary function
also called an access function
inspector function
also called an access function
copy constructor
also called an access function
mutator function
also called an access function
destructor
also called an access function
manager function
also called an access function
predicate function
also called an access function
constructor
Question
What is the difference between tight coupling and loose coupling in functions?
Question
Modify the following class definition so that it uses the #ifndef , #define and #endif directives:
class Salesperson
{
private:
int idNum;
string name;
public:
Salesperson(int, string);
void display();
};
Salesperson::Salesperson(int id, string lastName)
{
idNum = id;
name = lastName;
}
void Salesperson::display()
{
cout
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/53
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 8: Class Features and Design Issues
1
____ functions perform some action or service, such as sorting data or searching for data.

A) Inspector
B) Predicate
C) Mutator
D) Auxiliary
D
2
____ functions return information about an object's state, or display some or all of an object's attributes.

A) Inspector
B) Manager
C) Mutator
D) Auxiliary
A
3
The one's complement operator (____) is the operator that makes every bit become its opposite.

A) !
B) ^
C) ~
D) %
C
4
isUpper() is a typical example of a(n) ____ function.

A) manager
B) auxiliary
C) inspector
D) predicate
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
5
getName() is a typical example of a(n) ____ function.

A) manager
B) auxiliary
C) inspector
D) predicate
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
6
____ functions change an object's state or attributes.

A) Inspector
B) Manager
C) Mutator
D) Auxiliary
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
7
A ____ is a collection of useful classes.

A) library
B) superclass
C) class hierarchy
D) module
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
8
A ____ function has the same name as its class, preceded with a tilde.

A) constructor
B) manager
C) predicate
D) destructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
9
An initialization list is the part of the constructor header to the left of the colon.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
10
The one's complement operator is also called the bitwise complement operator.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
11
A ____ constructor makes a local copy.

A) default
B) non-default
C) copy
D) bitwise
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
12
The composition relationship is called an "is-a" relationship.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
13
A ____ function has the same name as its class.

A) constructor
B) manager
C) predicate
D) mutator
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
14
A(n) ____ is an internal name for the group of statements that make up the definition of a class.

A) #ifndef name
B) #define name
C) #ifdef name
D) #include name
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
15
Several destructors can exist for each class.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
16
sortAscending() is a typical example of a(n) ____ function.

A) manager
B) auxiliary
C) inspector
D) predicate
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
17
Coupling is either tight coupling or loose coupling, depending on how much one function depends on information from another.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
18
____ functions create and destroy objects for you.

A) Constructor
B) Manager
C) Mutator
D) Auxiliary
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
19
All constructors are public.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
20
____ functions test the truth of some condition.

A) Inspector
B) Predicate
C) Mutator
D) Auxiliary
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
21
If you want to create an array of class objects such as House aHouse[3] , the class must have a default ____________________.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
22
What does it mean to overload a constructor?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
23
A(n) ____________________ constructor is one that does not require any arguments.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
24
How do constructor functions differ from other member functions?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
25
____ refers to how well the operations in a function relate to one another.

A) Encapsulation
B) Abstraction
C) Cohesion
D) Coupling
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
26
The ____ directive means that you have reached the end of the block of code that you are defining.

A) #define
B) #endif
C) #ifdef
D) #ifndef
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
27
The C++ directive ____ allows you to test whether a class has already been defined in a project; it means "if not defined."

A) #define
B) #endif
C) #ifdef
D) #ifndef
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
28
____ cohesion occurs when all of the function operations contribute to the performance of only one task.

A) Functional
B) Procedural
C) Complete
D) Default
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
29
Using an object within another object is known as ____________________.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
30
____ are simple routines that do nothing (or very little).

A) Prototypes
B) Initialization lists
C) Stubs
D) Auxiliary functions
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
31
Implement a default constructor for the following class:
class Employee
{
private:
int idNum;
double hourlyRate;
public:
Employee();
void setIdNum(const int);
void setHourlyRate(const double);
int getIdNum();
double getHourlyRate();
};
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
32
What are the four special member functions that every C++ class object automatically has?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
33
Why is it a good idea to implement your own default constructor, rather than letting C++ provide one?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
34
What does the default destructor of a class do?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
35
____ is a measure of the strength of the connection between two functions; it expresses the extent to which information is exchanged by functions.

A) Encapsulation
B) Abstraction
C) Cohesion
D) Coupling
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
36
The following code shows an example of ____:
Double square(double number)
{
Return (number * number);
}

A) coupling
B) tight coupling
C) loose coupling
D) functional cohesion
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
37
Why must a constructor have the same name as its class?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
38
In highly ____________________ functions, all operations are related.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
39
A(n) ____________________ list provides constructor-required values for the member-objects.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
40
A(n) ____________________ constructor is one that requires at least one argument.
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
41
Match between columns
object contained within another class
member-object
object contained within another class
auxiliary function
object contained within another class
inspector function
object contained within another class
copy constructor
object contained within another class
mutator function
object contained within another class
destructor
object contained within another class
manager function
object contained within another class
predicate function
object contained within another class
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
42
In the software industry, what is RAD?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
43
Match between columns
executes when you pass an object as an argument to a function
member-object
executes when you pass an object as an argument to a function
auxiliary function
executes when you pass an object as an argument to a function
inspector function
executes when you pass an object as an argument to a function
copy constructor
executes when you pass an object as an argument to a function
mutator function
executes when you pass an object as an argument to a function
destructor
executes when you pass an object as an argument to a function
manager function
executes when you pass an object as an argument to a function
predicate function
executes when you pass an object as an argument to a function
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
44
Why should you avoid using digits in a variable, function or class name?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
45
Match between columns
is called automatically each time an object is destroyed
member-object
is called automatically each time an object is destroyed
auxiliary function
is called automatically each time an object is destroyed
inspector function
is called automatically each time an object is destroyed
copy constructor
is called automatically each time an object is destroyed
mutator function
is called automatically each time an object is destroyed
destructor
is called automatically each time an object is destroyed
manager function
is called automatically each time an object is destroyed
predicate function
is called automatically each time an object is destroyed
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
46
Match between columns
is called automatically each time an object is created
member-object
is called automatically each time an object is created
auxiliary function
is called automatically each time an object is created
inspector function
is called automatically each time an object is created
copy constructor
is called automatically each time an object is created
mutator function
is called automatically each time an object is created
destructor
is called automatically each time an object is created
manager function
is called automatically each time an object is created
predicate function
is called automatically each time an object is created
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
47
Match between columns
performs initialization and cleanup
member-object
performs initialization and cleanup
auxiliary function
performs initialization and cleanup
inspector function
performs initialization and cleanup
copy constructor
performs initialization and cleanup
mutator function
performs initialization and cleanup
destructor
performs initialization and cleanup
manager function
performs initialization and cleanup
predicate function
performs initialization and cleanup
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
48
Match between columns
also known as a facilitator
member-object
also known as a facilitator
auxiliary function
also known as a facilitator
inspector function
also known as a facilitator
copy constructor
also known as a facilitator
mutator function
also known as a facilitator
destructor
also known as a facilitator
manager function
also known as a facilitator
predicate function
also known as a facilitator
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
49
Match between columns
also known as an implementor
member-object
also known as an implementor
auxiliary function
also known as an implementor
inspector function
also known as an implementor
copy constructor
also known as an implementor
mutator function
also known as an implementor
destructor
also known as an implementor
manager function
also known as an implementor
predicate function
also known as an implementor
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
50
Match between columns
tests the truth of some condition
member-object
tests the truth of some condition
auxiliary function
tests the truth of some condition
inspector function
tests the truth of some condition
copy constructor
tests the truth of some condition
mutator function
tests the truth of some condition
destructor
tests the truth of some condition
manager function
tests the truth of some condition
predicate function
tests the truth of some condition
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
51
Match between columns
also called an access function
member-object
also called an access function
auxiliary function
also called an access function
inspector function
also called an access function
copy constructor
also called an access function
mutator function
also called an access function
destructor
also called an access function
manager function
also called an access function
predicate function
also called an access function
constructor
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
52
What is the difference between tight coupling and loose coupling in functions?
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
53
Modify the following class definition so that it uses the #ifndef , #define and #endif directives:
class Salesperson
{
private:
int idNum;
string name;
public:
Salesperson(int, string);
void display();
};
Salesperson::Salesperson(int id, string lastName)
{
idNum = id;
name = lastName;
}
void Salesperson::display()
{
cout
Unlock Deck
Unlock for access to all 53 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 53 flashcards in this deck.