1408 C++ Exam 2

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

True/False: A non-static member function may not access a static member variable.

False

True/False: A public data member may be declared a friend of a private function.

False

True/False: C++ permits you to overload the sizeof operator and the this pointer.

False

The ________ destructor is called before the ________ destructor.

derived, base

Multiple inheritance is when a ________ class has ________ base classes.

derived, two or more

In the following function header: FeetInches FeetInches::operator++(int) the word (int) is known as a(n):

dummy parameter

The compiler performs ________ on virtual functions.

dynamic binding

When member functions behave differently, depending upon which object performed the call, this is an example of ________.

polymorphism

True/False: If you overload the prefix ++ operator, the postfix ++ operator is automatically overloaded.

False

True/False: In C++, if you overload the < operator, you must also overload the > operator.

False

True/False: In an inheritance situation, you may not pass arguments to a base class constructor.

False

This is a special built-in pointer that is available to a class's member functions.

"this" pointer

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.

static

In the following statement: class car : public vehicle ________ is the base class.

vehicle

A virtual function is declared by placing the key word ________ in front of the return type in the base class's function declaration.

virtual

________ functions are dynamically bound by the compiler.

virtual

A ________ of a base class expects to be overridden in a derived class.

virtual function

A good reason for overloading an operator is to enable it to ________.

work in its usual way, but with programmer-defined data types

This operator may be used to assign one object to another.

=

True/False: A member function of a derived class may not have the same name as a member function of a base class.

False

True/False: A derived class may not have any classes derived from it.

False

True/False: 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.

False

True/False: When you overload the << operator, you must also overload the >> operator.

False

True/False: You can overload the conditional operator to make it function as an unconditional operator.

False

True/False: You may overload any C++ operator, and you may use the operator function to define non-standard operators, such as @ and ^.

False

________ allows us to create new classes based on existing classes.

Inheritance

________ is commonly used to extend a class, or to give it additional capabilities.

Inheritance

Arguments are passed to the base class destructor function by the ________ class ________ function. a)derived, constructor b)derived, destructor c)base, constructor d)base, destructor e)None of these

None of these

True/False: A derived class may become a base class, if another class is derived from it.

True

True/False: A static member function does not need to be called by a specific object of the class.

True

True/False: A static member variable can be used when there are no objects of the class in existence.

True

True/False: By default, when an object is assigned to another, each member of one object is copied to its counterpart in the other object.

True

True/False: In C++ 11, if a derived class attempts to override a final member function, the compiler generates an error.

True

True/False: It is possible to declare an entire class as a friend of another class.

True

True/False: More than one class may be derived from a base class.

True

True/False: Pointers to a base class may be assigned the address of a derived class object.

True

True/False: Static binding occurs when the compiler binds a function call with the function call that resides in the same class as the call itself.

True

True/False: 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.

True

True/False: The this pointer is a special built-in pointer that is automatically passed as a hidden argument to all non-static member functions.

True

True/False: The this pointer is automatically passed to non-static member functions of a class.

True

True/False: When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line.

True

True/False: When you overload an operator, you can change the operator's original meaning to something entirely different.

True

The base class's ________ affects the way its members are inherited by the derived class.

access specification

If you do not furnish one of these a default will be provided for you by the compiler. a)copy constructor b)constructor c)destructor d)All of these

all of these

Multiple inheritance opens the opportunity for a derived class to have ________ members.

ambiguous

In the following statement: class Car : protected Vehicle What is being protected?

base class members

The ________ constructor is called before the ________ constructor.

base, derived

In the following statement: class Car : protected Vehicle ________ is the derived class.

car

It is a good idea to make a copy constructor's parameters ________ by specifying the ________ key word in the parameter list.

constant, const

This is a special function that is called whenever a new object is created and initialized with another object's data.

copy constructor

When objects contain pointers, it is a good idea to create an explicit ________ function.

copy constructor

In an inheritance situation, the new class that you create from an existing class is known as the ________.

derived class and child class

A(n) ________ informs the compiler that a class will be declared later in the program.

forward declaration

This type of function is not a member of a class, but it has access to the private members of the class.

friend

Object composition is useful for creating this type of relationship between classes.

has a

When you derive a class from an existing class, you ________ add new data and functions.

may

Polymorphism is when ________ in a class hierarchy perform differently, depending upon which object performs the call.

member functions

Each object of a class has its own copy of the class's ________.

member variables

When a derived class has two or more base classes, the situation is known as ________.

multiple inheritance

The following statement: class Car : private Vehicle allows the ________ members of the Car class to access ________ members of the Vehicle class. a)private, private b)public, private c)protected, private d)public, protected e)none of these

none of these

When more than one class is derived from a base class, the situation is called: a)polymorphism b)population c)multiplicity d)encapsulation e)None of these

none of these

When a class contains an instance of another class, it is known as ________.

object composition

When you overload an operator, you cannot change the number of ________ taken by the operator.

operands

To overload the + operator, you would write a function named ________.

operator +

An ________ operator can work with programmer-defined data types.

overloaded

When you redefine the way a standard operator works when it is used with class objects, you have ________ the operator.

overloaded

If you do not furnish one of these, an automatic memberwise copy will be performed when one object is assigned to another object.

overloaded assignment operator

A virtual function is a member function that expects to be ________ in a derived class.

overridden

C++ 11 introduces the ________ key word to help prevent subtle errors when overriding virtual functions.

override

________ to a base class may be assigned the address of a derived class object.

pointers

The term ________ means the ability to take many forms.

polymorphism

________ members of a base class are never accessible to a derived class.

private

Protected members of a base class are like ________, but they may be accessed by derived classes.

private members

The base class access specification determines how ________ members in the base class may be accessed by derived classes.

private, public, and protected

C++ requires that a copy constructor's parameter be a(n) ________.

reference object

A reason to overload the ________ is to write classes that have array-like behaviors.

square brackets [ ] operator

C++ allows you to redefine the way ________ work when used with class objects.

standard operators

A member function that is declared ________ may not access any non-static data members in the class.

static

If a member variable is declared ________, all objects of that class have access to that variable.

static

This type of member variable may be accessed before any objects of the class have been created.

static


Set pelajaran terkait

Chapell/Meek (Licensure and Ordination)

View Set

Evolve Questions Exam 1 -Community Health

View Set

disorders of cardiac function and heart failure and circulatory shock

View Set

EAQ 1: Scope of Practice & Communication

View Set

Chapter 15, Maternal and Fetal Nutrition

View Set

Ionic vs Covalent vs Hydrogen bonds vs Van der Waals

View Set

Vocabulary Ladders: Set 2 (Bravery)

View Set

RN Pediatric Nursing Online Practice 2023 A (ATI)

View Set

CH 28: Disorders of Cardiac Conduction and Rhythm

View Set

Health Test 2 study guide Part 1

View Set