Home / MCQ Bank / Computer
Computer Miscellaneous On Data Structures

Consider the following recursive implementation to find the nth fibonacci number: int fibo(int n) { if(n == 1) return 0; else if(n == 2) return 1; return ________; } int main() { int n = 5; int ans = fibo(n); printf("%d",ans); return 0; } Which of the following lines should be inserted to complete the above code?

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • fibo(n - 1) + fibo(n - 2)

Related Computer Questions

What will be the output of the following C++ code? #include <iostream> using namespace std; int main() { int arr[] = {4, 5, 6, 7}; int *p = (arr + 1); cout << *arr + 9; return 0; } Which of the following is not an advantage of tree sort? Which feature allows us to call more than one method or function of the class in single instruction? What will be the output of the following Python code? def a(b): b = b + [5] c = [1, 2, 3, 4] a(c) print(len(c)) ______ function takes various parameters like formula, data, subset, labels, etc.