|
The Towers of Hanoi |
|
1. 1 |
What is the objective of tower of
hanoi puzzle? Answer: a
|
A |
2. 2 |
Which of the following is NOT a
rule of tower of hanoi puzzle? Answer: c
|
C |
3. 3 |
The time complexity of the
solution tower of hanoi problem using recursion is _________ Answer: b
|
B |
4. 4 |
Recurrence equation formed for the
tower of hanoi problem is given by _________ Answer: c
|
C |
5. 5 |
Minimum number of moves required
to solve a tower of hanoi problem with n disks is __________ Answer: b
|
B |
6. 6 |
Space complexity of recursive
solution of tower of hanoi puzzle is ________ Answer: b
|
B |
7. 7 |
Which of the following functions
correctly represent the solution to tower of hanoi puzzle? void ToH(int n,int a,int b,int c) { If(n>0) { ToH(n-1,a,c,b); cout<<”move a disk from” <<a<<” to”<< c; ToH(n-1,b,a,c); } } b) void ToH(int n,int a,int b,int c { If(n>0) { ToH(n-1,a,b,c); cout<<”move a disk from” <<a<<” to”<< c; ToH(n-1,b,a,c); } } c) void ToH(int n,int a,int b,int c) { If(n>0) { ToH(n-1,a,c,b); cout<<”move a disk from” <<a<<” to”<< c; ToH(n-1,a,b,c); } } d) void ToH(int n,int a,int b,int c) { If(n>0) { ToH(n-1,b,a,c); cout<<”move a disk from” <<a<<” to”<< c; ToH(n-1,a,c,b); } }
Answer: a
|
A |
8. 8 |
Recursive solution of tower of
hanoi problem is an example of which of the following algorithm? Answer: d |
D |
9. 9 |
Tower of hanoi problem can be
solved iteratively. Answer: a
|
A |
1 10 |
Minimum time required to solve
tower of hanoi puzzle with 4 disks assuming one move takes 2 seconds, will be
__________ Answer: b
|
B |
No comments:
Post a Comment