wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DATA STRUCTURES QUIZ-1

Total questions: 23

Worksheet time: 20mins

Name
Class
Date
1.

Which of the following best defines a data structure?

a)


A way to store data in memory

b)

A way to organize and store data to facilitate access and modification

c)

A programming language construct

d)


A collection of algorithms

2.
Which type of lists or data sets are binary searching algorithms used for?
a)
Unsorted lists or data sets
b)
Sorted lists or data sets
3.
A linear search is to be performed on the list:
12   6   8  1  3
How many comparisons would it take to find number 1?
a)
1
b)
2
c)
3
d)
4
4.
A binary search is to be performed on the list:
1  5  10  13  48  68  100  101
How many comparisons would it take to find number 101?
a)
0-1
b)
1-2
c)
3-4
d)
4-5
5.

What is the time complexity of binary search on a sorted array of size n?

a)

O(n)

b)

O(log n)

c)

O(n log n)

d)

O(1)

6.

Which sorting algorithm repeatedly swaps adjacent elements if they are in the wrong order?

a)

Selection Sort

b)

Bubble Sort

c)

Insertion Sort

d)

Merge Sort

7.
Which type of sort algorithm is this?
a)
Insertion
b)
Merge
c)
Bubble
8.

Lower bound running time complexity of an algorithm is also called as.................

a)

Best case time complexty

b)

Worst case time complexity

c)

Average case time complexity

d)

None of these

9.

............................Notation is used to represent strict upper bound running time complexity of an algotihm

a)

Big-oh

b)

Big-Omega

c)

Theta

d)

None of these

10.

Let f(n) and g(n) be two non-negative functions,f(n)=  θ\theta  (g(n)) if and only if..........................

a)

c1*g(n)<=f(n)<=c2*g(n)

b)

c1*g(n)>=f(n)>=c2*g(n)

c)

c1*g(n)<f(n)<c2*g(n)

d)

c1*g(n)>f(n)>c2*g(n)

11.

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];

}

}

a)

2n+2 units

b)

2n+1 units

c)

n+1 units

d)

n+2 units

12.

Example of non linear data structure

a)

array

b)

tree

c)

queue

d)

stack

13.

Circular Linked List the Address part of last node holds the address of

a)

First Node

b)

Null

c)

Intermediate Node

d)

None of the Above

14.

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

a)

1

b)

2

c)

3

d)

4

15.

What advantage does a linked list have over an array?

a)

Size of the list doesn't need to be mentioned at the beginning of the program

b)

You can add or remove elements from the middle of the list.

c)

The linked list doesn't have a size limit

d)

All of these are true.

16.

What is the time complexity to adding an elements in front of the linked list?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

none of these

17.

What is the time complexity to count the number of elements in the linked list?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

none of these

18.

Which node’s data will be printed when


“temp =temp->next” is executed 3 times and the initial value of temp is temp=head

a)

Null

b)

9

c)

27

d)

46

19.

A linked list contains a list pointer variable _____that stores the address of the first node of the list.

a)

Head

b)

NULL

c)

NEXT

d)

LAST

20.

What is value in the head -> next -> next below?

a)

12

b)

4600

c)

1600

d)

88

21.

In the above image what will be printed when Head->next->data?

a)

83

b)

9

c)

27

d)

Error

22.

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 ?

a)

1 4 6 6 4 1

b)

1 3 5 1 3 5

c)

1 2 3 5

d)

1 3 5 5 3 1

23.

A variant of the linked list in which none of the node contains NULL pointer is?

a)

Singly linked list

b)

Doubly linked list

c)

Circular linked list

d)

None