CSCI 2 MidTerm 2

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which is the derived class in the following statement? class Car : protected Vehicle Car Vehicle protected There is no way to tell. None of these

Car

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

False

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

False

In C++11, using constructor inheritance, it is possible for any of the base class's constructors to be inherited. True False

False

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

False

Arguments are passed to the base class by the ________ class ________ function. derived, constructor derived, destructor base, constructor base, destructor None of these

None of these

Arguments are passed to the base class destructor by the ________ class ________ function. derived, constructor derived, destructor base, constructor base, destructor None of these

None of these

The constructor function's return type is int float char structure pointer None of these

None of these

The following statement allows the ________ members of the Car class to access ________ members of the Vehicle class. class Car : public Vehicle private, private public, private protected, private public, protected None of these

None of these

When more than one class is derived from a base class, the situation is called polymorphism multiplicity population encapsulation None of these

None of these

The destructor function's return type is int float char Nothing; destructors have no return type None of these

Nothing; destructors have no return type

Assuming that Rectangle is a class name, what can you say is TRUE, given the following statement? Rectangle *BoxPtr; The statement declares an object of the class Rectangle. The statement assigns the value of *BoxPtr to the object Rectangle. The statement defines a Rectangle pointer variable named *BoxPtr. The statement is illegal in C++. None of these

The statement defines a Rectangle pointer variable named *BoxPtr.

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

True

C++11 provides a way for a derived class to inherit some of the base class's constructors. True False

True

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

True

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

True

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

True

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 False

True

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 False

True

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

True

Which is the base class in the following statement? class Car : public Vehicle Car Vehicle public class None of these

Vehicle

The base class's ________ affects the way its members are inherited by the derived class. name return data type access specification construction None of these

access specification

Multiple inheritance opens the opportunity for a derived class to have ________ members. dynamic private public ambiguous None of these

ambiguous

In OOP terminology, an object's member variables are often called its ________ and its member functions can be referred to as its behaviors or its ________. values, morals data, activities attributes, activities attributes, methods None of these

attributes, methods

What is being protected in the following statement? class Car : protected Vehicle derived class functions base class members derived class data future inherited classes None of these

base class members

The ________ constructor is called before the ________ constructor. base, derived derived, base public, private private, public None of these

base, derived

When a constructor has a member initialization list, the initializations take place after any statements in the body of the constructor execute before any statements in the body of the constructor execute when a member is used in the execution of the program None of these

before any statements in the body of the constructor execute

When a member function is defined outside of the class declaration, the function name must be qualified with the class name, followed by a semicolon name of the first object class name, followed by the scope resolution operator private access specifier None of these

class name, followed by the scope resolution operator

In C++11 you can have one constructor call another constructor in the same class by using constructor delegation in-place initialization a member initialization list None of these

constructor delegation

A ________ is a member function that is automatically called when a class object is ________. constructor, created destructor, created static function, deallocated utility function, declared None of these

constructor, created

A class is a(n) ________ that is defined by the programmer. data type function method attribute None of these

data type

Objects are created from abstract data types that encapsulate ________ and ________ together. numbers, characters data, functions addresses, pointers integers, floating-point numbers None of these

data, function

In a procedural program you typically have ________ stored in a collection of variables and a set of ________ that perform operations on the data. numbers, arguments parameters, arguments strings, operators data, functions None of these

data, functions

When a constructor function accepts no arguments, or does NOT have to accept arguments because of default arguments, it is called a(n) empty constructor default constructor stand-alone function arbitrator function None of these

default constructor

Select all that apply. In an inheritance situation, the new class that you create from an existing class is known as the derived class inheritor child class parental class None of these

derived class, child class

The ________ destructor is called before the ________ destructor. base, derived derived, base public, private private, public None of these

derived, base

Multiple inheritance is when a ________ class has ________ base classes. base, no derived, two or more derived, no compound, more than two None of these

derived, two or more

Which of the following is automatically called when an object is destroyed? the constructor function the specification deallocator the destructor function the destruction function None of these

destructor function

Members of the class object are accessed with the dot operator cin object extraction operator stream insertion operator None of these

dot operator

The compiler performs ________ on virtual functions. local binding additional error checking static binding dynamic binding None of these

dynamic binding

Where are class declarations usually stored? on separate disk volumes in their own header files in .cpp files, along with function definitions under pseudonyms None of these

in their own header files

In C++11 you can use ________ to initialize a member variable in its declaration statement. general member initialization default initialization in-place initialization initialization overload None of these

in-place initialization

In OOP programming, ________ allows you to create new classes based on existing classes. polymorphism inheritance function overloading the copy constructor None of these

inheritance

Which of the following is commonly used to extend a class or to give it additional capabilities? inheritance privacy the constructor the destructor None of these

inheritance

When you derive a class from an existing class, you ________ add new data and functions. never must may None of these

may

Polymorphism is when ________ in a class hierarchy perform differently, depending on which object performs the call. base class constructors derived class constructors member functions derived class destructors None of these

member functions

When a derived class has two or more base classes, the situation is called multiple inheritance multiplicity polymorphism encapsulation None of these

multiple inheritance

Assume that myCar is an instance of the Car class and that the Car class has a member function named accelerate. Which of the following is a valid call to the accelerate member function? Car -> accelerate(); myCar::accelerate(); myCar.accelerate(); myCar:accelerate(); None of these

myCar.accelerate();

How many default constructors can a class have? only one two or more only two any number None of these

only one

A virtual function is a function that expects to be ________ in a derived class. ignored called frequently overridden private None of these

overriden

When member functions behave differently depending on which object performed the call, this is an example of chaos theory virtual insubordination polymorphism encapsulation None of these

polymorphism

If you do NOT declare an access specification, the default for members of a class is inline private public global None of these

private

The ________ members of a base class are never accessible to a derived class. private public protected All of these None of these

private

Examples of access specifiers are the key words near and far opened and closed private and public table and row None of these

private and public

The type of member function that may be called from a statement outside the class is public private undeclared global None of these

public

If a local variable and a global variable have the same name within the same program, the ________ resolution operator must be used. variable ambiguity scope global None of these

scope

When the compiler binds a member function call with the version of the function that resides in the same class as the call itself, it is considered local binding safe binding static binding dynamic binding None of these

static binding

A C++ class is similar to a(n) inline function header file library function structure None of these

structure

Objects in an array are accessed with ________. subscripts parentheses #include statements output format manipulators None of these

subscripts

The constructor function always has the same name as the first private data member the first public data member the class the first object of the class None of these

the class

Select all that apply. Which of the following constructors cannot be inherited through constructor inheritance? the default constructor the virtual constructor the move constructor the copy constructor the grand constructor

the default constructor, the move constructor, the copy constructor

Which of the following is used to protect important data? the public access specifier the private access specifier the protect member function the class protection operator, @ None of these

the private access specifier

Functions that are dynamically bound by the compiler are ________ functions. constructor destructor static virtual None of these

virtual

A ________ of a base class expects to be overridden in a derived class. constructor function destructor function static function virtual function None of these

virtual function

Which of the following is a directive used to create an "include guard" that allows a program to be conditionally compiled to prevent a header file from accidentally being included more than once? #include #guard #ifndef #endif None of these

#ifndef

When you dereference an object pointer, use the -> operator dot operator & operator None of these

-> operator

The process of object-oriented analysis can be viewed as the following steps: identify objects, then define each object's attributes, behaviors, and relationships define data members and member functions, then assign the class name declare public and private variables, prototype functions, and then write code write the main() function, then determine which classes are needed None of these

identify objects, then define each object's attributes, behaviors, and relationships

When the body of a member function is defined inside a class declaration, it is said to be static global inline conditional None of these

inline

C++11 introduced the ________ key word to help prevent subtle errors when overriding virtual functions. const final override virtual None of these

override

The term ________ means the ability to take many forms. inheritance polymorphism member function encapsulation None of these

polymorphism

Which type of member function may only be called from a function that is a member of the same class? public private global local None of these

private

Protected members of a base class are like ________, but they may be accessed by derived classes. constructor functions static members private members public members None of these

private members

Select all that apply. The base class access specification determines how ________ members in the base class may be accessed by derived classes. private public constructed protected None of these

private, public, protected

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

virtual


Conjuntos de estudio relacionados

World Geography B Unit 2 Chapter 1 Central and South Asia

View Set

ISSA Unit 15 PERIODIZATION (Paul Taylor's)

View Set

Chapter 13. Marketing: Helping Buyers Buy

View Set

Biology 1108: Chapters 20, 23, 24 & 25

View Set