Deck 4: Linked Structures - Stacks
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/51
Play
Full screen (f)
Deck 4: Linked Structures - Stacks
1
A data structure that uses object reference variables to create links between objects is:
A) Linked Structure
B) Pointer
C) Self-referential
D) Array
A) Linked Structure
B) Pointer
C) Self-referential
D) Array
Linked Structure
2
What is the principle difference in behavior between a stack and a queue?
A) a stack reverses order whereas a queue preserves order
B) a stack does nothing whereas a queue can preserve and reverse order
C) there is no difference
D) a stack preserves order whereas a queue reverses order
A) a stack reverses order whereas a queue preserves order
B) a stack does nothing whereas a queue can preserve and reverse order
C) there is no difference
D) a stack preserves order whereas a queue reverses order
a stack reverses order whereas a queue preserves order
3
Stacks operate as _______________.
A) Last Out, First In
B) First In, First Out
C) Last In, First Out
D) None of the above
A) Last Out, First In
B) First In, First Out
C) Last In, First Out
D) None of the above
Last Out, First In
4
A ______ can be used to reverse the order of a set of data.
A) Queue
B) Stack
C) Software
D) Heaps
A) Queue
B) Stack
C) Software
D) Heaps
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
5
A pop operation on a Stack returns a(n)
A) node
B) element
C) variable
D) pointer
A) node
B) element
C) variable
D) pointer
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
6
Object reference variables can be used to create ___________.
A) Arrays
B) Class Diagrams
C) Linked Structures
D) None of the above
A) Arrays
B) Class Diagrams
C) Linked Structures
D) None of the above
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
7
To add an element to a stack you use the method.
A) push
B) pop
C) peek
D) size
A) push
B) pop
C) peek
D) size
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
8
Elements in a collection are typically organized by
A) the order of their addition to the collection
B) by some inherent relationship among the elements
C) randomly
D) A and B
E) None of the above
A) the order of their addition to the collection
B) by some inherent relationship among the elements
C) randomly
D) A and B
E) None of the above
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
9
A linked implementation of a stack adds and removes elements from the _______ of the linked list.
A) Front
B) Rear
C) Middle
D) None of the above
A) Front
B) Rear
C) Middle
D) None of the above
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
10
When two object references refer to the same object, the references are called ____ of each other.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
11
A linked list is ____ where as an array is ______.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
12
When all references to an object are lost and the object can no longer be used, JAVA uses ______ to free up the memory taken up by the unreferenced object.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
13
A ______ is an object that gathers and organizes other objects.If you were to place elements on a collection and then wanted to reverse the order, would it be better to use a Stack or a Queue?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
14
What are the 3 primary methods for a stack?_______
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
15
A linked list is composed of objects that each point to the ______.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
16
Any implementation of a ______ can be used to solve a problem as long as it validly implements the appropriate operations.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
17
______ processing can be simulated using a stack to keep track of the appropriate data.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
18
If an exception occurs during the execution of a java program and is not handled in the method where it occurs, the exception will be ______.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
19
A __ is a Java language element used to group related classes under a common name.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
20
A collection is an ______ where the details of the implementation are hidden.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
21
A Java interface defines a set of ______ methods and is useful in separating the concept of an abstract data type from its implementation.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
22
A linked list has no set capacity limitations other than the size of the computers memory.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
23
A linked structure uses object reference variables to link one object to another.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
24
The order in which references are changed is crucial to maintaining a linked list.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
25
The pop operation is implemented by returning a reference to the element currently stored at the top of the stack and adjusting the top reference to the new top of the stack.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
26
Stack elements are processed in a FIFO manner-the first element in is the first element out.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
27
A linked list dynamically grows as needed and essentially has no capacity limitations.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
28
Implementing a list with a sentinel node or dummy node as the first node eliminates the special cases dealing with the first node.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
29
Objects that are stored in a collection should contain implementation details of the underlying data structure.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
30
What is a collection?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
31
What is a data type?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
32
What is an abstract data type?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
33
What is abstraction and what advantage does it provide?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
34
Why is a class an excellent representation of an abstract data type?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
35
What is the characteristic behavior of a stack?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
36
What are some of the other operations that might be implemented for a stack?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
37
What is key to remember when handling linked lists?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
38
Explain how a linked list is formed using object reference variables.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
39
How do object references help us define data structures?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
40
Compare and contrast a linked list and an array.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
41
What special case exists when managing linked lists?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
42
Why should a linked list node be separate from the element stored on the list?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
43
What do the LinkedStack and ArrayStack classes have in common?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
44
What would be the time complexity of the push operation if we chose to push at the end of the list instead of the front?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
45
What is the difference between a doubly linked list and a singly linked list?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
46
What impact would the use of sentinel nodes or dummy nodes have upon a doubly linked list implementation?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
47
What are the advantages to using a linked implementation as opposed to an array implementation?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
48
What are the advantages to using an array implementation as opposed to a linked implementation?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
49
What are the advantages of the java.util.Stack implementation of a stack?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
50
What is the potential problem with the java.util.Stack implementation?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
51
What is the advantage of postfix notation?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck