WorksheetsITCC104: FINAL EXAMINATION
Total questions: 76
Worksheet time: 41mins
Why is Bubble Sort called “Bubble” Sort?
It uses a heap-like structure.
It divides the array in half repeatedly.
Larger values the top as they swap
It selects the minimum value and moves it to the front.
What makes Insertion Sort efficient for nearly sorted arrays?
It always runs in O(n²) time regardless of input.
It uses a binary tree to store values.
It performs fewer comparisons and shifts when data is nearly sorted
It divides the array using pivot elements.
How does Selection Sort differ from Bubble Sort in process?
Bubble Sort selects the smallest item directly.
Selection Sort finds the smallest and swaps it once per pass
Bubble Sort only works on even-sized arrays.
d. Selection Sort only works with strings.
Selection Sort only works with strings.
What does the divide-and-conquer approach mean in Merge Sort?
It swaps values from left to right.
It places maximum values at the end.
It breaks the array into parts, sorts them, and merges
It deletes half of the data in each step.
Which characteristic best explains why Heap Sort is not a stable algorithm?
The rearrangement in heap structure changes equal elements' order
It merges elements too quickly.
It sorts elements without comparison.
It adds new values during the sorting process.
How does Quick Sort choose where to divide the list?
Based on the largest value in the array
It picks a pivot and partitions around it
It uses the mean of the array
It randomly swaps elements
In what situation would Merge Sort be preferred over Quick Sort?
When the data is small
When stability is not important
When consistent performance is needed in worst-case scenarios
When memory usage is a major concern
Why is Heap Sort suitable for large datasets with no memory constraints?
It has the fastest time in all cases
It guarantees O(n log n) time and doesn’t require stability
It uses recursion to store values
It modifies the input data completely
What concept explains how Insertion Sort places each element in its correct location?
Bubble logic
Partitioning and pivoting
Comparing and shifting into the sorted part
Binary tree traversal
Why might Bubble Sort be a poor choice for sorting large datasets?
It uses too much memory
It makes many unnecessary comparisons and swaps
It requires multiple arrays
It cannot handle strings
What makes Insertion Sort more efficient for nearly sorted arrays than Bubble Sort?
It skips unnecessary comparisons
It only shifts elements instead of swapping many times
It sorts from the middle
It uses binary search to place elements
What makes Insertion Sort more efficient for nearly sorted arrays than Bubble Sort?
It skips unnecessary comparisons
It only shifts elements instead of swapping many times
It sorts from the middle
It uses binary search to place elements
Why is Heap Sort not stable even if it sorts correctly?
It uses extra memory
It fails to sort large numbers
Equal elements may be reordered during heap operations
It doesn't divide the array
How does the number of swaps in Bubble Sort compare to Selection Sort?
Bubble Sort performs more swaps due to repeated comparisons
Selection Sort swaps on every comparison
Both swap the same number of times
Bubble Sort only swaps once per pass
A student claims Insertion Sort is faster than Merge Sort. In which case might they be correct?
When sorting large random datasets
When working with external storage
When the input list is almost sorted
When the list has many duplicates
Why is Merge Sort preferred over Quick Sort in real-time systems?
It’s easier to code
It guarantees consistent performance regardless of input
It is faster in all cases
It uses recursion efficiently
How does Heap Sort ensure that the largest element reaches the correct position?
By partitioning the array
By building a max heap and extracting the root repeatedly
By merging halves
By selecting the minimum in each pass
Which sorting algorithm would you choose for sorting a small array of 10 elements? Why?
Merge Sort, for consistent speed
Insertion Sort, for simplicity and low overhead
Heap Sort, for maximum memory usage
Quick Sort, for recursion depth
Quick Sort performs poorly on a dataset, what could be the reason?
The data is already sorted
The algorithm is not coded properly
Poor pivot selection leads to unbalanced partitions
Too few comparisons are made
What is the primary concept behind Merge Sort?
Divide and Conquer
Swapping
Heapifying
Partitioning
Which sorting algorithm performs well for small datasets and is simple to implement?
Merge Sort
Quick Sort
Insertion Sort
Heap Sort
____ ____ is the topmost node in a tree that has no parent.
(a)
____ ____ refers to nodes that do not have any children.
(a)
In a tree data structure, a node can have multiple parents.
True
False
The root node is the topmost node in a tree and has no parent.
True
False
Siblings in a tree are nodes that share the same parent.
True
False
In a binary tree, each node can have a maximum of three child nodes.
True
False
The height of the tree is the longest path from the root to a leaf node.
True
False
The degree of a tree is the number of nodes in the entire tree.
True
False
In an inorder traversal, the order is: Left → Root → Right.
True
False
A leaf node is a node that has no child nodes.
True
False
The Binary Search Tree allows duplicate values in both left and right subtrees.
True
False
In a postorder traversal, the root is visited before any of its subtrees.
True
False
A tree in which each node has at most two child nodes.
(a)
The total number of edges from the root node to a specific node.
(a)
The maximum number of children a node can have in the entire tree.
(a)
The node that comes before a given node in the tree structure.
(a)
A type of tree traversal where the node is visited after its left and right children.
(a)
A node and all its descendants considered as a small tree
(a)
List the order of Tree Traversal in "POSTORDER".
Note: Do not use commas or spaces. Just list the order.
(a)
List the order of Tree Traversal in "PREORDER".
Note: Do not use commas or spaces. Just list the order.
(a)
List the order of Tree Traversal "INORDER"
Note: Do not use commas or spaces. Just list the order.
(a)
What can you infer about a tree if every node has exactly two children except the leaves?
It is a complete binary tree
It is a full binary tree
It is a ternary tree
It is a degenerate tree
Which situation would most likely cause a binary search tree to degenerate into a linked list?
Inserting random values
Inserting sorted values
Inserting values in even/odd pattern
Removing root repeatedly
If you want to display data in a binary search tree from lowest to highest, which traversal would be best?
Postorder
Preorder
Inorder
D. Level order
A student designed a tree where some nodes have five children. Which type of tree has this structure?
Binary Tree
Ternary Tree
Generic (N-ary) Tree
Balanced Tree
What will happen if you try to insert a duplicate value into a standard Binary Search Tree?
It goes to the right subtree
It goes to the left subtree
It will be rejected
It replaces the existing value
Which traversal would be most suitable to clone the structure of a tree from the top-down?
Preorder
Inorder
Postorder
Level order
In designing a file directory system, which data structure would be best suited and why?
Queue – because it's simple
Array – for linear data
Tree – for hierarchical organization
Stack – for LIFO behavior
If two sibling nodes have the same depth and different values, what can you deduce about their parent?
It has one child
It is a leaf node
It must be one level above and has at least two children
It is the root node
You are designing a sorting algorithm using a BST. What is the best method to retrieve the sorted list?
Traverse right subtree only
Use BFS
Inorder traversal
Preorder traversal
Which change would you make to a binary tree to reduce its height without losing nodes?
Convert it to a degenerate tree
Add more duplicate values
Balance the tree
Remove the leaf nodes
Imagine a system for managing employee hierarchies. Which node type would best represent a manager with no subordinates?
Root Node
Internal Node
Leaf Node
Sibling Node
You are creating a diagram of a university's course prerequisites using a tree. What does each edge most likely represent?
A classroom
A requirement
A semester
A student
A programmer created a traversal to delete nodes from leaf to root. Which traversal did they most likely use?
Preorder
Inorder
Postorder
Level order
What tree structure would be most suitable for multi-way decision-making, such as in a game AI?
Binary Tree
Ternary Tree
N-ary Tree
Balanced BST
If you want to track family generations, how would you design the levels in the tree?
Random order
By age
Root = eldest, Level increases by generation
All on one level
You are designing a file explorer. Why would a preorder traversal help generate the file structure view?
It lists smallest files first
It visits all files at the same level
It displays directories before contents
It sorts files alphabetically
You want to model tournament brackets. Which node type would represent the final winner?
Leaf
Child
Root
Internal
A BST is unbalanced with all nodes on the right. What data pattern most likely caused this?
Random
Decreasing
Increasing
Alternating
If you want to prevent deep recursion in a tree operation, what structure would help the most?
Linked list
Balanced Tree
Stack
Heap
You are tasked to build a classification system for animals based on their characteristics. Which tree concept applies best?
Postorder deletion
Tree traversal
Hierarchical classification
Hashing
Which sorting algorithm is best suited for partially sorted datasets, offering fast performance with minimal changes?
Bubble Sort
Insertion Sort
Merge Sort
Selection Sort
Which of the following is true when comparing Quick Sort and Merge Sort?
Both use extra memory for merging
Merge Sort is faster in practice
Quick Sort is in-place and generally faster
Quick Sort is stable by default
A (a) Tree allows up to three children per node.
List the order of Tree Traversal "PREORDER"
Note: Do not use commas or spaces. Just list the order.
(a)
List the order of Tree Traversal "INORDER"
Note: Do not use commas or spaces. Just list the order.
(a)
It is the process of arranging data or elements in a specific order, such as ascending or descending, to make searching and organizing more efficient.
(a)
(a) this process until a pass completes with no exchanges.
What sorting algorithms says "Everything smaller goes to the left, bigger goes to the right"?
(a)
A sorting algorithm partitions the array and then recursively sorts each part. This approach is most likely used by:
Merge Sort
Selection Sort
Quick Sort
Bubble Sort
What sorting algorithm uses a binary data structure?
(a)
This simple sorting technique repeatedly finds the minimum value from the unsorted portion of the array and moves it to its correct position by exchanging it with the current index.
(a)
A node with the maximum number of children in a tree determines the (a) of that tree.
The connection between any two nodes in a tree is called a/an (a) .
List the order of Tree Traversal "POSTORDER"
Note: Do not use commas or spaces. Just list the order.
(a)
