1/46
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
T or F: The first item placed onto a stack is always the last item removed from the stack.
false
T or F: A dynamic stack starts as an empty linked list.
true
T or F: The pop function in the stack template of the STL does not retrieve the value from the top of the stack; it merely removes it.
true
T or F: The two most common queue operations are endeque and deque.
false
T or F: The STL provides containers for deque and queue.
false
T or F: 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.
false
T or F: In a static stack class, the constructor function can dynamically allocate memory for the stack array.
true
T or F: Stacks and queues can be implemented as arrays or linked lists.
true
T or F: The programmer must declare in advance the size of a dynamic stack or queue.
false
T or F: A stack that is implemented as a linked list is known as a deque.
true
T or F: The two most common queue operations are push and pop.
false
T or F: When the program knows the exact contents of a list and can access any element on demand, the data structure is known as a stacked deque.
false
T or F: For a compiler that is older than C++11 it is necessary to put spaces between the angled brackets that appear next to each other when defining a stack.
false
T or F: Computer systems use stacks. For example, when a function is called, they create local variables on a stack which are removed from the stack when the function terminates.
True
A(n) ________ is an abstract data type that stores and retrieves items in a last-in-first-out manner.
stack
A dynamic stack has a ________ size and is implemented as a(n) ________.
variable, linked list
The ________ operation allows an item to be stored on a stack.
push
What does the following statement indicate?
stack< int, vector > iStack;
a new stack named vector, implemented as integers
Two primary queue operations are
enqueue and dequeue
The two primary stack operations are
push and pop
The ________ operation allows an item to be removed from the stack.
pop
A stack queue can be implemented as a
circular array
Which of the following is a double-ended queue?
- two-headed stack
- two-tailed vector
- circular array
- deque
- None of these
deque
A ________ stack or queue is built around the linked list.
dynamic
A container that provides quick access to elements at the front and the back of the list is a
deque
A ________ queue is more intuitive and easier to understand than a ________ queue.
dynamic, static
Stacks are useful data structures for algorithms that work ________ with the ________ saved element in the series.
first, last
Static stacks have a ________ size and are implemented as ________.
fixed, arrays
A dynamic stack may be implemented as a(n) ________ and can expand or shrink with each push or pop operation.
linked list
A queue is a data structure that stores and retrieves item in the ________ manner.
first in, last out manner
A ________ is processed in a manner similar to customers standing in a grocery store check-out line where the first customer in line is the first to be served.
queue
When an element is added to a queue, it is added to the rear. When an element is removed from the queue, it is removed from the
front
In a dequeue operation, the element at the ________ of the queue is removed.
front
A dynamic queue can be implemented as a
dynamic linked list
Queues that are implemented as arrays are called ________ queues.
static
If data is transmitted faster than it can be processed, it can be held in a ________ for processing.
queue
A stack can be adapted to store ________ data types.
all
Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable.
Assume that the pop function, called on line 4, stores the number popped from the stack in the value variable. What will the statement on line 5 display?
2
Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable.
Assume that the pop function, called on lines 4, 5, and 6, stores the number popped from the stack in the value variable. What will the statement on line 7 display?
0
Given the following code, assume the myStack object is a stack that can hold integers and that value is an int variable.
Assume that the pop function, called on lines 4 and 6, stores the number popped from the stack in the value variable. What will the statement on line 7 display?
3
Given the following code, assume the myQueue object is a queue that can hold integers and that value is an int variable.
Assume that the dequeue function, called on line 4, stores the number removed from the queue in the value variable. What will the statement on line 5 display?
0
Given the following code, assume the myQueue object is a queue that can hold integers and that value is an int variable.
Assume that the dequeue function, called on lines 4, 5, and 6, stores the number removed from the queue in the value variable. What will the statement on line 7 display?
2
Given the following code, assume the myQueue object is a queue that can hold integers and that value is an int variable.
Assume that the dequeue function, called on lines 4 and 6, stores the number removed from the queue in the value variable. What will the statement on line 7 display?
1
Multiple answers: The Standard Template Library offers a stack template that may be implemented as a(n)
vector
primary type
linked list
deque
vector
linked list
deque
Multiple answers: The queue data structure is commonly applied in connection with
managing the order of print jobs
communications software
operating systems
None of these
managing the order of print jobs
communications software
operating systems
Multiple answers: Data structures that can dynamically store elements and can grow and shrink in size are
stacks
arrays
queues
deques
stacks
queues
deques
Multiple answers: A practical application of the stack data type in a computer system is
storage of local variables
tracking nested loops
tracking nested function calls
None of these
storage of local variables
tracking nested loops
tracking nested function calls