Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structures and Algorithms - Prefinal Quiz

Total questions: 15

Worksheet time: 6mins

Name
Class
Date
1.

It is a type of queue where elements are processed based on their order either natural or custom.

a)

Priority Queue

b)

Array List

c)

Min Heap

d)

Max Heap

2.

Which of the following creates an empty set in Java?

a)

a = set()

b)

Set a = new HashSet ();

c)

A = set [ ]

d)

Set a = new TreeSet ();

3.

Which statement determine whether a map contains the value "Pre-final" with the PF identifier?

a)

thisMap.containsKey("Pre-final");

b)

thisMap.containsValue("PF");

c)

thisMap.containsKey("PF");

d)

thisMap.containsValue("Prefinal");

4.

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.

a)

Priority Queue

b)

Heap

c)

Array List

d)

Queue

5.

Priority Queues can be implemented in Java using the PriorityQueue class from the ___________ package.

a)

java.scanner

b)

Java.io

c)

java.linkedlist

d)

java.util

6.

A collection of elements where each element is unique.

a)

HashSet

b)

TreeSet

c)

Set

d)

LinkedHashSet

7.

This stores its elements in a hash table without a guaranteed order upon iteration.

a)

Set

b)

HashSet

c)

TreeSet

d)

LinkedHashSet

8.

This stores its elements in a special type of tree where elements are sorted either natural or custom during iteration.

a)

LinkedHashSet

b)

TreeSet

c)

HashSet

d)

Set

9.

A set of ordered pairs where elements are known as keys or identifiers and values or content.

a)

Set

b)

Map

c)

Priority Queue

d)

Array List

10.

A map can contain duplicate keys.

a)

True

b)

False

11.

Each key can map to several values.

a)

True

b)

False

12.

Maps in Python are known as dictionaries.

a)

True

b)

False

13.

Which statement maps the value "Pre-final" to the identifier named PF?

a)

thisMap.put("PF", "Pre-final");

b)

thisMap.put("Pre-final", "PF");

c)

thisMap.add("Pre-final", "PF");

d)

thisMap.add("PF", "Pre-final");

14.

Based on the following statements, which are the leaf nodes?

ArrayList<Integer> minHeap = new ArrayList<>();

Collections.addAll(minHeap, 2, 4, 5, 7, 8);

a)

5, 7, and 8

b)

4, 5, and 7

c)

2, 4, and 5

d)

7 and 8

15.

Set A = { 1, 3, 5, 7 }

Set B = { 2, 3, 4, 5 }

The difference of sets A and B (A - B) is _______?

a)

{ 3}

b)

{ 5 }

c)

{ 1, 7 }

d)

{ 3, 5}