wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Data Structures and Algorithms Quiz-1

Total questions: 25

Worksheet time: 4mins

Name
Class
Date
1.

Which of these is a divide and conquer algorithm?

a)

Merge Sort

b)

Bubble Sort

c)

Insertion Sort

d)

Selection Sort

2.

What is a data structure?

a)

A programming language

b)

A collection of algorithms

c)

A way to store and organize data

d)

A type of computer hardware

3.

What data structure uses LIFO?

a)

Stack

b)

Queue

c)

Linked List

d)

Array

4.

What is the worst case time complexity of a linear search?

a)

O(n)

b)

O(log n)

c)

O(1)

d)

O(n^2)

5.

What are the disadvantages of arrays?

a)

Index value of an array can be negative

b)

Elements are sequentially accessed

c)

Data structure like queue or stack cannot be implemented

d)

There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

6.

The data structure required to check whether an expression contains a balanced parenthesis is?

a)

Queue

b)

Stack

c)

Tree

d)

Array

7.

What is the value of the postfix expression 6 3 2 4 + - *?

a)

74

b)

-18

c)

22

d)

40

8.

What makes a tree 'binary'?

a)

Each node can have at most two child nodes

b)

Each node has two parent nodes

c)

Each edge is bi-directional

d)

The tree has two root nodes

9.

Which of the following data structures can be used for parentheses matching?

a)

n-ary tree

b)

queue

c)

priority queue

d)

stack

10.

What is meant by the 'bubble' in Bubble sort?

a)

Higher values 'bubble up'

b)

Every time a value is compared to a neighbor value, the two are considered a 'bubble'

c)

It is the extra memory used when swapping values, causing a 'memory bubble'

d)

Higher values stay in place inside their 'bubble', while lower values are moved around

11.

Which is the most appropriate data structure for reversing a word?

a)

stack

b)

queue

c)

graph

d)

tre

12.

Which of the following is NOT a primitive data structure?

a)

Integer

b)

Float

c)

Linked List

d)

Character

13.

Which data structure uses FIFO?

a)

Queue

b)

Stack

c)

Array

d)

Linked List

14.

Which data structure allows us to access any element directly?

a)

Array

b)

Linked List

c)

Queue

d)

Stack

15.

Which property ensures that an algorithm produces at least one result?

a)

Finiteness

b)

Definiteness

c)

Output

d)

Effectiveness

16.

What is the worst-case time complexity of Bubble Sort?

a)

O(n log n)

b)

O(log n)

c)

O(n^2)

d)

O(n)

17.

Match the algorithms to their average time complexity:

     Linear Search → ?

    Binary Search → ?

Bubble Sort → ?

Merge Sort → ?

(a)  

18.

Which search algorithm uses Fibonacci numbers to divide the array?

a)

Linear Search

b)

Binary Search

c)

Fibonacci Search

d)

Quick Search

19.

In selection sort, what can be reduced by swapping array elements?

a)

the lowest value

b)

memory shifts

c)

the highest value

d)

the call stack

20.

For counting sort to work, the values must be in a limited range, they must be non negative, and what else?

a)

fibonacci

b)

prime

c)

odd

d)

integers

21.

Which of these algorithms are usually implemented using recursion?

a)

Bubble sort

b)

Selection sort

c)

Radix sort

d)

Merge sort

22.

What is recursion in programming?

a)

A function that calls itself

b)

A syntax error

c)

When the shortest path cannot be found

d)

Going in negative cycles

23.

In a 1D array arr[10], how many elements can it store?

a)

9

b)

10

c)

11

d)

None of the above

24.

Which searching algorithm works only on sorted data?

a)

Linear Search

b)

Binary Search

c)

Fibonacci Search

d)

Both b and c

25.

What is good about using arrays in algorithms?

a)

Array elements can be accessed directly

b)

Memory usage is dynamic: memory usage is automatically adjusted by the number of elements in the array

c)

No shifting operations in memory needed when array elements are deleted or inserted

d)

In memory, an array element does not have to come right after the previous element