Deck 15: Linked Data Structures
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/43
Play
Full screen (f)
Deck 15: Linked Data Structures
1
Recursively visiting the left subtree,right subtree and then the root describes:
A)preordering processing
B)inorder processing
C)postorder processing
D)none of the above
A)preordering processing
B)inorder processing
C)postorder processing
D)none of the above
C
2
A _____________ copy of an object is a copy that has references in common with the original object.
A)bit copy
B)deep copy
C)shallow copy
D)none of the above
A)bit copy
B)deep copy
C)shallow copy
D)none of the above
C
3
To use the Java Iterator Interface you must import the ____________ package.
A)java.tools
B)java.linkedlist
C)java.iterator
D)java.util
A)java.tools
B)java.linkedlist
C)java.iterator
D)java.util
D
4
A linked data structure contains nodes and links.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
5
Java contains a mechanism that automatically reclaims memory.This mechanism is called:
A)Garbage elimination
B)Garbage collection
C)Taking out the trash
D)None of the above
A)Garbage elimination
B)Garbage collection
C)Taking out the trash
D)None of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
6
Making the Node class a private inner class of a linked data structure is an example of:
A)polymorphism
B)encapsulation
C)inheritance
D)all of the above
A)polymorphism
B)encapsulation
C)inheritance
D)all of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
7
If the head instance variable of a linked list contains a reference to null,this means the list is:
A)full
B)empty
C)lost
D)none of the above
A)full
B)empty
C)lost
D)none of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
8
Recursively visiting the root node,left subtree and then the right subtree describes:
A)preorder processing
B)inorder processing
C)postorder processing
D)none of the above
A)preorder processing
B)inorder processing
C)postorder processing
D)none of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
9
In Java,you indicate the end of a linked list be setting the link instance variable of the last node in the linked list to __________.
A)0
B)-1
C)1
D)null
A)0
B)-1
C)1
D)null
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
10
A ____________ copy of an object is a copy that has no references in common with the original object.
A)bit copy
B)deep copy
C)shallow copy
D)none of the above
A)bit copy
B)deep copy
C)shallow copy
D)none of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
11
The _________ node is the first node in the tree data structure.
A)leaf
B)root
C)sibling
D)branch
A)leaf
B)root
C)sibling
D)branch
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
12
When using a linked list,you do not need to know when the end of the list has been reached.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
13
Java does not come with a LinkedList library class.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
14
A _________________ maps a data value such as a String into a number:
A)recursive function
B)key function
C)hash function
D)none of the above
A)recursive function
B)key function
C)hash function
D)none of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
15
A binary tree has exactly _________ link instance variables.
A)zero
B)one
C)two
D)three
A)zero
B)one
C)two
D)three
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
16
A node contains:
A)data items)
B)references)to another node
C)both A and B
D)none of the above
A)data items)
B)references)to another node
C)both A and B
D)none of the above
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
17
A ____________ linked list has nodes that contain two references to Nodes.
A)circular
B)sequential
C)doubly
D)one-way
A)circular
B)sequential
C)doubly
D)one-way
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
18
The first node in a linked list is commonly referred to as the ________ node.
A)head
B)tail
C)predecessor
D)successor
A)head
B)tail
C)predecessor
D)successor
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
19
In Java,a node is a/an:
A)String
B)Integer
C)Object
D)Exception
A)String
B)Integer
C)Object
D)Exception
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
20
A common exception that occurs when using linked lists is the:
A)NodeOutOfBoundsException
B)NodeEmptyException
C)NullPointerException
D)NullNodeOccurredException
A)NodeOutOfBoundsException
B)NodeEmptyException
C)NullPointerException
D)NullNodeOccurredException
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
21
What is the result of a preorder traversal of the binary search tree created in question 12 above?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
22
Redraw the diagram created in number 4 above after deleting the head node.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
23
Redraw the diagram created in number 3 above,after deleting the node containing Chicago.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
24
Given the Node class created in number 6 above,write Java statements to insert a new node containing Chattanooga,23.7)into an empty list.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
25
Forgetting to set the reference instance variable of the last node in a linked list to null will cause a logic error.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
26
A deep copy of an object is a copy that has references in common with the original object.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
27
Create a generic Node class to represent the linked list depicted in your diagrams above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
28
A stack cannot be represented as a linked list.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
29
Linked lists introduce the possibility of a privacy leak occurring.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
30
Write a method called displayList that displays the data items in the Node class created in number 6 above.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
31
What is the binary search tree storage rule?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
32
Draw a diagram of a linked list that contains nodes with data items of type String that contains the name of a city and type double that contains a pollution index.Include an instance variable named head to indicate the beginning of the list.Insert the following nodes: Franklin,15.7,Chicago,23.2,Denver,7.2.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
33
An iterator is any object that allows you to step through the list one item at a time.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
34
A queue is a last-in/first-out structure.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
35
What is the function of the variable head when used with a linked list? What is the data type of the head variable?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
36
Redraw the diagram created in number 2 above after inserting a node containing Chattanooga,27.6.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
37
A copy constructor and a clone method should normally make a deep copy whenever possible.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
38
Draw the resulting binary search tree inserting the following values in the given order: 7,10,5,12,1,3,9.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
39
If you define a clone method,the class should implement the Cloneable interface.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
40
Given the Node class created in number 6 above,write Java statements to delete a node from the beginning of the list.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
41
What is the result of an inorder traversal of the binary search tree created in question 12 above?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
42
Discuss the differences between a queue and a stack.
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck
43
What is the result of a postorder traversal of the binary search tree created in question 12 above?
Unlock Deck
Unlock for access to all 43 flashcards in this deck.
Unlock Deck
k this deck