wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

DSA & Code Snippets

Total questions: 15

Worksheet time: 12mins

Name
Class
Date
1.

Which one of the following is an application of Stack Data Structure?

a)

Managing function calls

b)

The stock span problem

c)

Arithmetic expression evaluation

d)

All of the above

2.

Which of the following represents the Postorder Traversal of a Binary Tree?

a)

Left -> Right -> Root

b)

Left -> Root -> Right

c)

Right -> Left -> Root

d)

Right -> Root -> Left

3.

Which of the following is a linear data structure?

a)

Array

b)

AVL Trees

c)

Binary Trees

d)

Graphs

4.

When a pop() operation is called on an empty queue, what is the condition called?

a)

Overflow

b)

Underflow

c)

Syntax Error

d)

Garbage Value

5.

Which of the following is a Divide and Conquer algorithm?

a)

Bubble Sort

b)

Selection Sort

c)

Heap Sort

d)

Merge Sort

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 - Best First Search

b)

Djikstra’s Algorithm

c)

Prims Algorithm

d)

Kruskal’s Algorithm

7.

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

a)

Queue

b)

Stack

c)

Array

d)

List

8.

What will be the output of the following code snippet?

a)

4

b)

6

c)

5

d)

3

9.

Find the output of the following program

a)

-127

b)

127

c)

2

d)

129

10.

Find the output for the given code

a)

-126

b)

Run Time Error

c)

126

d)

Garbage Value

11.

Find the output

a)

hello world

b)

Run time error

c)

world world

d)

Compilation error

12.

Find the output

a)

Run Time Error

b)

25 43632845

c)

25 36

d)

Compilation Error

13.

Find the Output

a)

1 2 3

b)

3

c)

3 2 1

d)

1

14.

Find the output

a)

Compilation Error

b)

4

c)

2

d)

1

15.

What will be the output of the code snippet?

a)

Compilation Error

b)

Mango

c)

ngo

d)

ango