Q1) Which of the following statements is incorrect for Linked list data structure?

A. Memory allocation from Heap

B. Memory allocation from stack

C. Size is not fixed.

D. It occupies more memory than array.

Answer : Option B

Explanation:

LinkedList is not stored in a contiguous memory location. Each element int the list is spread across the memory and are linked by the pointers in the Node. Thus, whenever a new element needs to be added a separate memory is allocated enough to store both key and the pointer to the next element.

So, memory is not allocated in stack

Answer is option B

Q2) If you are using Bubble sort for sorting the given numbers in ascending order, then find out the number of swapping needed.

12, 16, 10, 7, 13, 3, 9

A. 14

B. 16

C. 12

D. 15

Answer : Option D

Explanation:

Here totally 7 elements are there so loop will work for 7 times.

In bubble sorting after each iteration the largest element will be coming to it’s position.

In the first iteration element 16 will come to last index after 5 swapping

In second iteration 13 will come to it’s place after 4 swapping.

In third iteration 12 will come to it’s place after 3 swapping

In fourth iteration 10 will come to its place after 2 swapping.

In fifth iteration 9 will come to its place after 1 swapping.

By that all elements will be sorted so, further there will not be any swapping

Total number of swapping = 5 + 4 + 3 + 2 + 1 = 15

So answer is option D

Q3) Convert the postfix expression into infix.

ab + cd * f/ -g +

A. (a+b) * (c-d) / (f +g)

B. A+b - (c * d) + (f/g)

C. ((a+b) - ((c * d) / f)) + g

D. A + (b-c) / d * (f + g)

Answer : Option C

Explanation:

Converting the given postfix to infix the equation will be as,

((a+b) - ((c * d) / f)) + g

So answer is option C

Q4) If you are using Bubble sort for sorting the given numbers in ascending order, then find out the number of swapping needed.

3,10,4,7,9,2,6

A. 12

B. 14

C. 11

D. 8

Answer : Option C

Explanation:

Q5) Evaluate the given postfix expression.

2 3 + 5 * 2 3 + 4 + *

A. 210

B. 225

C. 220

D. 200

Answer : Option B

Explanation:

Converting the postfix expression to infix we will get the equation as,

( ( 2 + 3 ) * 5 ) * ( 4+ ( 2 + 3 ) )

Solving it we will get the answer as 225. So option B is the answer

Q6) Evaluate the given postfix expression.

8 4 + 4 2 3 * + 2 + *

A. 144

B. 128

C. 158

D. 162

Answer : Option A

Explanation:

Converting this postfix to infix we will get the equation as

(8+4) * (2 + 4 + (2 * 3))

Solving this the answer is 144.

Answer is option A

Q7) If you are using bubble sort for sorting the given numbers in ascending order, then find out the number of swapping needed.

9,23,8,10,32,6,14

A. 9

B. 12

C. 10

D. 11

Answer : Option C

Explanation:

Q8) If we draw a binary search tree by inserting the given numbers from left to right. then what would be the height of the BST?

1,4,3,5,7,9

A. 5

B. 4

C. 3

D. 2

Answer : Option A

Explanation:

In binary search tree the elements which is lesser than the root will come as left child and elements greater than the root node will come as the right child.

Height of the tree is the number of nodes from the root to its deepest leaf node. So according to the data given here the tree height will be 5.

Answer is option A

Q9) Which of the following data structures is non-linear?

A. Stack

B. Array

C. Graph

D. Linked List

Answer : Option C

Explanation:

Apart from Graph all others are linear data structure.

Graph and tree are non-linear data structure.

So, answer is option C

Q10) Linked lists are used to implement

1. Stack

2. Queue

3. Trees

A. 1 and 2

B. All 1, 2, and 3

C. 1 and 3

D. 2 and 3

Answer : Option B

Explanation:

Linked list can be used to implement stack, queue and trees.

Answer is option B

Q11) Which of the following statements is/are correct for Double Linked List?

1. All the nodes have two links

2. Provides bidirectional traversing

3. Provides only unidirectional traversing

A. 1 and 3

B. 1 and 2

C. Only 3

D. Only 1

Answer : Option B

Explanation:

In doubly linked list, it keeps the address of both previous node and next node. So, it provides two links, and is bidirectional in nature

Answer is option B

Q12) How many nodes are present in a strictly binary tree with 8 leaves?

A. 7

B. 15

C. 16

D. 17

Answer : Option B

Explanation:

A strictly binary tree is a binary tree where every parent node has either no child or two children.

If a strictly binary tree has n leaf nodes then the number of nodes will be 2n – 1.

Here n is 8 so number of nodes = 2 * 8 -1 = 15

Answer is option B

Q13) Find out the maximum number of nodes present in a tree of height 6.

A. 31

B. 63

C. 64

D. 32

Answer : Option B

Explanation:

The maximum number of nodes for a tree of height n is (2^n)-1