wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

2nd Year Data Structures Quiz Qn

Total questions: 35

Worksheet time: 33mins

Name
Class
Date
1.

How is an array initialized in C language?

a)

int a[3] = {1, 2, 3};

b)

int a = {1, 2, 3};

c)

int a[] = new int[3]

d)

int a(3) = [1, 2, 3];

2.

Which of the following is not the type of queue?

a)

Priority queue

b)

Single-ended queue

c)

Circular queue

d)

Ordinary queue

3.

From following which is not the operation of data structure?

a)

Operations that manipulate data in some way

b)

Operations that perform a computation

c)

Operations that check for syntax errors

d)

Operations that monitor an object for the occurrence of a controlling event

4.

Which of the following are applications of Topological Sort of a graph?

a)

Sentence Ordering

b)

Course Scheduling

c)

OS Deadlock Detection

d)

All of the above

5.

What is the time complexity of the binary search algorithm?

a)

O(n)

b)

O(n^2)

c)

O(log2n)

d)

O(1)

6.

Which of the following algorithms are used to find the shortest path from a source node to all other nodes in a weighted graph?

a)

BFS

b)

Kruskal’s Algorithm

c)

Prims Algorithm

d)

Djikstra’s Algorithm

7.

How many edges are present in the complete graph of n vertices?

a)

n(n-1)/2

b)

n(n+1)/2

c)

n

d)

n/2

8.

How many nodes does a full binary tree with n leaves contains?

a)

2n

b)

2*n - 1

c)

n

d)

n - 1

9.

What is the condition of the overflow of a linear queue implemented using an array?

a)

Rear = front + 1

b)

Rear = front

c)

Rear = MAX_SIZE - 1

d)

Rear = MAX_SIZE

10.

What is the output of the program after performing the following functions?

push(10);

push(20);

pop();

push(15);

pop();

pop();

top();

a)

20

b)

10

c)

15

d)

Stack Underflow

11.

Which data structure is mainly used for implementing the recursive algorithm?

a)

Stack

b)

Queue

c)

Binary tree

d)

Linked list

12.

What is the outcome for the below prefix expression

+, -, *, 3, 2, /, 8, 4, 1

a)

12

b)

11

c)

5

d)

4

13.

Which among the following sorting algorithm is the most optimal one to sort a random linked list?

a)

Merge sort

b)

Insertion sort

c)

Quick sort

d)

Heap sort

14.

Which of the following are the types of data structures?

a)

Array

b)

Linked Lists

c)

Stack

d)

Trees

15.

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?

a)

2 4 9 5

b)

4 2 9 5

c)

5 9 4 2

d)

5 9 2 4

16.

The data structure required for Breadth First Traversal on a graph is?

a)

Array

b)

Queue

c)

Tree

d)

Stack

17.

Which of the following application makes use of a circular linked list?

a)

Allocating CPU to resources

b)

Undo operation in a text editor

c)

Implement Hash Tables

d)

Recursive function calls

18.

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)?

a)

3

b)

5

c)

4

d)

7

19.

What is direct addressing?

a)

Fewer keys than array positions

b)

Fewer array positions than keys

c)

Distinct array position for every possible key

d)

Same array position for all keys

20.

Which collision resolution technique involves placing collided elements in the next available empty slot in the hash table?

a)

Separate chaining

b)

Quadratic probing

c)

Linear probing

d)

None of the above

21.

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)

a)

Only I

b)

I and II

c)

Only II

d)

None

22.

Which of the following is false about a doubly linked list?

a)

Navigate in both directions

b)

More space than a linked list

c)

Doubly linked list is easier than singly linked list

d)

Insertion and Deletion

23.

Which of the following C code is used to create new node?

a)

ptr = (NODE*)malloc(sizeof(NODE));

b)

ptr = (NODE*)malloc(NODE);

c)

ptr = (NODE*)malloc(sizeof(NODE*));

d)

ptr = (NODE)malloc(sizeof(NODE));

24.

Which of the following is name doesn't related to stacks?

a)

Files

b)

LIFO lists

c)

FIFO lists

d)

Push-down lists

25.

A binary tree whose every node has either zero or two children is called

a)

Complete Binary Tree

b)

Binary search tree

c)

Extented binary tree

d)

None of the above

26.

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?

a)

10

b)

30

c)

40

d)

Queue is empty

27.

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?

a)

4

b)

3

c)

2

d)

1

28.

A binary search tree (BST) contains the numbers [10, 5, 15, 2, 7, 12, 20]. What is the height of the tree?

a)

3

b)

2

c)

5

d)

4

29.

If a stack has the operations push(10), push(20), push(30), pop(), pop(), push(40), what will be the top element?

a)

10

b)

30

c)

40

d)

20

30.

A sorting algorithm takes 4 seconds to sort 1000 elements. Assuming O(n²) complexity, how long will it take to sort 4000 elements?

a)

8 sec

b)

64 sec

c)

16 sec

d)

32 sec

31.

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?

a)

[90, 85, 95, 40, 30, 50, 60, 80]

b)

[95, 85, 90, 40, 30, 50, 60, 80]

c)

[95, 90, 80, 85, 30, 50, 60, 40]

d)

[90, 95, 80, 40, 30, 50, 60, 85]

32.

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?

a)

[20, 30, 35, 40, 50, 60, 70, 80]

b)

[50, 30, 40, 20, 35, 70, 60, 80]

c)

[20, 30, 40, 35, 50, 60, 70, 80]

d)

[20, 35, 30, 40, 50, 60, 70, 80]

33.

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?

a)

1

b)

2

c)

3

d)

4

34.

A complete binary tree with 63 nodes has how many leaf nodes?

a)

16

b)

31

c)

32

d)

63

35.

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?

a)

10

b)

100

c)

1000

d)

500