wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Data Structures and Algorithm

Total questions: 30

Worksheet time: 16mins

Name
Class
Date
1.

Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?

a)

Insertion Sort

b)

Quick Sort

c)

Merge Sort

d)

Heap Sort

2.

In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is (GATE CS 2002)

a)

log 2 n

b)

n/2

c)

log 2 n - 1

d)

n

3.

Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be the slowest? (GATE CS 2004)

a)

membership, cardinality

b)

intersection, membership

c)

union, intersection

d)

union only

4.

The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of n integers is

a)

Θ(n)

b)

Θ(logn)

c)

Θ(log*n)

d)

Θ(1)

5.

A series of values stored in memory is called ___

a)

an array

b)

a tree

c)

a matrix

d)

a struct

6.

In some languages, arrays are also called ___

a)

groups or arrows

b)

roots or leaves

c)

lists or vectors

d)

lines or strings

7.

Arrays of characters, like letters, numbers, punctuation and other written symbols, are called ___

a)

structs

b)

vectors

c)

strings

d)

groups

8.

Finding the location of a given item in a collection of items is called ……

a)

Discovering

b)

Finding

c)

searching

d)

mining

9.

Example of linear data structure except

a)

array

b)

tree

c)

queue

d)

stack

10.

Which of these data structures is LIFO?

a)

Stack

b)

Queue

c)

Binary Tree

d)

Double linked list

11.

Which one of the following is the process of inserting an element in the stack?

a)

Insert

b)

Add

c)

Push

d)

None of the above

12.

Which one of the following is not the application of the stack data structure

a)

string reversal

b)

Recursion

c)

backtracking

d)

Asynchronous data transfer

13.

If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the removal?

a)

1234

b)

2134

c)

4321

d)

4231

14.

Which of the following principle does Queue use?

a)

LIFO Principle

b)

FIFO Principle

c)

Linear tree

d)

Ordered tree

15.

Which of the following is the time complexity to search an element in the linked list?

a)

O(1)

b)

O(n)

c)

O(logn)

d)

O(nlogn)

16.

What is the maximum number of children that a node can have in a binary tree?

a)

1

b)

2

c)

3

d)

4

17.

………………. is not an operation performed on linear list

a)

  Insertion

b)

Insertion & Deletion

c)

Deletion & Traversal

d)

  None of the above

18.

A linear collection of data elements where the linear node is given by means of pointer is called

a)

 linked list

b)

primitive list

c)

node list

d)

None of these

19.

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

a)

Stack

b)

Queue

c)

List

d)

Linked list

20.

Which of the following is a linear data structure?

a)

Array

b)

AVL Tree

c)

Binary Tree

d)

Graphs

21.

How is the 2nd element in an array accessed based on pointer notation?

a)

*a + 2

b)

*(a+2)

c)

*( * a + 2 )

d)

&(a+2)

22.

How are String represented in memory in C

a)

An array of characters.

b)

the object of some class

c)

same as other primitive data types

d)

Linked List of characters

23.

Which of the following sorting algorithms provide the best time complexity in the worst-case scenario?

a)

merge sort

b)

quick sort

c)

bubble sort

d)

selection sort

24.

Which of the following is a Divide and Conquer algorithm?

a)

merge sort

b)

heap sort

c)

bubble sort

d)

selection sort

25.

What is the time complexity of the binary search algorithm?

a)

O(n)

b)

O(1)

c)

O(log2n)

d)

O(n^2)

26.

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

27.

How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4}

a)

4

b)

5

c)

6

d)

7

28.

Minimum number of fields in each node of a doubly linked list is ____

a)

1

b)

2

c)

3

d)

4

29.

The elements of a linked list are stored

a)

In a structure

b)

In an array

c)

Anywhere the computer has space for them

d)

In contiguous memory locations

30.

Bonus question

a)

wrong answer

b)

wrong answer

c)

wrong answer

d)

correct answer