Review object oriented

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following preprocessor directives does not constitute part of the preprocessor wrapper?

#include

what will the following code output? int number = 22; int *var = &number; cout<< *var << endl;

22

A constructor can specify the return type:

A constructor cannot specify a return type.

Which is the derived class in the following statement? class Car : protected Vehicle

Car

Which of the following hides the implementation details of the data members and member functions within a class?

Encapsulation

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

False

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

False

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

False

you must use the private access specification for all data members of a class.

False

Which of the following is a benefit of encapsulation?

It allows a function defined in one class to be reused in another class.

what does the following statement do? vector<int> v(10);

It creates a vector object with a starting size of 10

Which of the following statements is correct about an accessor member function?

It returns the value of a data member of an object but does not modify any data member values.,

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

May

Arguments are passed to the base class by the ________ class ________ function.

None

Arguments are passed to the base class destructor by the ________ class ________ function.

None

The constructor function's return type is

None

When more than one class is derived from a base class, the situation is called

None

The following statement allows the ________ members of the Car class to access ________ members of the Vehicle class.class Car : public Vehicle

None of these

What happens when you define the data members in a class to be private?

Only the member functions of the same class can access the data members.

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

Private

Assuming that Rectangle is a class name, what can you say is TRUE, given the following statement? Rectangle *BoxPtr;

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

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

True

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

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

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

True

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

Vehicle

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

access specification

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

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 ________.

attributes, methods

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

base class members

The ________ constructor is called before the ________ constructor.

base, derived

What is the syntax of creating Inheritance in C++?

class <child class name>: access specifier <parent class name>

Which of the following is correct syntax to declare C++ class B to be a public base class for derived class D?

class D : public B {/* ... */};

A ________ is a member function that is automatically called when a class object is ________.

constructor, created

A __________ is a member function that is automatically called when a class object is __________.

constructor, created

A class is a(n) __________ that is defined by the programmer.

data type

objects are create form abstract data types that encapsulate____ and ____ together

data, function

The ________ destructor is called before the ________ destructor.

derived, base

Which type of function is NOT a member of a class but has access to the private members of the class?

friend

Where are class declarations usually stored?

in their own header files

In OOP programming, ________ allows you to create new classes based on existing classes.

inheritance

The ability to reuse objects already defined, perhaps for a different purpose, with modification appropriate to the new purpose, is referred to as

inheritance

When the body of a member function is defined inside a class declaration, it is said to be

inline

When a derived class has two or more base classes, the situation is called

multiple inheritance

class object member function that modify class object data members is call _________ function.

mutator

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?

myCar.accelerate();

How many default constructors can a class have?

only one

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

operator +

If you do NOT declare an access specification, the default for members of a class is

private

Examples of access specifiers are the key words

private and public

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

private members

This vector function is used to insert an item into a vector.

push_back

the following statement _______. cin>> *num3;

stores the keyboard input into variable pointed to by num3

The constructor function always has the same name as

the class

Which of the following is automatically called when an object is destroyed?

the destructor function

what will the following statement output? cout<< &num1

the memory address of the variable named num1

Which of the following is used to protect important data?

the private access specifier

Assuming ptr is a pointer variable, what will the following statement output? cout << *ptr;

the value stored in the variable whose address is contained in ptr

which one of below is to get current date and time as part of ctime library?

time_t now = time(0);

Which one is the best way to define vector pointers of class object Person?

vector<Person *> PersonList;

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

virtual function

For the Following code, which statement is NOT true? class point { private: double y; double z; public: double x; };

z is not available to code that is written outside the class.


Kaugnay na mga set ng pag-aaral

Nutrition and Health GWC Prof. Shipp

View Set

Psych 6.2 Classical Conditioning

View Set

Altered Immune Response and Transplantation

View Set

Volume of Pyramids Assignment and Quiz

View Set

Med Surg - Chapter 59 - Care of Patients with Problems of the Biliary System and Pancreas

View Set

Chapter 8 & Appendix J exam review

View Set