Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. The Fibonacci sequence is defined as a sequence of integers where each number

ID: 3804520 • Letter: 1

Question

1. The Fibonacci sequence is defined as a sequence of integers where each number is the sum of the two preceding ones. The following function returns the nth Fibonacci number. Show the computation steps for Fibonacci (4) (2 pts) int fibonacci (int n) if (n 0) return 0; else if (n 1) return 1 else return fibonacci (n-1) fibonacci (n-2); 2. What does the following function return for each input: (2 pts) int puzzle (char val int a, int b) if (a b) return 1 else if (val a val [b] return puzzle (val a +1, b-1) else return 0; a. val I'k', 'a, 'y', 'a', 'k') b 4. b. Val I'm 'a, X, X 'i', m a 0 b 5

Explanation / Answer

Question 1:

Answer : 3

it return nth fibonacci number .

Question 2:

Answer :

a: 1

b: 0

How? palindrom check

Question 3:

Answer :

int countOccurences(char data[],char x,int idx)
{
static int count = 0;
if (!idx)
{
return count;
}
if(data[idx] == x)
{
   ++count;
   }
countOccurences(data,x,--idx);
}

Question 4:

Answer :

17

18

19