wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Data Structure

Total questions: 20

Worksheet time: 15mins

Name
Class
Date
1.

1. Which of the following properties is associated with a queue?

a)

a) First In Last Out

b)

b) First In First Out

c)

c) Last In First Out

d)

d) Last In Last Out

2.

Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only. Given the representation, which of the following operation can be implemented in O(1) time?

i) Insertion at the front of the linked list

ii) Insertion at the end of the linked list

iii) Deletion of the front node of the linked list

iv) Deletion of the last node of the linked list

a)

a) I and II

b)

b) I and III

c)

c) I, II and III

d)

d) I, II and IV

3.

In linked list implementation of a queue, front and rear pointers are tracked. Which of these pointers will change during an insertion into a NONEMPTY queue?

a)

a) Only front pointer

b)

b) Only rear pointer

c)

c) Both front and rear pointer

d)

d) No pointer will be changed

4.

The associativity of an exponentiation operator ^ is right side.

a)

a) True

b)

b) False

5.

What would be the Prefix notation for the given equation?

A+(B*C)

a)

a) +A*CB

b)

b) *B+AC

c)

c) +A*BC

d)

d) *A+CB

6.

1. Which of the following is false about a binary search tree?

a)

a) The left child is always lesser than its parent

b)

b) The right child is always greater than its parent

c)

c) The left and right sub-trees should also be binary search trees

d)

d) In order sequence gives decreasing order of elements

7.

What is the speciality about the inorder traversal of a binary search tree?

a)

a) It traverses in a non increasing order

b)

b) It traverses in an increasing order

c)

c) It traverses in a random fashion

d)

d) It traverses based on priority of the node

8.

for an int of size 4 bites what is the size of arr[15]

a)

a. 19

b)

15

c)

60

d)

11

9.

What does the following piece of code do?

public void func(Tree root)

{

func(root.left());

func(root.right());

System.out.println(root.data());

}

a)

a) Preorder traversal

b)

b) Inorder traversal

c)

c) Postorder traversal

d)

d) Level order traversal

10.

How will you find the minimum element in a binary search tree?

a)

while(root.left() != null)

{

root = root.left();

} System.out.println(root.data());

b)

while(root != null)

{ root = root.left(); } System.out.println

(root.data());

c)

while(root.right() != null) { root = root.right(); } System.out.println(root.data());

d)

while(root != null) { root = root.right(); } System.out.println(root.data());

11.

What are the worst case and average case complexities of a binary search tree?

a)

a) O(n), O(n)

b)

b) O(logn), O(logn)

c)

c) O(logn), O(n)

d)

d) O(n), O(logn)

12.

Construct a binary search tree with the below information.The preorder traversal of a binary search tree 10, 4, 3, 5, 11, 12.

a)
b)
c)
d)
13.

What is the time complexity of deleting from the rear end of the dequeue implemented with a singly linked list?

a)

a) O(nlogn)

b)

b) O(logn)

c)

c) O(n)

d)

d) O(n2)

14.

Which one of the following is the overflow condition if a circular queue is implemented using array having size MAX?

a)

rear= MAX-1

b)

rear=MAX

c)

front=(rear+1) mod max

d)

None of the above

15.

What would be the output after performing the following operations in a Deque?

Insertfront(10);  

Insertfront(20);  

Insertrear(30);  

Insertrear(40);  

Deletefront();  

Insertfront(50);  

Deleterear();  

Display();  

a)

10, 20, 30

b)

50, 10, 30

c)

40, 20, 30

d)

None of the above

16.

Which of the following statements are not correct with respect to Singly Linked List(SLL) and Doubly Linked List(DLL)?

a)

a) Complexity of Insertion and Deletion at known position is O(n) in SLL and O(1) in DLL

b)

b) SLL uses lesser memory per node than DLL

c)

c) DLL has more searching power than SLL

d)

d) Number of node fields in SLL is more than DLL

17.

The given array is arr = {1, 2, 4, 3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array?

a)

4

b)

2

c)

1

d)

0

18.

Quick sort follows Divide-and-Conquer strategy.

a)

a) True

b)

b) False

19.

In the following scenarios, when will you use selection sort?

a)

a) The input is already sorted

b)

b) A large file has to be sorted

c)

c) Large values need to be sorted with small keys

d)

d) Small values need to be sorted with large keys

20.

A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as _____________

a)

a) Queue

b)

b) Stack

c)

c) Tree

d)

d) Linked list