Exam 15: The Java Collections Framework
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
You need to access values in the opposite order in which they were added (last in, first out), and not randomly. Which collection type should you use?
(Multiple Choice)
4.8/5
(43)
Suppose we have two String objects and treat the characters in each string from beginning to end in the following way: With one string, we push each character on a stack. With the other string, we add each character to a queue. After processing both strings, we then pop one character from the stack and remove one character from the queue, and compare the pair of characters to each other. We do this until the stack and the queue are both empty. What does it mean if all the character pairs match?
(Multiple Choice)
4.8/5
(33)
You need to access values by an integer position. Which collection type should you use?
(Multiple Choice)
4.8/5
(32)
Suppose we create a deque (double-ended queue) data structure. It is basically a queue, with its addLast and removeFirst operations, but we also add the addFirst and removeLast operations. Which of the following is best modeled by the deque data structure?
(Multiple Choice)
4.8/5
(34)
Consider the following code snippet: LinkedList<String> words = new LinkedList<String>();
Words.addFirst("abc");
Words.addLast("def");
Words.addFirst("ghi");
System.out.print(words.removeLast());
System.out.print(words.removeFirst());
System.out.print(words.removeLast());
What will this code print when it is executed?
(Multiple Choice)
4.9/5
(41)
Consider the following code snippet: Queue<String> stringQueue = new LinkedList<String>();
StringQueue.add("ab");
StringQueue.add("abc");
StringQueue.add("a");
While (stringQueue.size() > 0)
{
System.out.print(stringQueue.remove() + ",");
}
What output will be produced when this code is executed?
(Multiple Choice)
4.9/5
(41)
Which of the following statements about hash tables is NOT correct?
(Multiple Choice)
4.8/5
(33)
You need to access values in the order in which they were added (first in, first out), and not randomly. Which collection type should you use?
(Multiple Choice)
4.8/5
(29)
To create a TreeSet for a class of objects, the object class must ____.
(Multiple Choice)
4.7/5
(39)
Which data structure would best be used for keeping track of a growing set of groceries to be purchased at the food market?
(Multiple Choice)
4.9/5
(34)
Consider the following code snippet: LinkedList<String> myLList = new LinkedList<String>();
MyLList.add("Mary");
MyLList.add("John");
MyLList.add("Sue");
ListIterator<String> iterator = myLList.listIterator();
Iterator.next();
Iterator.next();
Iterator.add("Robert");
Iterator.previous();
Iterator.previous();
Iterator.remove();
System.out.println(myLList);
What will be printed when this code is executed?
(Multiple Choice)
4.9/5
(35)
Which data structure would best be used for keeping track of bank customers waiting for a teller?
(Multiple Choice)
4.9/5
(42)
Assume you have created a linked list named myList that currently holds some number of String objects. Which of the following statements correctly adds a new element to the beginning of myList?
(Multiple Choice)
4.8/5
(35)
You need to access values in objects by a key that is not part of the object. Which collection type should you use?
(Multiple Choice)
4.9/5
(38)
Assume that you have declared a set named mySet to hold String elements. Which of the following statements will correctly insert an element into mySet?
(Multiple Choice)
4.8/5
(37)
Consider the following code snippet: PriorityQueue<String> stringQueue = new PriorityQueue<String>();
StringQueue.add("ab");
StringQueue.add("abc");
StringQueue.add("a");
While (stringQueue.size() > 0)
{
System.out.print(stringQueue.remove() + ",");
}
What output will be produced when this code is executed?
(Multiple Choice)
4.9/5
(39)
Which of the following statements about manipulating objects in a set is correct?
(Multiple Choice)
4.8/5
(32)
Assume you are using a doubly-linked list data structure with many nodes. What is the minimum number of node references that are required to be modified to remove a node from the middle of the list? Consider the neighboring nodes.
(Multiple Choice)
4.7/5
(37)
Showing 61 - 80 of 110
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)