CHAPTER 13

Ace your homework & exams now with Quizwiz!

19) When you dereference an object pointer, use the ________.

A) -> operator

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

B) constructor, created

4) Examples of access specifiers are the key words:

C) private and public

21) The constructor function always has the same name as ________.

C) the class

24) Objects in an array are accessed with ________, just like any other data type in an array.

subscripts

This directive is used to create an "include guard," which allows a program to be conditionally compiled. This prevents a header file from accidentally being included more than once

#ifndef

25) The process of object-oriented analysis can be viewed as the following steps:

A) Identify objects, then define objects' attributes, behaviors, and relationships

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

A) data type

17) Members of a class object are accessed with the ________.

A) dot operator

23) A class may have this many default constructor(s).

A) only one

When a member function is defined outside of the class declaration, the function name must be qualified with the ________.

B) class name, followed by the scope resolution operator

1) Objects are created from abstract data types that encapsulate ________ and ________ together.

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

B) default constructor

6) Class declarations are usually stored here.

B) in their own header files

5) This is used to protect important data.

B) private access specifier

Assuming that Rectangle is a class name, the statement: Rectangle *BoxPtr;

C) defines a Rectangle pointer variable called BoxPtr

22) This is automatically called when an object is destroyed.

C) destructor function

11) The destructor function's return type is ________.

D) Nothing. Destructors have no return type.

In OOP terminology, an object's member variables are often called its ________, and its member functions are sometimes referred to as its behaviors, or ________.

D) attributes, methods

In a procedural program, you typically have ________ stored in a collection of variables, and a set of ________ that perform operations on the data.

D) data, functions

10) The constructor function's return type is ________.

E) None of these

2) True/False: Class objects can be defined prior to the class declaration.

FALSE

3) True/False: The constructor function may not accept arguments.

FALSE

4) True/False: A destructor function can have zero to many parameters.

FALSE

6) True/False: More than one destructor function may be defined for a class.

FALSE

8) True/False: You must declare all data members of a class before you declare member functions.

FALSE

9) True/False: You must use the private access specification for all data members of a class.

FALSE

11) True/False: If you do not declare a destructor function, the compiler will furnish one automatically.

TRUE

5) True/False: More than one constructor function may be defined for a class.

TRUE

True/False: A private member function is useful for tasks that are internal to the class, but is not directly called by statements outside the class

TRUE

True/False: Object-oriented programming is centered around the object, which encapsulate together both the data and the functions that operate on the data.

TRUE

True/False: One purpose that constructor functions are often used for is to allocate memory that will be needed by the object.

TRUE

True/False: One purpose that destructor functions are often used for is to free memory that was allocated by the object.

TRUE

True/False: When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor

TRUE

True/False: When using smart pointers to dynamically allocate objects in C++ 11, it is unnecessary to delete the dynamically allocated objects because the smart pointer will automatically delete them.

TRUE

True/False: Whereas object-oriented programming centers on the object, procedural programming centers on functions.

TRUE

3) A C++ class is similar to one of these.

structure

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

inline

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();

14) If you do not declare an access specification, the default for members of a class is ________.

private

20) This type of member function may be called only from a function that is a member of the same class.

private

13) 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


Related study sets

NWHSU Skel Rad 2: Written Midterm

View Set

Life Insurance Policies Flash Cards

View Set

Unit 4. Vocab. F. Write a phrasal verb in the correct form to replace the words in the bracket. Use the word given in brackets.

View Set

Rolfs APUSH Exam Key Terms/People Pageant Chapter Terms 1-41, Native America to Trump

View Set

JE Questions et réponses sur mon école: questions

View Set

NC Real Estate Unit 9 - Basic Contract Law

View Set

Ch. 4 HAND ExamReview questions (Procedures)

View Set