COSC 2336 Test 2
Which of the following is NOT an operation that can be performed on a stack: - Correct
Answers-Insert
When working with a stack, peek removes the value from the top of the stack. - Correct
Answers-False
A stack is a first-in, first-out data structure. - Correct Answers-False
Stacks are used by compilers to implement recursion. - Correct Answers-True
Stacks can be implemented only using arrays. - Correct Answers-False
Which of the following would result in an error? - Correct Answers-Popping an empty stack
When implementing a stack as a linked-list, you must make sure the stack isn't full before you
can push a new item onto it. - Correct Answers-False
Which of the following would not be a good use of a stack: - Correct Answers-Keyboard buffer
Which of the following is true of implementing a stack using a linked list: - Correct Answers-The
next reference for the bottom of the stack is null
Which of the following is true of an array-based stack implementation: - Correct Answers-
Requires an IsFull method to check for a full stack
A reference-based stack makes more efficient use of memory. - Correct Answers-True
Queues are FIFO (first in, first out) data structures. - Correct Answers-True
If 5 items are added to a queue, the first item to be removed from the queue is the first item
that was added to the queue. - Correct Answers-True
Operations on a queue can be carried out at ______. - Correct Answers-both its front and back
A reference-based implementation of a queue that uses a linear singly linked list would need at
least ______ external references.
, three - Correct Answers-two
Which of the following is the code to insert a new node, referenced by newNode, into an empty
queue represented by a circular linked list? - Correct Answers-newNode.setNext(newNode);
lastNode = newNode;
Which of the following code fragments is used to delete the item at the front of a queue
represented by a circular array? - Correct Answers-front = (front+1) % MAX_QUEUE;
--count;
Which of the following operations inserts an element at the end of the queue: - Correct
Answers-enqueue
Which of the following is NOT an ADT queue operation: - Correct Answers-push
When implementing a queue using a reference-based approach, the operation dequeueAll is
not needed - Correct Answers-False
When implementing a queue using an array-based approach, it is not necessary to determine if
the queue if full before adding a new item to the queue - Correct Answers-False
A queue can be used as a keyboard buffer. - Correct Answers-True
Queues are rarely used in simulation programs. - Correct Answers-False
Which of the following is NOT a means of implementing a queue: - Correct Answers-Circularly
linked list
linearly linked list
linear array
circular array
All of these can be used to implement a queue
How many external references are necessary when implementing a queue using a circularly-
linked list? - Correct Answers-1
When implementing a queue, a naive array approach is more efficient in terms of memory
when compared to a circular array approach. - Correct Answers-False
A referenced-based queue implementation uses a statically allocated linked-list. - Correct
Which of the following is NOT an operation that can be performed on a stack: - Correct
Answers-Insert
When working with a stack, peek removes the value from the top of the stack. - Correct
Answers-False
A stack is a first-in, first-out data structure. - Correct Answers-False
Stacks are used by compilers to implement recursion. - Correct Answers-True
Stacks can be implemented only using arrays. - Correct Answers-False
Which of the following would result in an error? - Correct Answers-Popping an empty stack
When implementing a stack as a linked-list, you must make sure the stack isn't full before you
can push a new item onto it. - Correct Answers-False
Which of the following would not be a good use of a stack: - Correct Answers-Keyboard buffer
Which of the following is true of implementing a stack using a linked list: - Correct Answers-The
next reference for the bottom of the stack is null
Which of the following is true of an array-based stack implementation: - Correct Answers-
Requires an IsFull method to check for a full stack
A reference-based stack makes more efficient use of memory. - Correct Answers-True
Queues are FIFO (first in, first out) data structures. - Correct Answers-True
If 5 items are added to a queue, the first item to be removed from the queue is the first item
that was added to the queue. - Correct Answers-True
Operations on a queue can be carried out at ______. - Correct Answers-both its front and back
A reference-based implementation of a queue that uses a linear singly linked list would need at
least ______ external references.
, three - Correct Answers-two
Which of the following is the code to insert a new node, referenced by newNode, into an empty
queue represented by a circular linked list? - Correct Answers-newNode.setNext(newNode);
lastNode = newNode;
Which of the following code fragments is used to delete the item at the front of a queue
represented by a circular array? - Correct Answers-front = (front+1) % MAX_QUEUE;
--count;
Which of the following operations inserts an element at the end of the queue: - Correct
Answers-enqueue
Which of the following is NOT an ADT queue operation: - Correct Answers-push
When implementing a queue using a reference-based approach, the operation dequeueAll is
not needed - Correct Answers-False
When implementing a queue using an array-based approach, it is not necessary to determine if
the queue if full before adding a new item to the queue - Correct Answers-False
A queue can be used as a keyboard buffer. - Correct Answers-True
Queues are rarely used in simulation programs. - Correct Answers-False
Which of the following is NOT a means of implementing a queue: - Correct Answers-Circularly
linked list
linearly linked list
linear array
circular array
All of these can be used to implement a queue
How many external references are necessary when implementing a queue using a circularly-
linked list? - Correct Answers-1
When implementing a queue, a naive array approach is more efficient in terms of memory
when compared to a circular array approach. - Correct Answers-False
A referenced-based queue implementation uses a statically allocated linked-list. - Correct