Sie sind auf Seite 1von 31

When both a base class and a derived

class have constructors, the base


class's constructor is called
____
(first/last).

first

An overridden base class function


may be called by a function in a
derived class by using the operator.
____

scope resolution
or
scope resolution operator

A(n)
member function in a
base class expects to be overridden in
a derived class.

virtual

_____ binding is when a function


call is bound at runtime.

When a pointer to a base class is


made to point to a derived class, the
pointer ignores and
the
derived class functions, unless the
function is -----

A(n)
function has no body,
or definition, in the class in which it is
declared.

dynamic

overrides virtual

pure virtual

is where a derived class


----has two or more base classes.

multiple inheritance

(T/F) The base class's access


specification affects the way base
class member functions may access
base class member variables.

False

(T/F) Private members of a private


base class become inaccessible to the
derived class.

True

(T/F) Protected members of a private


base class become public members of
the derived class.

False

(T/F) Private members of a protected


base class become inaccessible to the
derived class.

True

(T/F) The base class constructor is


called after the derived class
constructor.

False

(T/F) It isn't possible for a base class


to have more than one constructor.

False

(T/F) A member function of a derived


class may not have the same name as
a member function of the base class.

False

(T/F) A base class may not be derived


from another class.

False

If a member variable is declared


_____
, all objects of that class
have access to the same variable.

Static

A(n)
member function
cannot access any nonstatic member
variables in its own class.

static

A(n)
function is not a
member of a class, but has access to
the private members of the class.

friend

-----

is the default behavior


when an object is assigned the value
of another object of the same class.

memberwise assignment

_____
is a special built-in pointer
that is automatically passed as a
hidden argument to all nonstatic
member functions.

this pointer
or
this

When overloading the _ _ _ _


_
operator, its function must have a
dummy parameter.

Any of the following answers are


acceptable:
postfix -postfix increment/decrement
postfix decrement
postfix++
postfix++/-postfix increment

Object aggregation is useful for


creating a(n)
relationship
between two classes.

Any of the following answers are


acceptable:
whole-part
is-a
has-a
is a
has a
whole part

(T/F) Static member variables cannot


be accessed by nonstatic member
functions.

False

(T/F) A static member function may


refer to nonstatic member variables of
the same class, but only after an
instance of the class has been
defined.

True

(T/F) A friend function has access to


the private members of the class
declaring it a friend.

True

(T/F) In order for a function or class to


become a friend of another class, it
must be declared as such by the class
granting it access.

True

(T/F) You cannot use the= operator to


assign one object's values to another
object, unless you overload the
operator.

False

(T/F) If a class has a copy constructor,


and an object of that class is passed
by value into a function, the function's
parameter will not call its copy
constructor.

False

(T/F) All functions that overload unary


operators must have a dummy
parameter.

False

(T/F) It is possible to have an instance


of one class as a member of another
class.

True

____
programming is centered
around functions or procedures.

Procedural

is an object's ability to
.
contain and manipulate its own data.

Encapsulation

A class is very similar to a(n)

structure
or
struct

The default access specification of


class members is - - - -

private

Defining a class object is often called


the
of a class.

instance
or
instantiation

If you were writing the declaration of a


class named Canine, what would you
name the file it was stored in?

canine.h

When a member function's body is


written inside a class declaration, the
function is - - - -

inline

A(n)
is a member function
with the same name as the class.

constructor

Constructors cannot have a(n)


type.
____

return

A(n)
is a member function
that is automatically called when an
object is destroyed.

destructor

Like constructors, destructors cannot


have a(n)
type.

return

A class may have more than one


constructor, as long as each has a
different - - - -

Any of the following answers are


acceptable:
signature
parameter
parameter list

A(n)
may be used to pass
arguments to the constructors of
elements in an object array.

initialization list

(T/F) Class members are private by


default.

True

(T/F) Classes and structures in C++


are very similar.

True

(T/F) All public members of a class


must be declared together.

False

(T/F) You can use the new operator to


dynamically allocate an instance of a
class.

True

Constructors do not have to have the


same name as the class.

False

(T/F) Constructors cannot take


arguments.

False

Destructors may return a value.

False

Member functions may be overloaded.

True

A class may not have a constructor


with no parameter list, and a
constructor whose arguments all have
default values.

True

A class's responsibilities are the


things the class is responsible for
knowing, and actions the class must
perform.

True

When an array of objects is defined,


the constructor is only called for the
first element.

False

The
file stream data type
is for output files, input files, or files
that perform both input and output.

fstream

The same formatting techniques used


with
may also be used
when writing data to a file.

cout

The
member function
reads a single character from a file.

get

files contain data that is


----unformatted and not necessarily
stored as ASCII text.

Binary

The
member function
writes "raw" binary data to a file.

write

file access, the


In
contents of a file may be read in any
order.

random

The
member function
moves a file's write position to a
specified byte in the file.

seekp

The
member function
returns a file's current write position.

tellp

The
mode flag causes an
offset to be calculated from the end of
a file.

ios::end

(T/F) fstream objects are only capable


of performing file output operations.

False

(T/F) ifstream objects, by default,


create a file if it doesn't exist when
opened.

Flase

(T/F) A file may be opened in the


definition of the file stream object.

True

(T/F) A file stream object's fail member


function may be used to determine if
the file was successfully opened.

True

(T/F) The>> operator expects data to


be delimited by whitespace
characters.

True

(T/F) It is not possible to have more


than one file open at once in a
program.

False

(T/F) Binary is the default mode in


which files are opened.

False

(T/F) It is possible to open a file for


both input and output.

True

What data type is used to create a file


and then write info to that file, but not
to read info from the file?

ofstream

Given a file called info.bet and an a


stream object datafile, what is the
statement that will open the file for
both input and output?

datafile.open("info.txt", ios::in
ios::out);

To access files from a C++ program,


you must include what directive?

#include <fstream>

All stream objects have these and they


indicate the condition of the stream.

error bits

What is the term that means nonsequentially accessing information in


a file?

random-access

Of all the data types/structures that we


have learned, a class is similar to
which one?

struct

Name the three class access


specifiers.

public, private, and protected

What do you call a constructor that


accepts no arguments.

default constructor

What do you use to access members


of a class object (name, not symbol)?

dot operator

When a member function is defined


outside of the class declaration, the
function must be qualified with what?

class name and scope resolution


operator

Each object of a class gets its own


copy of what?

member variables

What type of data member may be


accessed before any objects of the
class have been created?

static

What do you have to use to


dereference an object pointer?

->

What does C++ require a copy


constructor's parameter to be?

reference object

Given two classes (bClass and


dClass), if dClass is to inherit bClass,
what is the class header to achieve
this?

class dClass: public bClass

What type of function is not a member


of the class, but has access to the
private members of the class?

friend

What concept allows us to create a


new class based on an existing class?

inheritance

What type of members of a base class


are never accessible to a derived
class?

private

When working with base and derived


classes: the
constructor is
called before the
constructor.

base, derived

What is the special built in pointer that


is available to a class's member
functions?

this

Das könnte Ihnen auch gefallen