ISRO Computer Science (CSE) 2008 - Question 69

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2008

What is the value of F(4) using the following procedure : Function F(K : integer) integer; begin if (K < 3) then F := K else F := F(k - 1) * F(k - 2) + F(k - 3) end

  • A. 5
  • B. 6
  • C. 7
  • D. 8

Answer: A. 5

Explanation: F(0)=0, F(1)=1, F(2)=2. F(3) = F(2)*F(1)+F(0) = 2*1+0 = 2. F(4) = F(3)*F(2)+F(1) = 2*2+1 = 5.

| | All questions of ISRO Computer Science (CSE) 2008