Data Structure Questions and Answers-Fibonacci using Recursion

 

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

Data Structure Questions and Answers-Fibonacci using Recursion

Click on any option to know the CORRECT ANSWERS

Question 1
Suppose the first fibonnaci number is 0 and the second is 1. What is the sixth fibonnaci number?
A
5
B
6
C
7
D
8
UPSC Questions answers

Question 1 Explanation: 
The sixth fibonnaci number is 5.

Question 2
Which of the following is not a fibonnaci number?
A
8
B
21
C
55
D
14
Management Questions answers

Question 2 Explanation: 
14 is not a fibonnaci number.

Question 3
Which of the following methods can be used to find the nth fibonnaci number?
A
Dynamic programming
B
Recursion
C
Iteration
D
All of the mentioned
Reasoning Questions answers

Question 3 Explanation: 
All of the above mentioned methods can be used to find the nth fibonacci number.

Question 4
Consider the following iterative implementation to find the nth fibonacci number:

int main() { int n = 10, i; if(n == 1) printf("0"); else if(n == 2) printf("1"); else { int a = 0,  b = 1,  c; for(i = 3; i <= n; i++) { c = a + b; .....; 			.....; } printf("%d", c); } return 0; }

Which of the following lines should be added to complete the above code?

A
c = b b = a
B
a = b b = c
C
b = c a = b
D
a = b b = a
Arab culture Questions answers

Question 4 Explanation: 
The lines "a = b" and "b = c" should be added to complete the above code.

Question 5
Which of the following recurrence relations can be used to find the nth fibonacci number?
A
F(n) = F(n) + F(n - 1)
B
F(n) = F(n) + F(n + 1)
C
F(n) = F(n - 1)
D
F(n) = F(n - 1) + F(n - 2)
Current affairs Questions answers

Question 5 Explanation: 
The relation F(n) = F(n - 1) + F(n - 2) can be used to find the nth fibonacci number.

There are 5 questions to complete.

 

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