Quiz 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

A template is like a blueprint for making various sizes of a vehicle.

True

Both stacks and queues can have either an array-based or link-based implementation.

True

Exception handling is typically used in situations in which the error will be dealt with by a different part of the program (ie. a different scope) from that which detected the error.

True

The assert statement displays a message when the condition is FALSE.

True

Under public inheritance, derived-class objects can be treated as base-class objects.

True

When a class is derived from a class with a pure virtual function and no definition is supplied for that virtual function in the derived class, that derived class is also an abstract class.

True

You are put on hold when you call customer service. The automated system tells you an approximation of how long a wait you will have. This is most likely being modeled by a queue.

True

Which of the following is not an ADT Queue operation as presented by the author.

add new entry to the front of the queue.

Assume that you are running a program in which asserts are enabled. What happens when the following line of code is executed? assert(false);

program is terminated with a suitable message.

From the list below, what is(are) the advantages of exception handling? 1. Remove error-handling code from the software's main line of code. 2. A method writer can choose to handle certain exceptions and delegates others to the caller. 3. An exception that occurs in a function can be handled anywhere in the function call stack.

1, 2, and 3.

Which is used to create a pure virtual function?

=0 (assign zero in the declaration)

Which class is used to design the base class?

Abstract Class

What does inheritance allow you to do?

Create a hierarchy of classed

Which keyword(s) can be used in a template? a. class b. typename c. function d. both class and typename

D. Both Class and Typename

In the class CListQueue, which method call the class CList method Remove?

Dequeue()

What would be the purpose of the following lines of code? back = (back + 1) % DEFAULT_CAPACITY; items[back] + newEntry;

Enables a circular array implementation of a queue.

A catch(<some generic expression>) should always be placed first in the list of handlers following a try block.

False

A non-virtual member function is defined in a base class and overridden in a derived class; if that function is called through a base-class pointer to a derived class object, the derived -class version is used.

False

A queue is first-in-last out data structure.

False. It is a first in first out data structure.

Given the following queue operations on an empty existing queue called nameQueue: nameQueue.enqueue(Sid) nameQueue.enqueue(Sal) nameQueue.enqueue(Sue) nameQueue.enqueue(Sam) nameQueue.dequeue() display (nameQueue.peekFront()) What name is displayed?

Sal


Ensembles d'études connexes

ATI 70, 72 osteoporosis and osteoarthritis

View Set

Corporate Finance Non-Math Questions

View Set

Missed Questions MKTG 409 Exam 1

View Set

A&P Lab E: Muscles Operating on the Scapula and Shoulder

View Set

Chapter 2: Family-Centered Community-Based Care (Prep U)

View Set