Exam 16: Basic Data Structures
Exam 1: Introduction96 Questions
Exam 2: Fundamental Data Types103 Questions
Exam 3: Decisionseasy99 Questions
Exam 4: Loops100 Questions
Exam 5: Methods94 Questions
Exam 6: Arrays and Arraylists100 Questions
Exam 7: Inputoutput and Exception Handling100 Questions
Exam 8: Objects and Classes101 Questions
Exam 9: Inheritance and Interfaces99 Questions
Exam 10: Graphical User Interfaces54 Questions
Exam 11: Advanced User Interfaces91 Questions
Exam 12: Object-Oriented Design100 Questions
Exam 13: Recursion100 Questions
Exam 14: Sorting and Searching99 Questions
Exam 15: The Java Collections Framework100 Questions
Exam 16: Basic Data Structures94 Questions
Exam 17: Tree Structures100 Questions
Exam 18: Generic Classes78 Questions
Exam 19: Streams and Binary Inputoutput82 Questions
Exam 20: Multithreading82 Questions
Exam 21: Internet Networking74 Questions
Exam 22: Relational Databases75 Questions
Exam 23: XML74 Questions
Exam 24: Web Applications74 Questions
Select questions type
Which of the following actions must be taken to add a node X at the end of a doubly-linked list?
I Update the next reference in the node before the position where X will be placed
II Update the previous reference in the node before the position where X will be placed
III Update the list's last reference
(Multiple Choice)
4.8/5
(40)
Elements in a hash table are said to ____ when they have the same hash code value.
(Multiple Choice)
4.9/5
(31)
Insert the missing code in the following code fragment. This fragment is intended to remove a node from the head of a linked list:
Public class LinkedList
{
) . .
Public Object removeFirst()
{
If (first == null) { ________________ }
Object element = first.data;
First = first.next; 1
Return element;
}
) . .
}
(Multiple Choice)
4.8/5
(31)
Using the textbook's implementation of a linked list, which of the following statements about managing nodes within a linked list using an iterator is correct?
(Multiple Choice)
5.0/5
(37)
Consider the following code snippet:
LinkedList<String> words = new LinkedList<String>();
Words.addFirst("xyz");
Words.addLast("jkl");
Words.addLast("def");
System.out.print(words.removeFirst());
System.out.print(words.removeLast());
System.out.print(words.removeLast());
What does this code print?
(Multiple Choice)
4.9/5
(37)
What feature of the ArrayList class makes it much better for a binary search than the LinkedList class?
(Multiple Choice)
4.8/5
(32)
Insert the missing code in the following code fragment. This fragment is intended to add a new node to the head of a linked list:
Public class LinkedList
{
) . .
Public void addFirst(Object element)
{
Node newNode = new Node(); 1
NewNode.data = element;
_________ 2
_________ 3
}
) . .
}
(Multiple Choice)
4.8/5
(35)
Which of the following statements about hash tables is correct?
(Multiple Choice)
4.8/5
(45)
Which statement about handling collisions in a hash table using the open addressing technique is correct?
(Multiple Choice)
4.7/5
(40)
In the textbook implementation, the LinkedListIterator class is a private inner class of the LinkedList class. Which of the following statements regarding this implementation is NOT correct?
(Multiple Choice)
4.8/5
(40)
An array list maintains a reference to an array of elements called a ____.
(Multiple Choice)
4.9/5
(33)
Adding or removing an arbitrary element in the middle of an array list takes ____ time.
(Multiple Choice)
4.8/5
(35)
Which of the following actions must be taken to add a node X at the beginning of a doubly-linked list?
I Update the next reference in the node before the position where X will be placed
II Update the previous reference in the node after the position where X will be placed
III Update the list's first reference
(Multiple Choice)
4.8/5
(40)
Suppose we maintain an array A of n int values as follows:
A[0] < A[1] < . . . < A[i] > A[i + 1] > A[i + 2] > . . . > A[n - 1]
The ith element is the maximum in the array. What would be the lowest big-Oh notation for finding that element? Consider a variation of the binary search.
(Multiple Choice)
4.8/5
(36)
Complete the following code, which is intended to add an element to the top of a stack implemented as a linked list.
Node newNode = new Node();
NewNode.data = element;
_________________
_________________
(Multiple Choice)
4.9/5
(36)
If we want a create a doubly-linked list data structure so that we can move from a node to the next node as well as to a previous node we need to add a previous reference to the Node class. Each such DNode (doubly-linked Node) will have a data portion and two DNode references, next and previous. How many references need to be updated when we remove a node from the beginning of a list with many nodes? Consider the first reference and neighboring node(s).
(Multiple Choice)
4.9/5
(37)
Consider the following code snippet, which computes h, the array index for storing x in a hash table.
Int h = x.hashCode();
If (h < 0) { h = -h; }
H = h % size;
What does size correspond to?
(Multiple Choice)
4.7/5
(37)
What is included in a linked list node?
I a reference to the next node
II an array reference
III a data element
(Multiple Choice)
4.8/5
(36)
Using the textbook's implementation of a singly linked list and linked list iterator, the following steps are required to remove a node from the middle of a linked list. Place these steps into the order in which they should be performed.
I The preceding node's next reference must be updated to skip the removed node.
II The iterator's position reference must be set to the previous reference.
III The previous reference must be checked to see if it is equal to the position reference.
(Multiple Choice)
4.8/5
(33)
Suppose we maintain a linked list of length n in sorted order. What would be the big-Oh notation for the add operation?
(Multiple Choice)
4.8/5
(38)
Showing 61 - 80 of 94
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)