Towers of Hanoi using Recursion Multiple choice Questions and Answers (MCQs)

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<

Towers of Hanoi using Recursion Multiple choice Questions and Answers (MCQs)

Click on any option to know the CORRECT ANSWERS

Question 1
What is the objective of tower of hanoi puzzle?
A
To move all disks to some other rod by following rules
B
To divide the disks equally among the three rods by following rules
C
To move all disks to some other rod in random order
D
To divide the disks equally among three rods in random order
Microbiology Questions answers

Question 1 Explanation: 
Objective of tower of hanoi problem is to move all disks to some other rod by following the following rules-1) Only one disk can be moved at a time. 2) Disk can only be moved if it is the uppermost disk of the stack. 3) No disk should be placed over a smaller disk.

Question 2
Which of the following is NOT a rule of tower of hanoi puzzle?
A
No disk should be placed over a smaller disk
B
Disk can only be moved if it is the uppermost disk of the stack
C
No disk should be placed over a larger disk
D
Only one disk can be moved at a time
Current affairs Questions answers

Question 2 Explanation: 
The rule is to not put a disk over a smaller one. Putting a smaller disk over larger one is allowed.

Question 3
The time complexity of the solution tower of hanoi problem using recursion is .....
A
O(n2)
B
O(2n)
C
O(n log n)
D
O(n)
Microbiology Questions answers

Question 3 Explanation: 
Time complexity of the problem can be found out by solving the recurrence relation: T(n)=2T(n-1)+c. Result of this relation is found to be equal to 2n. It can be solved using substitution.

Question 4
Recurrence equation formed for the tower of hanoi problem is given by .....
A
T(n) = 2T(n-1)+n
B
T(n) = 2T(n/2)+c
C
T(n) = 2T(n-1)+c
D
T(n) = 2T(n/2)+n
Commerce Questions answers

Question 4 Explanation: 
As there are 2 recursive calls to n-1 disks and one constant time operation so the recurrence relation will be given by T(n) = 2T(n-1)+c.

Question 5
Minimum number of moves required to solve a tower of hanoi problem with n disks is .....
A
2n
B
2n-1
C
n2
D
n2-1
Economics Questions answers

Question 5 Explanation: 
Minimum number of moves can be calculated by solving the recurrence relation - T(n)=2T(n-1)+c. Alternatively we can observe the pattern formed by the series of number of moves 1, 3, 7, 15.....Either way it turn out to be equal to 2n-1.

There are 5 questions to complete.

 

 Download all FREE PDF Ebook >>>CLICK HERE<<<