WorksheetsData Structures and Algorithms - Prefinal Quiz
Total questions: 15
Worksheet time: 6mins
It is a type of queue where elements are processed based on their order either natural or custom.
Priority Queue
Array List
Min Heap
Max Heap
Which of the following creates an empty set in Java?
a = set()
Set a = new HashSet ();
A = set [ ]
Set a = new TreeSet ();
Which statement determine whether a map contains the value "Pre-final" with the PF identifier?
thisMap.containsKey("Pre-final");
thisMap.containsValue("PF");
thisMap.containsKey("PF");
thisMap.containsValue("Prefinal");
It is a complete binary tree where the value of each parent node is either higher or lower than the value of its child nodes.
Priority Queue
Heap
Array List
Queue
Priority Queues can be implemented in Java using the PriorityQueue class from the ___________ package.
java.scanner
Java.io
java.linkedlist
java.util
A collection of elements where each element is unique.
HashSet
TreeSet
Set
LinkedHashSet
This stores its elements in a hash table without a guaranteed order upon iteration.
Set
HashSet
TreeSet
LinkedHashSet
This stores its elements in a special type of tree where elements are sorted either natural or custom during iteration.
LinkedHashSet
TreeSet
HashSet
Set
A set of ordered pairs where elements are known as keys or identifiers and values or content.
Set
Map
Priority Queue
Array List
A map can contain duplicate keys.
True
False
Each key can map to several values.
True
False
Maps in Python are known as dictionaries.
True
False
Which statement maps the value "Pre-final" to the identifier named PF?
thisMap.put("PF", "Pre-final");
thisMap.put("Pre-final", "PF");
thisMap.add("Pre-final", "PF");
thisMap.add("PF", "Pre-final");
Based on the following statements, which are the leaf nodes?
ArrayList<Integer> minHeap = new ArrayList<>();
Collections.addAll(minHeap, 2, 4, 5, 7, 8);
5, 7, and 8
4, 5, and 7
2, 4, and 5
7 and 8
Set A = { 1, 3, 5, 7 }
Set B = { 2, 3, 4, 5 }
The difference of sets A and B (A - B) is _______?
{ 3}
{ 5 }
{ 1, 7 }
{ 3, 5}
