Font size
WorksheetsData Structures and Algorithms Quiz-1
Total questions: 25
Worksheet time: 4mins
Which of these is a divide and conquer algorithm?
Merge Sort
Bubble Sort
Insertion Sort
Selection Sort
What is a data structure?
A programming language
A collection of algorithms
A way to store and organize data
A type of computer hardware
What data structure uses LIFO?
Stack
Queue
Linked List
Array
What is the worst case time complexity of a linear search?
O(n)
O(log n)
O(1)
O(n^2)
What are the disadvantages of arrays?
Index value of an array can be negative
Elements are sequentially accessed
Data structure like queue or stack cannot be implemented
There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size
The data structure required to check whether an expression contains a balanced parenthesis is?
Queue
Stack
Tree
Array
What is the value of the postfix expression 6 3 2 4 + - *?
74
-18
22
40
What makes a tree 'binary'?
Each node can have at most two child nodes
Each node has two parent nodes
Each edge is bi-directional
The tree has two root nodes
Which of the following data structures can be used for parentheses matching?
n-ary tree
queue
priority queue
stack
What is meant by the 'bubble' in Bubble sort?
Higher values 'bubble up'
Every time a value is compared to a neighbor value, the two are considered a 'bubble'
It is the extra memory used when swapping values, causing a 'memory bubble'
Higher values stay in place inside their 'bubble', while lower values are moved around
Which is the most appropriate data structure for reversing a word?
stack
queue
graph
tre
Which of the following is NOT a primitive data structure?
Integer
Float
Linked List
Character
Which data structure uses FIFO?
Queue
Stack
Array
Linked List
Which data structure allows us to access any element directly?
Array
Linked List
Queue
Stack
Which property ensures that an algorithm produces at least one result?
Finiteness
Definiteness
Output
Effectiveness
What is the worst-case time complexity of Bubble Sort?
O(n log n)
O(log n)
O(n^2)
O(n)
Match the algorithms to their average time complexity:
Linear Search → ?
Binary Search → ?
Bubble Sort → ?
Merge Sort → ?
(a)
Which search algorithm uses Fibonacci numbers to divide the array?
Linear Search
Binary Search
Fibonacci Search
Quick Search
In selection sort, what can be reduced by swapping array elements?
the lowest value
memory shifts
the highest value
the call stack
For counting sort to work, the values must be in a limited range, they must be non negative, and what else?
fibonacci
prime
odd
integers
Which of these algorithms are usually implemented using recursion?
Bubble sort
Selection sort
Radix sort
Merge sort
What is recursion in programming?
A function that calls itself
A syntax error
When the shortest path cannot be found
Going in negative cycles
In a 1D array arr[10], how many elements can it store?
9
10
11
None of the above
Which searching algorithm works only on sorted data?
Linear Search
Binary Search
Fibonacci Search
Both b and c
What is good about using arrays in algorithms?
Array elements can be accessed directly
Memory usage is dynamic: memory usage is automatically adjusted by the number of elements in the array
No shifting operations in memory needed when array elements are deleted or inserted
In memory, an array element does not have to come right after the previous element
