NEW
Font size
WorksheetsDATA STRUCTURES QUIZ-1
Total questions: 23
Worksheet time: 20mins
Which of the following best defines a data structure?
A way to store data in memory
A way to organize and store data to facilitate access and modification
A programming language construct
A collection of algorithms
12 6 8 1 3
How many comparisons would it take to find number 1?
1 5 10 13 48 68 100 101
How many comparisons would it take to find number 101?
What is the time complexity of binary search on a sorted array of size n?
O(n)
O(log n)
O(n log n)
O(1)
Which sorting algorithm repeatedly swaps adjacent elements if they are in the wrong order?
Selection Sort
Bubble Sort
Insertion Sort
Merge Sort
Lower bound running time complexity of an algorithm is also called as.................
Best case time complexty
Worst case time complexity
Average case time complexity
None of these
............................Notation is used to represent strict upper bound running time complexity of an algotihm
Big-oh
Big-Omega
Theta
None of these
Let f(n) and g(n) be two non-negative functions,f(n)= θ (g(n)) if and only if..........................
c1*g(n)<=f(n)<=c2*g(n)
c1*g(n)>=f(n)>=c2*g(n)
c1*g(n)<f(n)<c2*g(n)
c1*g(n)>f(n)>c2*g(n)
Find the time complexity for the following algorithm using step count method.
Algorithm sum(a,n)
{
nsum=0;
for(i=1;i<=n;i++)
{
nsum=nsum+a[i];
}
}
2n+2 units
2n+1 units
n+1 units
n+2 units
Example of non linear data structure
array
tree
queue
stack
Circular Linked List the Address part of last node holds the address of
First Node
Null
Intermediate Node
None of the Above
How many times should
“temp =temp->next” be executed in the image to get the value of "Null" when the initial value of temp is temp=head
1
2
3
4
What advantage does a linked list have over an array?
Size of the list doesn't need to be mentioned at the beginning of the program
You can add or remove elements from the middle of the list.
The linked list doesn't have a size limit
All of these are true.
What is the time complexity to adding an elements in front of the linked list?
O(1)
O(n)
O(log n)
none of these
What is the time complexity to count the number of elements in the linked list?
O(1)
O(n)
O(log n)
none of these
Which node’s data will be printed when
“temp =temp->next” is executed 3 times and the initial value of temp is temp=head
Null
9
27
46
A linked list contains a list pointer variable _____that stores the address of the first node of the list.
Head
NULL
NEXT
LAST
What is value in the head -> next -> next below?
12
4600
1600
88
In the above image what will be printed when Head->next->data?
83
9
27
Error
What is the output of following function in which start is pointing to the first node of the following linked list 1->2->3->4->5->6 ?
1 4 6 6 4 1
1 3 5 1 3 5
1 2 3 5
1 3 5 5 3 1
A variant of the linked list in which none of the node contains NULL pointer is?
Singly linked list
Doubly linked list
Circular linked list
None
