final practice Flashcards
(28 cards)
A C++ class is similar to one of these.
A) inline function
B) header file
C) library function
D) structure
E) None of these
Answer: D
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
Answer: B
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
Answer: C
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
E) None of these
A class is a(n) ________ that is defined by the programmer.
A) data type
B) function
C) method
D) attribute
E) None of these
Answer: 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
Answer: 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
Answer: A
- C++ requires that a copy constructor’s parameter be a(n) ________.
A) integer data type
B) floating point data type
C) pointer variable
D) reference object
E) None of these
Answer: D
When objects contain pointers, it is a good idea to create an explicit ________ function.
A) destructor
B) copy constructor
C) static constructor
D) inline constructor
E) None of these
Answer: B
If you do not furnish one of these, an automatic memberwise copy will be performed when one object is
assigned to another object.
A) overloaded constructor function
B) overloaded assignment operator
C) default constructor function
D) overloaded copy operator
E) None of these
Answer: B
If a member variable is declared ________, all objects of that class have access to that variable.
A) static
B) dynamic
C) inline
D) default
E) None of these
Answer: A
The beginning of a function template is marked by a ________.
A) return type
B) parameter list
C) template prefix
D) semicolon
E) None of these
Answer: C
The list container provided by the Standard Template Library is a template version of a ________.
A) singly-linked list
B) doubly-linked list
C) circular-linked list
D) backward-linked list
E) None of these
Answer: B
The advantage a linked list has over a vector is:
A) A linked list can dynamically shrink or grow, and a vector cannot
B) A linked list is smaller than a vector
C) A node can be inserted into or removed from a linked list faster than from a vector
D) Data removal and insertion are more accurate with a linked list than with a vector
E) None of these
Answer: C
Variations of the linked list are:
A) doubly-linked list
B) circular linked list
C) backward linked list
D) A and B
E) None of these
Answer: D
inked list class must take care of removing the dynamically allocated nodes. This is done by ________.
A) the constructor function
B) the destructor function
C) overriding the removal function
D) overloading the memory persistence operator
E) None of these
Answer: B
A dynamic stack has a ________ size, and is implemented as a(n) ________.
A) variable, linked list
B) fixed, linked list
C) variable, array
D) fixed, array
E) None of these
Answer: A
The following statement:
stack< int, vector<int> > iStack;
indicates:
A) a new stack of integers, implemented as a vector
B) a new stack of integers, implemented as a deque
C) a new stack named vector, implemented as integers
D) a new vector named stack, implemented with integers
E) None of these</int>
Answer: A
________ queues are more intuitive and easier to understand than ________ queues.
A) Static, dynamic
B) Dynamic, static
C) Deque-like, stack-like
D) Stack-like, deque-like
E) None of these
Answer: B
f a recursive function does not contain a base case, it ________.
A) returns 0 and stops
B) returns false and stops
C) uses up all available stack memory, causing the program to crash
D) reaches the recursive case and stops
E) None of these
Answer: C
When function A calls function B, which in turn calls function A, this is known as:
A) direct recursion
B) indirect recursion
C) function swapping
D) perfect recursion
E) None of these
Answer: B
A good reason to use the binary tree structure is:
A) to expedite the process of searching large sets of information
B) aesthetics and program design
C) code readability
D) it is more flexible than the Unary Tree structure
E) None of these
Answer: A
When a binary tree is used to facilitate a search, it is referred to as a ________.
A) binary queue
B) binary ordered deque
C) binary search tree
D) sort algorithm
E) None of these
Answer: C
The head pointer, anchored at the top of a binary tree, is called the ________.
A) root node
B) tree pointer
C) binary pointer
D) Either A or C
E) None of these
Answer: B