Exam 2

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

This data type can be used to create files and write information to them but cannot be used to read information from them. A) ofstream B) ifstream C) afstream D) outstream

A, ofstream

In the following statement: class car : protected vehicle ________ is the derived class.

Car

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

E , multiple inheritance

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

Virtual Function

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

a, constructor delegation

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

ambiguous

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

ambiguous

When a file is opened, the file stream object's "read position" is ________.

at beginning of file

Data types that are created by the programmer are known as a. variables b. abstract data types (ADTs) c. functions d. parameters e. None of these

b

When you dereference an object pointer, use the a. dot operator b. -> operator c. None of these d. <>operator e. & operator

b

Which of the following will allow you to access structure members? a. the structure access operator b. the dot operator c. the #include<structaccess> directive d. the getmember function e. None of these

b, dot operator

The compiler performs __________ on virtual functions. a. static binding b. dynamic binding c. additional error checking d.no special services e. None of these

b, dynamic binding

This member function reads a single character from a file. A) read B) get C) put D) input

b, get

The ___ constructor is called before the ___ constructor.

base, derived

Look at the following statement. bookList[2].publisher[3] = 't'; This statement... a. is illegal in C++. b. will change the publisher's name of the second book in bookList to 't'. c. will store the character 't' in the fourth element of the publisher member of booklist[2]. d. will ultimately result in a runtime error. e. None of these.

c

A(n) ___________ informs the compiler that a class will be declared later in the program. a. static function b. private data member c. forward declaration d. object conversion e. None of these

c, forward declaration

This data type can be used to create files, read data from them, and write data to them. A) ofstream B) iftream C) fstream D) stream

c, fstream

When the body of a member function is defined inside a class declaration, it is said to be ________. A) static B) global C) inline D) conditional E) None of these

c, inline

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

c, inplace initialization

This member function writes a single character to a file. A) get B) write C) put D) insert

c, put

It is a good idea to make a copy constructor's parameters __ by specifying the __ keyword in the parameter list

constant, const

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

constructor, created

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

copy constructor

Which of the following statements outputs the value of the gpa member of element 1 of the student array?

cout<<student[1].gpa;

If you do NOT furnish a ________, a default one will be provided by the compiler. a. constructor b. destructor c. copy constructor d. All of these e. None of these

d

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

data type

Before a structure can be used, it must be

declared

If Circle is a structure tag, the statement Circle *pcirc;

declares a structure pointer called pcirc

Assuming that Rectangle is a class name the statement Rectangle *BoxPtr

defines a Rectangle pointer variable called BoxPtr

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

derived, child class

Multiple inheritance is when a __ class has __ base classes

derived, two or more

This automatically called when an object is destroyed

destructor

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

dummy parameter

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

e

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

friend

Passing a structure as a constant reference parameter to a function:

guarantees not to result in changes to the structure's members

When used by itself, this access flag causes a file's contents to be deleted if the file already exists.

ios::out

Each object of a class has its own copy of the class's ________. (a) member functions (b) member variables (c) constructor and destructor functions (d) All of these (e) None of these

member variables

The destructor function's return type is

nothing

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

Examples of access specifiers are the keywords:

private and public

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

private members

This type of member function may be called from a statement outside the class

public

If a local variable and a global variable have the same name within the same program, the _______ resolution operator must be used.

scope

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

static

If Circle is a structure tag, the statement can be the header line for a function that ____.

takes a Circle structure as a parameter, does something, and returns a Circle structure

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

this pointer

A good reason to pass a structure as a constant reference is

to prevent changes to the structure members

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

A __ of a base class expects to be overridden in a derived class

virtual function

This member function can be used to store binary data to a file.

write


Kaugnay na mga set ng pag-aaral

Psychology Module 2, Independent Variable

View Set

Chapter 14 micro- Innate Immunity

View Set

ch 4 4.6 tissue injury and aging

View Set

Macro Economics 2021—Chapters 6&7

View Set

Mother Baby Week 4 study questions

View Set