CS 1337 final exam
What do we call it when we have the ability to combine data with operations or methods on that data in a single unit?
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
A program may not contain both a "regular" version of a function and a template version of the function.
False
If an exception is not caught, it is stored for later use.
False
In an inheritance situation, you may not pass arguments to a base class constructor
False
The try/catch/throw construct is able to handle only one type of exception in a try block.
False
In OOP programming, ________ allows you to create new classes based on existing classes.
Inheritance
When you have a function template can it only have one parameterized type or several?
It can have multiple type parameters
What runs faster, recursive programs or iterative programs?
Iterative programs are faster
What type of data structure is a stack?
LIFO (last-in-first-out)
When you declare a function template, how much memory is reserved?
No memory
Are exhaustive algorithms efficient or fast?
No they are slow because they look through every case
The beginning of a function template is marked by a
Template prefix
Any time you search a linked list, where do you start?
The head / first node
If the head pointer points to null, what does that indicate?
The list is empty
Exceptions are used to signal errors or unexpected results that occur when a program is running
True
If an exception is not caught, the program will abort execution
True
If you have a try block can you have more than one throw point?
True
In C++11, if a derived class attempts to override a final member function, the compiler generates an error.
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
Static binding occurs when the compiler binds a function call with the function call that resides in the same class as the call itself.
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
The base class access specifiers affect the way that member functions inherit in the derived class.
True
Using a function template requires less code than overloading a function.
True
When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line.
True
When you do a throw statement does it have to be inside a try block?
True
A ________ of a base class expects to be overridden in a derived class.
Virtual function
When you derive a class from an existing class, can you add new data and functions to the derived class?
Yes
In order to delete an entire linked list, what do you do?
You have to transverse the whole list and delete each node one by one
What is a linked list?
a collection of nodes that contain a data part and a next pointer that contains the memory address of the next element in the list
Can you have code between a try block and a catch block?
no
A virtual function is a function that expects to be ________ in a derived class.
overridden
C++ 11 introduces the ________ keyword to help prevent subtle errors when overriding virtual functions.
override
The term ________ means the ability to take many forms.
polymorphism
When member functions behave differently depending on which object performed the call, this is an example of?
polymorphism
The ________ members of a base class are never accessible to a derived class.
private
What is being protected in the following statement? class Car : protected Vehicle
the base class public members
What do you call a line that contains a throw statement?
throw point
What does ADT stand for?
Abstract Data Type
What does an Enqueue operation do in a queue?
Add an element to the end of the queue
What does it mean to append a node to a linked list?
Appending a node is adding a new node to the end of the list
What do you call the ending point in a recursive algorithm?
Base case
The ________ constructor is called before the ________ constructor.
Base, derived
What do you call a double-ended queue?
Deque
The compiler performs ________ on virtual functions.
Dynamic binding
What do you call the pointer that points to the first node in the linked list?
Start pointer
When the compiler binds a member function call with the version of the function that resides in the same class as the call itself, it is considered?
Static binding
When the __________ operator fails to allocate memory, C++ throws a bad_alloc exception.
catch
What happens if an error is thrown but never caught?
code aborts
What does a push operation do?
inserting an element into the top of the stack
