wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

6th March

Total questions: 10

Worksheet time: 4mins

Name
Class
Date
1.

in the tower of hanoi problem which disk is shifted first

a)

Bottom one

b)

Top one

c)

N-1 th Disk

d)

none of the options are correct

2.

Consider a definition of mystery():

mystery(0,N) = N

mystery(P,Q) = mystery(P-1, Q+1)

According to this definition, what is mystery(2,4)?

a)

3

b)

4

c)

5

d)

6

3.

What will be the output of the code?

a)

Print First 3

Print First 2

Print First 1

Print Last 2

Print Last 3

Print Last 4

b)

Print First 1

Print First 2

Print First 3

Print Last 2

Print Last 3

Print Last 4

c)

Print First 3

Print First 2

Print First 1

Print Last 1

Print Last 2

Print Last 3

d)

Print First 3

Print First 2

Print First 1

Print Last 1

Print Last 3

Print Last 4

4.

The depth of a complete binary tree is given by

a)

Dn = log2n+1

b)

Dn = n log2n+1

c)

Dn = n log2n

d)

Dn = log2n

5.
Red-black trees use color to ensure…
a)
O(h) recolorings and O(1) restructurings
b)
O(1) recolorings and O(h) restructurings
c)
O(log n) restructurings for each insert
d)
O(log n) restructurings for each delete
6.

What is the time complexity of level order traversal?

a)

O(1)

b)

O(n)

c)

O(logn)

d)

O(nlogn)

7.

In backtracking, what is the difference between a feasible solution and an optimal solution?

a)

A feasible solution is correct, while an optimal solution is the best possible solution

b)

A feasible solution is a valid solution, while an optimal solution is the most efficient solution

c)

A feasible solution satisfies all the constraints, while an optimal solution maximizes or minimizes an objective function

d)

There is no difference between a feasible solution and an optimal solution in backtracking

8.

Which of the following is not an advantage of using a red-black tree over a binary search tree?

a)

O(log n) time complexity for search, insert, and delete operations

b)

Guaranteed worst-case height of O(log n)

c)

Guaranteed balance of the tree

d)

Guaranteed best-case height of O(log n)

9.

Which of the following data structures is used to implement Prim's algorithm?

a)

Stack

b)

Queue

c)

Heap

d)

Linked List

10.

In digial signatures which of the following algorithms are used

a)

public key cryptography and Hashing

b)

Hashing

c)

Symmetric key cryptography and Hashing

d)

public key cryptography and Symmetric key cryptography