Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

QR Code Attendance Procedures Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following is an advantage of linked ADTs over their array-based counterparts?

a)

Resizing is not needed

b)

Requires resizing frequently

c)

Consumes more memory compared to a mostly full array

d)

No random access

2.

What is a disadvantage of linked ADTs compared to array-based ADTs?

a)

Consumes more memory compared to a mostly full array

b)

O(1) initialisation

c)

Saves more memory with mostly empty slots

d)

Allows random access

3.

Why might a linked ADT save more memory than an array-based ADT?

a)

Because it saves more memory compared to an array ADT with mostly empty slots

b)

Because it always uses less memory than any array

c)

Because it allows random access

d)

Because it requires resizing

4.

Which of the following statements about random access is true for linked ADTs?

a)

Linked ADTs do not support random access, which is an issue for List ADT but not for Stack & Queues

b)

Linked ADTs support random access for all ADTs

c)

Linked ADTs support random access only for Stack ADT

d)

Linked ADTs support random access only for Queue ADT

5.

A student is designing a data structure for a list that will frequently change in size and may have many empty slots if implemented as an array. Which data structure would be more memory efficient and why?

a)

Linked ADT, because it saves more memory compared to an array ADT with mostly empty slots

b)

Array-based ADT, because it always uses less memory

c)

Array-based ADT, because it allows random access

d)

Linked ADT, because it requires resizing

6.

What is the main difference in the add operation between Separate Chaining and Linear Probing techniques in hash tables?

a)

Separate Chaining uses a binary search tree, while Linear Probing uses a linked list.

b)

Separate Chaining traverses a linked list at the hashed index, while Linear Probing searches for the next empty position linearly.

c)

Separate Chaining uses linear search, while Linear Probing uses binary search.

d)

Separate Chaining and Linear Probing both use the same method to resolve collisions.

7.

What is the time complexity of the add operation for both Separate Chaining and Linear Probing in the worst case?

a)

O(1)

b)

O(hash(k) + n*comp)

c)

O(n2)O(n^2)

d)

O(log n)

8.

Which of the following statements is true regarding the comparison of complexities between Separate Chaining and Linear Probing add operations?

a)

Linear Probing always has better complexity than Separate Chaining.

b)

Separate Chaining always has better complexity than Linear Probing.

c)

Both techniques have the same complexity for the add operation.

d)

Neither technique can be analysed for complexity.

9.

In Separate Chaining, what is the purpose of traversing the linked list at the hashed index during the add operation?

a)

To find the maximum value in the list.

b)

To ensure the input key does not already exist in the list.

c)

To sort the elements in the list.

d)

To delete duplicate elements.

10.

If the hashed index is already occupied in Linear Probing, what is the next step in the add operation?

a)

Rehash the key using a different function.

b)

Traverse the linked list at that index.

c)

Linearly probe to the next empty position.

d)

Discard the new key.

11.

What is the time complexity of the serve() operation in a linked queue in both best and worst cases?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n2)O(n^2)

12.

When the append() method is called on an empty linked queue, what does it do?

a)

It sets self.front and self.rear to be the new node

b)

It removes the front node

c)

It updates self.front to its next element

d)

It sets self.rear to None

13.

Which of the following statements is true about the time complexity of serve() and append() in linked queues?

a)

Both have O(1) time complexity in best and worst cases

b)

Both have O(n) time complexity in best and worst cases

c)

Serve() is O(1), but append() is O(n)

d)

Append() is O(1), but serve() is O(n)

14.

Are the time complexities of serve() and append() in linked queues better than those in default circular queues?

a)

No, they are not better

b)

Yes, they are better

c)

They are significantly worse

d)

They are unpredictable

15.

Why do serve() and append() operations in linked queues have O(1) complexity?

a)

Because they only involve constant time operations to the rear/front pointer

b)

Because they require traversing the entire queue

c)

Because they use recursion

d)

Because they sort the queue

16.

Which of the following statements best describes why the default QuickSort algorithm is considered unstable?

a)

It always maintains the original order of equal elements.

b)

It partitions arrays chaotically, performing swaps without tracking the original order.

c)

It merges subarrays by always considering the right subarray first.

d)

It sorts elements by converting them into tuples.

17.

What makes MergeSort a stable sorting algorithm?

a)

It always swaps elements with equal values.

b)

It merges subarrays by considering the left subarray first if two elements are equal.

c)

It partitions arrays randomly.

d)

It does not maintain the relative order of equal elements.

18.

How can QuickSort be made stable?

a)

By always swapping the largest element first.

b)

By converting the list of elements into a list of tuples (element, index) and comparing by both element and index.

c)

By merging subarrays in reverse order.

d)

By ignoring the original order of elements.

19.

In a scenario where stability is important, which sorting algorithm would be a better choice by default?

a)

QuickSort

b)

MergeSort

c)

Bubble Sort

d)

HeapSort

20.

Suppose you have a list of student records with equal scores. Why would you prefer a stable sorting algorithm in this case?

a)

To ensure the fastest sorting time.

b)

To maintain the original order of students with equal scores.

c)

To use less memory during sorting.

d)

To randomly shuffle the records.