Exam 15: The Java Collections Framework

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When using a list iterator, on which condition will the NoSuchElementException be thrown?

(Multiple Choice)
4.9/5
(42)

Assume that you have declared a map named myMap to hold String elements with Integer keys. Which of the following statements will correctly remove an element from myMap?

(Multiple Choice)
4.9/5
(35)

You have decided to store objects of a class in a TreeSet structure. Which of the following statements is correct?

(Multiple Choice)
4.8/5
(31)

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)

Which of the following statements about manipulating objects in a map is NOT correct?

(Multiple Choice)
4.7/5
(36)

Which of the following statements about linked lists is correct?

(Multiple Choice)
4.8/5
(42)

Which method is NOT part of the ListIterator generic class?

(Multiple Choice)
4.9/5
(38)

Suppose you push integer elements 1,2,3,4 onto a stack in that order. Then pop an element off the stack and add that element to a queue. You repeat that process three more times. In what order will you remove the elements from the queue?

(Multiple Choice)
4.9/5
(43)

Consider the following code snippet: LinkedList<String> words = new LinkedList<String>(); Words.addLast("abc"); Words.addLast("def"); Words.addLast("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.8/5
(36)

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.8/5
(36)

What type of access does a LinkedList provide for its elements?

(Multiple Choice)
4.9/5
(36)

Which of the following statements about data structures is correct?

(Multiple Choice)
4.7/5
(34)

Which of the following algorithms would be efficiently executed on an ArrayList?

(Multiple Choice)
4.8/5
(40)

What operation is least efficient in a LinkedList?

(Multiple Choice)
4.8/5
(34)

A collection that remembers the order of items, and allows items to be added and removed only at one end is called a ____.

(Multiple Choice)
4.8/5
(42)

What can a generic class be parameterized for?

(Multiple Choice)
4.8/5
(41)

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.8/5
(33)

Which of the following statements about the TreeSet class is NOT correct?

(Multiple Choice)
4.7/5
(41)

Complete the following code, which is intended to print out all key/value pairs in a map named myMap that contains String data for student IDs and names: Map<String, String> myMap = new HashMap<String, String>(); ) . . Set<String> mapKeySet = myMap.keySet(); For (String aKey : mapKeySet) { ___________________________; System.out.println("ID: " + aKey + "->" + name); }

(Multiple Choice)
4.7/5
(43)

Complete the following code snippet, which is intended to determine if a specific value in a variable named targetWord appears in a set of String values named mySet: For (String aWord : mySet) { _______________________ { System.out.println ("The word " + targetWord + " was found."); } )

(Multiple Choice)
4.8/5
(32)
Showing 41 - 60 of 100
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)