# Data Structure Questions and Answers-Fibonacci using Recursion

## Data Structure Questions and Answers-Fibonacci using Recursion

 Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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
Question 1 Explanation:
The sixth fibonnaci number is 5.

 Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following is not a fibonnaci number?
 A 8 B 21 C 55 D 14
Question 2 Explanation:
14 is not a fibonnaci number.

 Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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
Question 3 Explanation:
All of the above mentioned methods can be used to find the nth fibonacci number.

 Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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
Question 4 Explanation:
The lines "a = b" and "b = c" should be added to complete the above code.

 Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
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)
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.