CSCI 2010 FINAL QUESTIONS AND VERIFIED
ANSWERS
Each object of a class has its own copy of the class's - Answers - Member Variables
This type of member variable may be accessed before any objects of the class have
been created. - Answers - Static
This operator may be used to assign one object to another - Answers - =
C++ requires that a copy constructor's parameter be a(n) - Answers - Reference object
C++ allows you to redefine the way ________ work when used with class objects. -
Answers - Standard Operators
When objects contain pointers, it is a good idea to create an explicit ______ function -
Answers - Copy constructor
A good reason for overloading an operator is to enable it to: - Answers - work in its
usual way, but with programmer-defined data types
When a class contains an instance of another class, it is known as - Answers - Dynamic
Composition
If you do not furnish one of these, an automatic memeberwise copy will be performed
when one object is assigned to another object - Answers - Overloaded assignment
operator
It is a good idea to make a copy constructor's parameters______by
specifying______keyword in the parameter list - Answers - constant, const
A reason to overload the _____ is to write classes that have array-like behaviors -
Answers - square brackets operator
If a member variable is declared ________, all objects of that class have access to that
variable. - Answers - static
A member function that is declared_____, may not access any non-static data members
in the class - Answers - static
This type of function is not a member of a class, but it has access to the private
members of the class - Answers - Friend
,This is a special function that is called whenever a new object is created and initialized
with another object's data - Answers - Copy constructor
If you do not furnish one of these a default will be provided for you by the compiler -
Answers - Copy constructor, constructor, destructor
When you redefine the way a standard operator works when it is used with class
objects, you have ________ the operator. - Answers - Overloaded
To overload the + operator, you would write a function named: - Answers - operator+
This is a special built-in pointer that is available to a class's member functions - Answers
- this pointer
Object composition is useful for creating this type of relationship between classes -
Answers - has a
A(n)______operator can work with programmer-defined data types - Answers -
Overloaded
When you overload an operator, you cannot change the number of _____ taken by the
operator - Answers - Operands
A(n) _____ informs the compiler that a class will be declared later in the program -
Answers - forward declaration
In the following function header, FeerInches FeetInches::operator++(int) the word (int) is
known as a: - Answers - Dummy parameter
_____Allows us to crate new classes based on existing classes - Answers - inheritance
When you derive a class from an existing class, you _____ add new data and functions
- Answers - may
The base class access specification determines how ________ members in the base
class may be accessed by derived classes. - Answers - Private, public, and protected
_____ members of a base class are never accessible to a derived class - Answers -
Private
The _____ constructor is called before the _____ constructor - Answers - derived, base
A _____ of a base class expects to be overridden in a derived class - Answers - Virtual
function
, The term _____ means the ability to take many forms - Answers - Polymorphism
When the compiler binds a member function call with the version of the function that
resides in the same class as the call itself, this is considered ________ binding. -
Answers - static
The compiler performs _____ on virtual functions - Answers - dynamic binding
_____ to a base class may be assigned the address of a derived class object - Answers
- Pointers
When more than one class is derived from a base class, the situation is called -
Answers - multiple inheritance
Multiple inheritance opens the opportunity for a derived class to have ________
members. - Answers - ambiguous
In the statement class car: public vehicle, which is the base class? - Answers - Vehicle
Arguments are passed to the base class destructor function by the __ class a __
function - Answers - none of these ( derived, constructor; derived, destructor;
base,constructor; base, destructor)
The following statement class Car: private Vehicle allows the _____ members of the
Car class to access _____ members of the Vehicle class - Answers - none of these
(private, private; public, private; protected, private; public, protected)
In an inheritance situation, the new class that you create from an existing class is known
as the _____ - Answers - derived class, child class
The base class's ________ affects the way its members are inherited by the derived
class. - Answers - Access specification
Protected members of a base class are like ________, but they may be accessed by
derived classes. - Answers - Private Members
The_____destructor is called before the _____ destructor - Answers - derived, base
_____ is commonly used to extend a class, or to give it a additional capabilities -
Answers - Inheritance
When member functions behave differently, depending upon which object performed
the call, this is an example of_____. - Answers - Polymorphism
A virtual function is a member function that expects to be _____ in a derived class -
Answers - Overridden
ANSWERS
Each object of a class has its own copy of the class's - Answers - Member Variables
This type of member variable may be accessed before any objects of the class have
been created. - Answers - Static
This operator may be used to assign one object to another - Answers - =
C++ requires that a copy constructor's parameter be a(n) - Answers - Reference object
C++ allows you to redefine the way ________ work when used with class objects. -
Answers - Standard Operators
When objects contain pointers, it is a good idea to create an explicit ______ function -
Answers - Copy constructor
A good reason for overloading an operator is to enable it to: - Answers - work in its
usual way, but with programmer-defined data types
When a class contains an instance of another class, it is known as - Answers - Dynamic
Composition
If you do not furnish one of these, an automatic memeberwise copy will be performed
when one object is assigned to another object - Answers - Overloaded assignment
operator
It is a good idea to make a copy constructor's parameters______by
specifying______keyword in the parameter list - Answers - constant, const
A reason to overload the _____ is to write classes that have array-like behaviors -
Answers - square brackets operator
If a member variable is declared ________, all objects of that class have access to that
variable. - Answers - static
A member function that is declared_____, may not access any non-static data members
in the class - Answers - static
This type of function is not a member of a class, but it has access to the private
members of the class - Answers - Friend
,This is a special function that is called whenever a new object is created and initialized
with another object's data - Answers - Copy constructor
If you do not furnish one of these a default will be provided for you by the compiler -
Answers - Copy constructor, constructor, destructor
When you redefine the way a standard operator works when it is used with class
objects, you have ________ the operator. - Answers - Overloaded
To overload the + operator, you would write a function named: - Answers - operator+
This is a special built-in pointer that is available to a class's member functions - Answers
- this pointer
Object composition is useful for creating this type of relationship between classes -
Answers - has a
A(n)______operator can work with programmer-defined data types - Answers -
Overloaded
When you overload an operator, you cannot change the number of _____ taken by the
operator - Answers - Operands
A(n) _____ informs the compiler that a class will be declared later in the program -
Answers - forward declaration
In the following function header, FeerInches FeetInches::operator++(int) the word (int) is
known as a: - Answers - Dummy parameter
_____Allows us to crate new classes based on existing classes - Answers - inheritance
When you derive a class from an existing class, you _____ add new data and functions
- Answers - may
The base class access specification determines how ________ members in the base
class may be accessed by derived classes. - Answers - Private, public, and protected
_____ members of a base class are never accessible to a derived class - Answers -
Private
The _____ constructor is called before the _____ constructor - Answers - derived, base
A _____ of a base class expects to be overridden in a derived class - Answers - Virtual
function
, The term _____ means the ability to take many forms - Answers - Polymorphism
When the compiler binds a member function call with the version of the function that
resides in the same class as the call itself, this is considered ________ binding. -
Answers - static
The compiler performs _____ on virtual functions - Answers - dynamic binding
_____ to a base class may be assigned the address of a derived class object - Answers
- Pointers
When more than one class is derived from a base class, the situation is called -
Answers - multiple inheritance
Multiple inheritance opens the opportunity for a derived class to have ________
members. - Answers - ambiguous
In the statement class car: public vehicle, which is the base class? - Answers - Vehicle
Arguments are passed to the base class destructor function by the __ class a __
function - Answers - none of these ( derived, constructor; derived, destructor;
base,constructor; base, destructor)
The following statement class Car: private Vehicle allows the _____ members of the
Car class to access _____ members of the Vehicle class - Answers - none of these
(private, private; public, private; protected, private; public, protected)
In an inheritance situation, the new class that you create from an existing class is known
as the _____ - Answers - derived class, child class
The base class's ________ affects the way its members are inherited by the derived
class. - Answers - Access specification
Protected members of a base class are like ________, but they may be accessed by
derived classes. - Answers - Private Members
The_____destructor is called before the _____ destructor - Answers - derived, base
_____ is commonly used to extend a class, or to give it a additional capabilities -
Answers - Inheritance
When member functions behave differently, depending upon which object performed
the call, this is an example of_____. - Answers - Polymorphism
A virtual function is a member function that expects to be _____ in a derived class -
Answers - Overridden