chapter 13 Flashcards
practice (47 cards)
1) Objects are created from abstract data types that encapsulate ________ and ________ together.
A) numbers, characters
B) data, functions
C) addresses, pointers
D) integers, floats
E) None of these
B
In OOP terminology, an object’s member variables are often called its ________, and its member functions are
sometimes referred to as its behaviors, or ________.
A) values, morals
B) data, activities
C) attributes, activities
D) attributes, methods
E) None of these
D
A C++ class is similar to one of these.
A) inline function
B) header file
C) library function
D) structure
E) None of these
c
Examples of access specifiers are the key words:
A) near and far
B) opened and closed
C) private and public
D) table and row
E) None of these
C
This is used to protect important data.
A) public access specifier
B) private access specifier
C) protect() member function
D) class protection oprator , @
B
Class declarations are usually stored here.
A) on separate disk volumes
B) in their own header files
C) in .cpp files, along with function definitions
D) under pseudonyms
E) None of these
B
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.
A) #include
B) #guard
C) #ifndef
D) #endif
E) None of these
C
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
A ________ is a member function that is automatically called when a class object is ________.
A) destructor, created
B) constructor, created
C) static function, deallocated
D) utility function, declare
E) None of these
B
The constructor function’s return type is ________.
A) int
B) float
C) char
D) structure pointer
E) None of these
E
The destructor function’s return type is ________.
A) tilde
B) int
C) float
D) Nothing. Destructors have no return type.
E) None of the above
D
When a constructor function accepts no arguments, or does not have to accept arguments because of
default arguments, it is called a(n) ________.
A) empty constructor
B) default constructor
C) stand-alone function
D) arbitrator function
E) None of these
B
This type of member function may be called from a statement outside the class.
A) public
B) private
C) undeclared
D) global
E) None of these
A
If you do not declare an access specification, the default for members of a class is ________.
A) inline
B) private
C) public
D) global
E) None of these
B
15) In a procedural program, you typically have ________ stored in a collection of variables, and a set of ________
that perform operations on the data.
A) numbers, arguments
B) parameters, arguments
C) strings, operators
D) data, functions
E) None of these
D
A class is a(n) ________ that is defined by the programmer.
A) data type
B) function
C) method
D) attribute
E) None of these
A
17) Members of a class object are accessed with the ________.
A) dot operator
B) cin object
C) extraction operator
D) stream insertion operator
E) None of these
A
Assuming that Rectangle is a class name, the statement:
Rectangle *BoxPtr;
A) declares an object of class Rectangle
B) assigns the value of *BoxPtr to the object Rectangle
C) defines a Rectangle pointer variable called BoxPtr
D) is illegal in C++
E) None of these
C
When you dereference an object pointer, use the ________.
A) -> operator
B) <> operator
C) dot operator
D) & operator
E) None of these
A
This type of member function may be called only from a function that is a member of the same class.
A) public
B) private
C) global
D) local
E) None of these
B
he constructor function always has the same name as ________.
A) the first private data member
B) the first public data member
C) the class
D) the first object of the class
E) None of these
C
This is automatically called when an object is destroyed.
A) constructor function
B) specification deallocator
C) destructor function
D) coroner function
E) None of these
C
A class may have this many default constructor(s).
A) only one
B) more than one
C) a maximum of two
D) any number
E) None of these
A
Objects in an array are accessed with ________, just like any other data type in an array.
A) subscripts
B) parentheses
C) #include statements
D) output format manipulators
E) None of these
A