Deck 11: More About Classes and Object-Oriented Programming

Full screen (f)
exit full mode
Question
allows us to create new classes based on existing classes.

A)The copy constructor
B)Polymorphism
C)Inheritance
D)Function overloading
E)None of the above
Use Space or
up arrow
down arrow
to flip the card.
Question
The class destructor is called before the class destructor.

A)public, private
B)base, derived
C)derived, base
D)private, public
E)None of the above
Question
A good reason for overloading an operator is to enable it to

A)operate on no operands.
B)outperform its C language counterparts.
C)be used with types defined by the programmer.
D)operate on more operands than in its standard definition.
E)None of the above
Question
It is a good idea to make a copy constructor's parameters by specifying the _ _ keyword in the parameter list.

A)static, static
B)constant, const
C)global, glob
D)inline, inline
E)None of the above
Question
A situation in which every object of a class A has a pointer to an object of a class B, and the objects of the class B may outlive objects of class A, is called

A)composition.
B)aggregation.
C)a has- A relation.
D)an is=A relation.
E)None of the above
Question
In the statement class Car:public Vehicle, which is the base class?

A)public
B)class
C)Car
D)Vehicle
E)None of the above
Question
C++ allows you to overload

A)compiler errors.
B)operators and functions.
C)preprocessor directives.
D)undefined variables.
E)None of the above
Question
If a member variable is declared _ , all objects of that class share access to that variable.

A)inline
B)dynamic
C)default
D)static
E)None of the above
Question
The process of having a class contain an instance of another class is known as

A)object composition.
B)operator overloading.
C)object overloading.
D)dynamic composition.
E)None of the above
Question
In an inheritance situation, the new class that you create from an existing class is known as the

A)derived class.
B)inheritee.
C)child class.
D)both A and C
E)None of the above
Question
To overload the + operator, you would write a function called

A)overload +.
B)operator.overload(+).
C)function +.
D)operator +.
E)None of the above
Question
An operator can work with programmer- defined data types.

A)overloaded
B)unconditional
C)undefined
D)inline
E)None of the above
Question
Protected members of a base class are like _ , with the exception that they may be accessed by derived classes.

A)static members
B)constructor functions
C)public members
D)private members
E)None of the above
Question
is commonly used to extend a class, or to give it additional capabilities.

A)Privacy
B)The destructor
C)Inheritance
D)The constructor
E)None of the above
Question
A reason to overload the is to write classes that have array- like behavior.

A)square brackets [ ]
B)curly braces { }
C)parentheses ( )
D)colon : :
E)None of the above
Question
A member function that is declared cannot use the this pointer.

A)private
B)inline
C)public
D)static
E)None of the above
Question
When you redefine the way a standard operator works when it is used with class objects, you have the operator.

A)overloaded
B)reformatted
C)reassigned
D)overwhelmed
E)None of the above
Question
If you do not furnish a(n)for a class, a default will be provided for you by the compiler.

A)assignment operator
B)constructor
C)copy constructor
D)All of the above
E)None of the above
Question
Each object of a class has its own copy of the class's

A)static member functions.
B)instance member variables.
C)static member variables.
D)All of the above
E)None of the above
Question
In the statement class Car:protected Vehicle, what is being protected?

A)Base class members
B)Future inherited classes
C)Derived class data
D)Derived class functions
E)None of the above
Question
A(n)member variable may be accessed before any objects of the class have been declared.

A)inline
B)public
C)static
D)private
E)None of the above
Question
The operator may be used to assign one object to another.
A)&

A)==
B)<>
D)=
E)None of the above
Question
When you derive a class from an existing class, you

A)must add both new data and new functions.
B)can add new data, but cannot add new functions.
C)can add both new data and new functions.
D)can add new functions, but cannot add new data.
E)None of the above
Question
Arguments are passed to the base class destructor function by the class function.

A)base, destructor
B)derived, constructor
C)base, constructor
D)derived, destructor
E)None of the above
Question
To dereference an object pointer and access one of the object's members, use the

A)-> operator.
B)& operator.
C)<> operator.
D)dot operator.
E)None of the above
Question
When overloading the operator ++, is used to distinguish preincrement from postincrement.

A)the keyword void
B)a parameterless data type
C)the placeholder [ ]
D)a dummy integer parameter
E)None of the above
Question
The base class's affects the way its members are inherited by the derived class.

A)name
B)return data type
C)access specification
D)both A and B
E)None of the above
Question
members of a base class are never accessible to a derived class.

A)Private
B)Protected
C)Public
D)A, B, and C
E)None of the above
Question
The class constructor is called before the class constructor.

A)public, private
B)base, derived
C)private, public
D)derived, base
E)None of the above
Question
When a class contains a pointer to dynamically allocated memory, it is a good idea to equip the class with

A)a copy constructor.
B)a static constructor and an overloaded comparison operator.
C)an inline constructor.
D)a dynamically allocated constructor.
E)None of the above
Question
In the statement class Car:protected Vehicle, which is the derived class?

A)protected
B)Car
C)Vehicle
D)The answer cannot be determined from the information given.
E)None of the above
Question
Some C++ operators cannot be overloaded by the programmer.
Question
If you do not furnish a(n), an automatic memberwise copy will be performed when one object is assigned to another object.

A)default constructor function
B)overloaded assignment operator
C)overloaded copy operator
D)overloaded constructor function
E)None of the above
Question
C++ requires that a copy constructor's parameter be

A)a reference to an object.
B)an integer data type.
C)a floating- point data type.
D)a pointer variable.
E)None of the above
Question
A derived class may become a base class, if another class is derived from it.
Question
A constructor that takes a single parameter of a type other than its class is called a convert constructor.
Question
Object composition is useful for creating a _ relationship between classes.

A)friend
B)conditional
C)static
D)has- a
E)None of the above
Question
A(n)is a special function that is called whenever a new object is created and initialized with data from another object of the same class.

A)assignment function
B)static function
C)destructor
D)copy constructor
E)None of the above
Question
A _ function is not a member of a class, but it has access to the private members of the class.

A)friend
B)constructor
C)static
D)destructor
E)None of the above
Question
The is a special built- in pointer that is available to a class's instance member functions.

A)overloaded -> operator
B)~destructor *ptr
C)&constructor pointer
D)this pointer
E)None of the above
Question
When you overload an operator, you cannot change the number of operands taken by the operator.
Question
You may overload any C++ operator, and you may use the operator function to define non- standard operators, such as @ and ^.
Question
A member function of a derived class may not have the same name as a member function of a base class.
Question
A static member function can be called independently of any object of the class.
Question
In an inheritance situation, you can't pass arguments to a base class constructor.
Question
By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object.
Question
C++ permits you to overload the sizeof operator.
Question
You can overload the conditional operator to make it function as an unconditional operator.
Question
The base class access specification can be viewed as a filter that base class members must pass through when becoming inherited members of a derived class.
Question
In C++, if you overload the < operator, you must also overload the > operator.
Question
It is possible to declare an entire class as a friend of another class.
Question
When a class contains a pointer to dynamically allocated memory, it a good idea to have the class overload the assignment operator.
Question
If you overload the prefix ++ operator, the postfix ++ operator is automatically overloaded also.
Question
When you overload the << operator, you must also overload the >> operator.
Question
The this pointer is a special built- in pointer that is automatically passed as a hidden argument to all instance member functions.
Question
A derived class may not have any classes derived from it.
Question
When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line.
Question
A static member variable can be used when there are no objects of the class in existence.
Question
A static member function cannot be called if no objects of the class exist.
Question
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.
Question
The this pointer is automatically passed to static member functions of a class.
Question
A base class cannot contain a pointer to one of its derived classes.
Question
The structure member selector operator . cannot be overloaded.
Question
If a function f is a friend of a class A, and the class A is a friend of a class B, then the function f is able to access private members of B.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/64
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 11: More About Classes and Object-Oriented Programming
1
allows us to create new classes based on existing classes.

A)The copy constructor
B)Polymorphism
C)Inheritance
D)Function overloading
E)None of the above
C
2
The class destructor is called before the class destructor.

A)public, private
B)base, derived
C)derived, base
D)private, public
E)None of the above
C
3
A good reason for overloading an operator is to enable it to

A)operate on no operands.
B)outperform its C language counterparts.
C)be used with types defined by the programmer.
D)operate on more operands than in its standard definition.
E)None of the above
C
4
It is a good idea to make a copy constructor's parameters by specifying the _ _ keyword in the parameter list.

A)static, static
B)constant, const
C)global, glob
D)inline, inline
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
5
A situation in which every object of a class A has a pointer to an object of a class B, and the objects of the class B may outlive objects of class A, is called

A)composition.
B)aggregation.
C)a has- A relation.
D)an is=A relation.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
6
In the statement class Car:public Vehicle, which is the base class?

A)public
B)class
C)Car
D)Vehicle
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
7
C++ allows you to overload

A)compiler errors.
B)operators and functions.
C)preprocessor directives.
D)undefined variables.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
8
If a member variable is declared _ , all objects of that class share access to that variable.

A)inline
B)dynamic
C)default
D)static
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
9
The process of having a class contain an instance of another class is known as

A)object composition.
B)operator overloading.
C)object overloading.
D)dynamic composition.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
10
In an inheritance situation, the new class that you create from an existing class is known as the

A)derived class.
B)inheritee.
C)child class.
D)both A and C
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
11
To overload the + operator, you would write a function called

A)overload +.
B)operator.overload(+).
C)function +.
D)operator +.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
12
An operator can work with programmer- defined data types.

A)overloaded
B)unconditional
C)undefined
D)inline
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
13
Protected members of a base class are like _ , with the exception that they may be accessed by derived classes.

A)static members
B)constructor functions
C)public members
D)private members
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
14
is commonly used to extend a class, or to give it additional capabilities.

A)Privacy
B)The destructor
C)Inheritance
D)The constructor
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
15
A reason to overload the is to write classes that have array- like behavior.

A)square brackets [ ]
B)curly braces { }
C)parentheses ( )
D)colon : :
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
16
A member function that is declared cannot use the this pointer.

A)private
B)inline
C)public
D)static
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
17
When you redefine the way a standard operator works when it is used with class objects, you have the operator.

A)overloaded
B)reformatted
C)reassigned
D)overwhelmed
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
18
If you do not furnish a(n)for a class, a default will be provided for you by the compiler.

A)assignment operator
B)constructor
C)copy constructor
D)All of the above
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
19
Each object of a class has its own copy of the class's

A)static member functions.
B)instance member variables.
C)static member variables.
D)All of the above
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
20
In the statement class Car:protected Vehicle, what is being protected?

A)Base class members
B)Future inherited classes
C)Derived class data
D)Derived class functions
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
21
A(n)member variable may be accessed before any objects of the class have been declared.

A)inline
B)public
C)static
D)private
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
22
The operator may be used to assign one object to another.
A)&

A)==
B)<>
D)=
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
23
When you derive a class from an existing class, you

A)must add both new data and new functions.
B)can add new data, but cannot add new functions.
C)can add both new data and new functions.
D)can add new functions, but cannot add new data.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
24
Arguments are passed to the base class destructor function by the class function.

A)base, destructor
B)derived, constructor
C)base, constructor
D)derived, destructor
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
25
To dereference an object pointer and access one of the object's members, use the

A)-> operator.
B)& operator.
C)<> operator.
D)dot operator.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
26
When overloading the operator ++, is used to distinguish preincrement from postincrement.

A)the keyword void
B)a parameterless data type
C)the placeholder [ ]
D)a dummy integer parameter
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
27
The base class's affects the way its members are inherited by the derived class.

A)name
B)return data type
C)access specification
D)both A and B
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
28
members of a base class are never accessible to a derived class.

A)Private
B)Protected
C)Public
D)A, B, and C
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
29
The class constructor is called before the class constructor.

A)public, private
B)base, derived
C)private, public
D)derived, base
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
30
When a class contains a pointer to dynamically allocated memory, it is a good idea to equip the class with

A)a copy constructor.
B)a static constructor and an overloaded comparison operator.
C)an inline constructor.
D)a dynamically allocated constructor.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
31
In the statement class Car:protected Vehicle, which is the derived class?

A)protected
B)Car
C)Vehicle
D)The answer cannot be determined from the information given.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
32
Some C++ operators cannot be overloaded by the programmer.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
33
If you do not furnish a(n), an automatic memberwise copy will be performed when one object is assigned to another object.

A)default constructor function
B)overloaded assignment operator
C)overloaded copy operator
D)overloaded constructor function
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
34
C++ requires that a copy constructor's parameter be

A)a reference to an object.
B)an integer data type.
C)a floating- point data type.
D)a pointer variable.
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
35
A derived class may become a base class, if another class is derived from it.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
36
A constructor that takes a single parameter of a type other than its class is called a convert constructor.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
37
Object composition is useful for creating a _ relationship between classes.

A)friend
B)conditional
C)static
D)has- a
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
38
A(n)is a special function that is called whenever a new object is created and initialized with data from another object of the same class.

A)assignment function
B)static function
C)destructor
D)copy constructor
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
39
A _ function is not a member of a class, but it has access to the private members of the class.

A)friend
B)constructor
C)static
D)destructor
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
40
The is a special built- in pointer that is available to a class's instance member functions.

A)overloaded -> operator
B)~destructor *ptr
C)&constructor pointer
D)this pointer
E)None of the above
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
41
When you overload an operator, you cannot change the number of operands taken by the operator.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
42
You may overload any C++ operator, and you may use the operator function to define non- standard operators, such as @ and ^.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
43
A member function of a derived class may not have the same name as a member function of a base class.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
44
A static member function can be called independently of any object of the class.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
45
In an inheritance situation, you can't pass arguments to a base class constructor.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
46
By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
47
C++ permits you to overload the sizeof operator.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
48
You can overload the conditional operator to make it function as an unconditional operator.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
49
The base class access specification can be viewed as a filter that base class members must pass through when becoming inherited members of a derived class.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
50
In C++, if you overload the < operator, you must also overload the > operator.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
51
It is possible to declare an entire class as a friend of another class.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
52
When a class contains a pointer to dynamically allocated memory, it a good idea to have the class overload the assignment operator.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
53
If you overload the prefix ++ operator, the postfix ++ operator is automatically overloaded also.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
54
When you overload the << operator, you must also overload the >> operator.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
55
The this pointer is a special built- in pointer that is automatically passed as a hidden argument to all instance member functions.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
56
A derived class may not have any classes derived from it.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
57
When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
58
A static member variable can be used when there are no objects of the class in existence.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
59
A static member function cannot be called if no objects of the class exist.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
60
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.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
61
The this pointer is automatically passed to static member functions of a class.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
62
A base class cannot contain a pointer to one of its derived classes.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
63
The structure member selector operator . cannot be overloaded.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
64
If a function f is a friend of a class A, and the class A is a friend of a class B, then the function f is able to access private members of B.
Unlock Deck
Unlock for access to all 64 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 64 flashcards in this deck.