Sail E0 Webinar
Question
Consider the following code to find the nth fibonacci term:int fibo(int n)    if n == 0       return 0     else       prevFib = 0       curFib = 1       for i : 1 to n-1           nextFib = prevFib + curFib    __________     __________       return curFibComplete the above code.
Options:
A .  prevFib = curFib curFib = curFib
B .  prevFib = nextFibcurFib = prevFib
C .  prevFib = curFibcurFib = nextFib
D .  none of the mentioned
Answer: Option C


The lines, prevFib = curFib and curFib = nextFib, make the code complete.



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers