wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Data Structures & Algorithm

Total questions: 40

Worksheet time: 22mins

Name
Class
Date
1.

Example of linear data structure except

a)

array

b)

tree

c)

queue

d)

stack

2.
_________________ is a collection of elements used to store the same type of data.
a)
Array
b)
Switch
c)
Case
d)
Loop
3.

Which of these data structures is LIFO?

a)

Stack

b)

Queue

c)

Binary Tree

d)

Double linked list

4.

int nums[ ] =

{2, 3, 5, 8, 9, 11};

How would you access the fourth element in nums

a)

nums[8]

b)

nums[3]

c)

nums(4)

d)

nums(3)

5.
Which of the following is NOT a Type of Data Structures?
a)
Arrays
b)
Tables
c)
Stacks
d)
Trees
6.

A FIFO structure implemented as a ring where the front and rear pointers can wrap around the end of the start of the array.

a)

Linear Queue

b)

Circular Queue

c)

Priority Queue

7.

It use pointer to link nodes.

a)

Variable

b)

Link List

c)

Pointer

d)

Trees

8.
What kind of Data structure would you expect to find utilised to store operations in a CPU?
a)
Stack
b)
Queue
c)
List
d)
Tree
9.

LIFO stands for

a)

List of Outputs

b)

Last in First Out

c)

First in Last Out

d)

None of them

10.

Act of adding values into a stack is called

a)

Popping

b)

Polling

c)

Pushing

d)

None

11.

If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed?

a)

ABCD

b)

DCBA

c)

DCAB

d)

ABDC

12.

Consider the following operation performed on a stack of size 5.


Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Pop();

Push(5);


After the completion of all operation, get the total number of element present in stack is

a)

1

b)

2

c)

3

d)

4

13.

int is __________ data type.

a)

user defined

b)

derived

c)

primary

d)

all of above

14.

Array is ___________ data type.

a)

user defined

b)

primary

c)

derived

d)

all of above

15.

In ____________ data structure, the data items are arranged in a linear sequence.

a)

linear

b)

non linear

c)

both a and b

d)

all of above

16.

In ___________ data structure data items are not in sequence.

a)

non linear

b)

linear

c)

non-homogeneous

d)

all of above

17.

Full form of LIFO is ____________

a)

Last Inside First Outside

b)

Last Innner First Outer

c)

Last In First Out

d)

Last Impact First Out

18.

Every stack has a variable _________ associated with it.

a)

TOP

b)

BOT

c)

POT

d)

none of the above

19.

_________ operation removes the element from the top of the stack.

a)

push

b)

pop

c)

update

d)

none of the above

20.

A function calls itself is called ___________.

a)

queue

b)

recursion

c)

function

d)

none of above

21.

The elements in a queue are added at one end called ________.

a)

front

b)

rear

c)

near

d)

none of above

22.

A binary search tree whose left subtree and right subtree differ in height by at most 1 unit is called

a)

AVL tree

b)

Red-black tree

c)

Lemma tree

d)

None of the above

23.

________is very useful in situation when data have to stored and then retrieved in reverse order.

a)

Stack

b)

Queue

c)

List

d)

Link list

24.

In the __________traversal we process all of a vertex’s descendents before we move to an adjacent vertex.

a)

Depth First

b)

Breadth First

c)

With First

d)

Depth Limited

25.

A graph is a collection of nodes, called __________ And line segments called arcs or__________ that connect pair of nodes.

a)

vertices, edges

b)

edges, vertices

c)

vertices, paths

d)

graph node, edges

26.

A tree sort is also known as__________ sort.

a)

quick

b)

heap

c)

shell

d)

selection

27.

A terminal node in a binary tree is called __________

a)

Root

b)

Branch

c)

Child

d)

Leaf

28.

Other name for directed graph is _________

a)

Direct graph

b)

Digraph

c)

Dir-graph

d)

Dgraph

29.

In a graph if E=(u,v) means _____________

a)

u is adjacent to v but v is not adjacent to u

b)

e begins at u and ends at v

c)

u is processor and v is successor

d)

both b and c

30.

How many leaf are there in the tree?

a)

1

b)

3

c)

4

d)

7

31.

What are the 3 depth traversals for a tree data structure?

a)

Pre-, In- and Post-order

b)

Pro-, In- and Past-order

c)

Pre-, Out- and Post-order

d)

Pre-, In- and New-order

32.

The hash function is

H1(k) = k % 50.

In the case of collision, the hash function used is

H(k) = (H1(k) + M x H2(k)) % 50

where H1(k) = k % 50 and H2(k) = k % 20.

M is initialized to 0 and is incremented by 1 each time a collision occurs.

This could be categorized under which of the following collision detection technique

a)

a)Linear Probing

b)

b)quadratic Probing

c)

c)Re-Hashing

d)

d)Double Hashing

33.

In a stack, if a user tries to remove an element from empty stack it is called

a)

Underflow

b)

Overflow

c)

Garbage Collection

d)

Empty collection

34.

Complexity of Binary Search for an array of n numbers is

a)

log2n

b)

nlog2n

c)

n2

d)

n

35.

Example of non linear data structure

a)

Array

b)

Tree

c)

Queue

d)

Stack

36.

What is the data structure used to perform recursion?

a)

Array

b)

Stack

c)

Queue

d)

Linked list

37.

The prefix form of A-B/ (C * D ^ E) is?

a)

-/*^ACBDE

b)

-ABCD*^DE

c)

-A/B*C^DE

d)

-A/BC*^DE

38.

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

a)

n-ary tree

b)

priority queue

c)

stack

d)

queue

39.
Ordered collection of data items of the same type referred to collectively by a single name 
a)
List
b)
Array
c)
Variables
d)
Constants
40.

The examples of Linear Data Structures are

a)

Stacks,Queues,Linked list

b)

int,float,complex

c)

Operators,tokens,punctuators

d)

Tree, graph