Deck 18: Stacks and Queues

Full screen (f)
exit full mode
Question
A static queue can be implemented as a

A) circular array.
B) stack.
C) dynamic linked list.
D) dynamic vector.
E) None of the above
Use Space or
up arrow
down arrow
to flip the card.
Question
A dynamic stack starts as an empty linked list.
Question
The STL provides containers for deque and queue.
Question
The pop function in the stack template of the STL does not return the value from the top of the stack.
Question
A ________ is a double-ended queue.

A) two-headed stack
B) two-tailed vector
C) circular array
D) deque
E) None of the above
Question
A ________ stack or queue is implemented using linked lists.

A) dynamic
B) static
C) deque-based
D) floating point
E) None of the above
Question
The ________ operation allows an item to be stored on a stack.

A) append
B) add
C) pop
D) push
E) None of the above
Question
The statement stack< int, vector > iStack; creates

A) a new stack of integers, implemented as a vector.
B) a new stack of integers, implemented as a deque.
C) a new stack called vector, implemented as integers.
D) a new vector called stack, implemented with integers.
E) None of the above
Question
A(n) ________ is an abstract data type that stores and retrieves items in a last-in-first-out manner.

A) array
B) queue
C) stack
D) vector
E) None of the above
Question
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 the above
Question
For most people, ________ 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 the above
Question
A real-world example of the queue data structure can be seen in a stack of cafeteria trays, where the last tray pushed onto the stack is the first tray removed.
Question
Static stacks have a ________ size, and are implemented using ________.

A) fixed, linked lists
B) variable, arrays
C) fixed, arrays
D) variable, linked lists
E) None of the above
Question
Stacks are useful data structures for algorithms that work with lists of items in a

A) first in, first out order.
B) first in, last out order.
C) last in, last out order.
D) garbage in, garbage out order.
E) None of the above
Question
Two primary queue operations are

A) push and pop.
B) enqueue and dequeue.
C) insert and delete.
D) onqueue and offqueue.
E) None of the above
Question
The first item placed onto a stack is always the last item removed from the stack.
Question
The queue data structure is commonly applied in connection with

A) managing the order of print jobs.
B) communications software.
C) operating systems.
D) All of the above
E) None of the above
Question
Enqueue and dequeue are the two most common stack operations.
Question
The Standard Template Library offers a stack template that may be implemented as a

A) vector.
B) deque.
C) linked list.
D) All of the above
E) None of the above
Question
A ________ is a container that provides quick access to elements at the front and the back of the list.

A) stack
B) queue
C) deque
D) All of the above
E) None of the above
Question
A dynamic stack may be implemented as a(n) ________, and expand or shrink with each push or pop operation.

A) array
B) structure
C) linked list
D) A and B
E) None of the above
Question
A queue is a data structure that stores and retrieves items in a ________ manner.

A) last in, first out
B) first in, first out
C) first in, last out
D) random
E) None of the above
Question
The programmer must declare in advance the size of a dynamic stack or queue.
Question
The ________ operation allows an item to be removed from a stack.

A) push
B) pop
C) delete
D) remove
E) None of the above
Question
Stacks and queues can be implemented as arrays or linked lists.
Question
A stack has two primary operations called

A) push and pull.
B) push and pop.
C) insert and delete.
D) append and delete.
E) None of the above
Question
A stack that is implemented as a linked list is known as a deque.
Question
In a static stack class, the constructor function can dynamically allocate memory for the stack array.
Question
A practical application of the stack data type is

A) the storage of local variables in a function call.
B) the tracking of the order of entry into and exit from nested loops.
C) the tracking of the order of calls and returns of functions in a program.
D) All of the above
E) None of the above
Question
A ________ is processed in a manner similar to customers standing in a grocery check-out line: The first customer in line is the first served.

A) stack
B) vector
C) queue
D) All of the above
E) None of the above
Question
In a dequeue operation, the element at the ________ of the queue is removed.

A) middle
B) front
C) declaration
D) mid-point
E) None of the above
Question
A dynamic queue can be implemented as a

A) dynamic linked list.
B) fixed-length array.
C) fixed-length circular array.
D) All of the above
E) None of the above
Question
Queues that are implemented as arrays are called ________ queues.

A) dynamic
B) stack
C) static
D) deque
E) None of the above
Question
If information is transmitted faster than it can be processed, it can be held in a ________ while it awaits processing.

A) stack
B) queue
C) static array
D) static deque
E) None of the above
Question
Push and pop are the two most common queue operations.
Question
When an element is added to a queue, it is added to the rear. When an element is removed, it is removed from the

A) rear.
B) middle.
C) front.
D) All of the above
E) None of the above
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/36
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 18: Stacks and Queues
1
A static queue can be implemented as a

A) circular array.
B) stack.
C) dynamic linked list.
D) dynamic vector.
E) None of the above
A
2
A dynamic stack starts as an empty linked list.
True
3
The STL provides containers for deque and queue.
True
4
The pop function in the stack template of the STL does not return the value from the top of the stack.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
5
A ________ is a double-ended queue.

A) two-headed stack
B) two-tailed vector
C) circular array
D) deque
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
6
A ________ stack or queue is implemented using linked lists.

A) dynamic
B) static
C) deque-based
D) floating point
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
7
The ________ operation allows an item to be stored on a stack.

A) append
B) add
C) pop
D) push
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
8
The statement stack< int, vector > iStack; creates

A) a new stack of integers, implemented as a vector.
B) a new stack of integers, implemented as a deque.
C) a new stack called vector, implemented as integers.
D) a new vector called stack, implemented with integers.
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
9
A(n) ________ is an abstract data type that stores and retrieves items in a last-in-first-out manner.

A) array
B) queue
C) stack
D) vector
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
10
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 the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
11
For most people, ________ 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 the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
12
A real-world example of the queue data structure can be seen in a stack of cafeteria trays, where the last tray pushed onto the stack is the first tray removed.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
13
Static stacks have a ________ size, and are implemented using ________.

A) fixed, linked lists
B) variable, arrays
C) fixed, arrays
D) variable, linked lists
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
14
Stacks are useful data structures for algorithms that work with lists of items in a

A) first in, first out order.
B) first in, last out order.
C) last in, last out order.
D) garbage in, garbage out order.
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
15
Two primary queue operations are

A) push and pop.
B) enqueue and dequeue.
C) insert and delete.
D) onqueue and offqueue.
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
16
The first item placed onto a stack is always the last item removed from the stack.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
17
The queue data structure is commonly applied in connection with

A) managing the order of print jobs.
B) communications software.
C) operating systems.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
18
Enqueue and dequeue are the two most common stack operations.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
19
The Standard Template Library offers a stack template that may be implemented as a

A) vector.
B) deque.
C) linked list.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
20
A ________ is a container that provides quick access to elements at the front and the back of the list.

A) stack
B) queue
C) deque
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
21
A dynamic stack may be implemented as a(n) ________, and expand or shrink with each push or pop operation.

A) array
B) structure
C) linked list
D) A and B
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
22
A queue is a data structure that stores and retrieves items in a ________ manner.

A) last in, first out
B) first in, first out
C) first in, last out
D) random
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
23
The programmer must declare in advance the size of a dynamic stack or queue.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
24
The ________ operation allows an item to be removed from a stack.

A) push
B) pop
C) delete
D) remove
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
25
Stacks and queues can be implemented as arrays or linked lists.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
26
A stack has two primary operations called

A) push and pull.
B) push and pop.
C) insert and delete.
D) append and delete.
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
27
A stack that is implemented as a linked list is known as a deque.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
28
In a static stack class, the constructor function can dynamically allocate memory for the stack array.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
29
A practical application of the stack data type is

A) the storage of local variables in a function call.
B) the tracking of the order of entry into and exit from nested loops.
C) the tracking of the order of calls and returns of functions in a program.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
30
A ________ is processed in a manner similar to customers standing in a grocery check-out line: The first customer in line is the first served.

A) stack
B) vector
C) queue
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
31
In a dequeue operation, the element at the ________ of the queue is removed.

A) middle
B) front
C) declaration
D) mid-point
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
32
A dynamic queue can be implemented as a

A) dynamic linked list.
B) fixed-length array.
C) fixed-length circular array.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
33
Queues that are implemented as arrays are called ________ queues.

A) dynamic
B) stack
C) static
D) deque
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
34
If information is transmitted faster than it can be processed, it can be held in a ________ while it awaits processing.

A) stack
B) queue
C) static array
D) static deque
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
35
Push and pop are the two most common queue operations.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
36
When an element is added to a queue, it is added to the rear. When an element is removed, it is removed from the

A) rear.
B) middle.
C) front.
D) All of the above
E) None of the above
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 36 flashcards in this deck.