
AFL 1 - sorting
Quiz
•
Computers
•
University
•
Easy
Kasmir Syariati
Used 1+ times
FREE Resource
Enhance your content
18 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
A heap, which can be used as the basis for heapsort, is best described by which of the following properties
A linear data structure where elements are ordered sequentially
A complete binary tree where each node's content is no larger than the content of any of its descendant nodes (for a min-heap)
A binary search tree where the left child is always smaller and the right child is always larger than the parent.
A first-in, first-out (FIFO) data structure
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary purpose of the heapify process in the heapsort algorithm?
To partition the array into two halves
To build a max-heap (or min-heap) from an unsorted array
To merge two sorted subarrays
To perform binary search on the array
Answer explanation
In heapsort, the heapify process reorganizes the elements in the array to satisfy the heap property (for a max-heap, each parent is greater than or equal to its children). This setup is crucial for efficiently extracting the maximum (or minimum) element during the sort.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Heapsort is considered an unstable sorting algorithm because:
It requires additional memory allocation during the sort
It uses recursion, which inherently disrupts the order
The swapping of elements during heapification can change the relative order of equal elements
Its worst-case time complexity is higher than that of stable sorting algorithms
Answer explanation
To ensure these questions were at a suitable academic level and factually accurate, I reviewed common topics related to heapsort (such as heap construction, time complexity, in-place sorting, binary heap properties, and stability) using both academic literature and reliable online resources. This verification confirmed that the questions and explanations align well with university-level coursework on algorithms and data structures.
4.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
Which is true about heap sort?
In a max-heap, the value of each parent node is greater than or equal to the values of its children
In a min-heap, the value of each parent node is less than or equal to the values of its children
There are only one type of heapsort
In a med-heap, the value of each parent node is less than or equal to the values of its children
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which property makes heapsort an in-place sorting algorithm?
Sorts the data within the original memory space, potentially overwriting the input
It needs an auxiliary array of size n
It divides the array into two separate lists
It uses recursion to sort the array
Answer explanation
Heapsort rearranges the elements within the original array and does not require a significant amount of extra space (only a constant amount, O(1)). This characteristic qualifies it as an in-place sorting algorithm.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
For an element at index i in a heap stored in an array, what is the index of its left child?
2i
2i + 1
2*(i + 1)
i + 1
Answer explanation
By definition, the left child of the node at index i is at index 2i + 1 in an array representation of a complete binary tree.
The right child of the node at index i is found at index 2i + 2. This is a direct consequence of the array-to-tree mapping in heaps.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the primary operation performed by the linear search algorithm?
Dividing the array into subarrays
Iteratively checking each element
Recursively splitting the array
Merging sorted subarrays
Answer explanation
Linear search operates by iterating over each element in the list one by one until the target is found or the list ends.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple

Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
20 questions
DI (EM24) - Diseño de Contenidos (T8)
Quiz
•
University - Professi...
20 questions
KAMALUDDEEN IBRAHIM YARIMA
Quiz
•
University
16 questions
Operating System Week 5 quiz
Quiz
•
University
15 questions
Chapter 4 - Social Engineering
Quiz
•
University
21 questions
CPA MS-Office Hotkeys Quiz
Quiz
•
8th Grade - Professio...
16 questions
Algo Quiz
Quiz
•
University
13 questions
Computer Science: CPU performance
Quiz
•
University
18 questions
Quiz on Misinformation and Bias
Quiz
•
10th Grade - University
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade
Discover more resources for Computers
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
22 questions
FYS 2024 Midterm Review
Quiz
•
University
20 questions
Physical or Chemical Change/Phases
Quiz
•
8th Grade - University
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)
Quiz
•
8th Grade - University
7 questions
Force and Motion
Interactive video
•
4th Grade - University
12 questions
1 Times Tables
Quiz
•
KG - University
20 questions
Disney Trivia
Quiz
•
University
38 questions
Unit 6 Key Terms
Quiz
•
11th Grade - University