Font size
Worksheets2nd Year Data Structures Quiz Qn
Total questions: 35
Worksheet time: 33mins
How is an array initialized in C language?
int a[3] = {1, 2, 3};
int a = {1, 2, 3};
int a[] = new int[3]
int a(3) = [1, 2, 3];
Which of the following is not the type of queue?
Priority queue
Single-ended queue
Circular queue
Ordinary queue
From following which is not the operation of data structure?
Operations that manipulate data in some way
Operations that perform a computation
Operations that check for syntax errors
Operations that monitor an object for the occurrence of a controlling event
Which of the following are applications of Topological Sort of a graph?
Sentence Ordering
Course Scheduling
OS Deadlock Detection
All of the above
What is the time complexity of the binary search algorithm?
O(n)
O(n^2)
O(log2n)
O(1)
Which of the following algorithms are used to find the shortest path from a source node to all other nodes in a weighted graph?
BFS
Kruskal’s Algorithm
Prims Algorithm
Djikstra’s Algorithm
How many edges are present in the complete graph of n vertices?
n(n-1)/2
n(n+1)/2
n
n/2
How many nodes does a full binary tree with n leaves contains?
2n
2*n - 1
n
n - 1
What is the condition of the overflow of a linear queue implemented using an array?
Rear = front + 1
Rear = front
Rear = MAX_SIZE - 1
Rear = MAX_SIZE
What is the output of the program after performing the following functions?
push(10);
push(20);
pop();
push(15);
pop();
pop();
top();
20
10
15
Stack Underflow
Which data structure is mainly used for implementing the recursive algorithm?
Stack
Queue
Binary tree
Linked list
What is the outcome for the below prefix expression
+, -, *, 3, 2, /, 8, 4, 1
12
11
5
4
Which among the following sorting algorithm is the most optimal one to sort a random linked list?
Merge sort
Insertion sort
Quick sort
Heap sort
Which of the following are the types of data structures?
Array
Linked Lists
Stack
Trees
Elements “5”, “9”, “2” and “4” are placed in a queue and are deleted one at a time. In what order will they be removed?
2 4 9 5
4 2 9 5
5 9 4 2
5 9 2 4
The data structure required for Breadth First Traversal on a graph is?
Array
Queue
Tree
Stack
Which of the following application makes use of a circular linked list?
Allocating CPU to resources
Undo operation in a text editor
Implement Hash Tables
Recursive function calls
A hash function f defined as f(key) = key mod 7, with linear probing insert the keys 37, 38, 72, 48, 98, 11, 56, into a table indexed from 0, in which location the key 11 will be stored (Count table index 0 as 0th location)?
3
5
4
7
What is direct addressing?
Fewer keys than array positions
Fewer array positions than keys
Distinct array position for every possible key
Same array position for all keys
Which collision resolution technique involves placing collided elements in the next available empty slot in the hash table?
Separate chaining
Quadratic probing
Linear probing
None of the above
In hashing, collision resolution is carried out by close addressing. Which of the following is close addressing technique?
I. Buckets (for contiguous storage)
II. Chains (for linked storage)
Only I
I and II
Only II
None
Which of the following is false about a doubly linked list?
Navigate in both directions
More space than a linked list
Doubly linked list is easier than singly linked list
Insertion and Deletion
Which of the following C code is used to create new node?
ptr = (NODE*)malloc(sizeof(NODE));
ptr = (NODE*)malloc(NODE);
ptr = (NODE*)malloc(sizeof(NODE*));
ptr = (NODE)malloc(sizeof(NODE));
Which of the following is name doesn't related to stacks?
Files
LIFO lists
FIFO lists
Push-down lists
A binary tree whose every node has either zero or two children is called
Complete Binary Tree
Binary search tree
Extented binary tree
None of the above
If a queue has an initial state as [10, 20, 30, 40] (front at 10), and two dequeue operations are performed, what will be the new front?
10
30
40
Queue is empty
A circular queue of size 5 contains elements [10, 20, 30, 40]. If the front is at index 1 and one dequeue operation is performed, where will the front be?
4
3
2
1
A binary search tree (BST) contains the numbers [10, 5, 15, 2, 7, 12, 20]. What is the height of the tree?
3
2
5
4
If a stack has the operations push(10), push(20), push(30), pop(), pop(), push(40), what will be the top element?
10
30
40
20
A sorting algorithm takes 4 seconds to sort 1000 elements. Assuming O(n²) complexity, how long will it take to sort 4000 elements?
8 sec
64 sec
16 sec
32 sec
Given a max heap stored as an array [90, 85, 80, 40, 30, 50, 60], a new element 95 is inserted. What will be the new heap structure?
[90, 85, 95, 40, 30, 50, 60, 80]
[95, 85, 90, 40, 30, 50, 60, 80]
[95, 90, 80, 85, 30, 50, 60, 40]
[90, 95, 80, 40, 30, 50, 60, 85]
A binary search tree (BST) contains [50, 30, 70, 20, 40, 60, 80]. If 35 is inserted, what is the in-order traversal of the new BST?
[20, 30, 35, 40, 50, 60, 70, 80]
[50, 30, 40, 20, 35, 70, 60, 80]
[20, 30, 40, 35, 50, 60, 70, 80]
[20, 35, 30, 40, 50, 60, 70, 80]
A hash table of size 10 uses linear probing. The following keys are inserted: [12, 22, 32, 42]. If a search is made for key 52, how many comparisons are required?
1
2
3
4
A complete binary tree with 63 nodes has how many leaf nodes?
16
31
32
63
A linked list contains 1000 nodes. What is the minimum number of comparisons required to find an element in a sorted linked list using binary search?
10
100
1000
500
