Which of the following represents the Fibonnacci sequence?

A. Function Numeric unKnown(Numeric num)
   // Call function recursively until reaching 0 or 1
   If num == 0 Or num == 1 Then
      Return num
   Else
      Return unKnown(num - 2) + unKnown(num - 1)
   End If
End Function
B. Function Numeric unKnown(Numeric num)
   // Base case returns 1
   If (num == 1) Then
      Return 1
   Else
      Return (num * num) + unKnown(num - 1)
   End If
End Function
C. Function Numeric unKnown(Numeric num)
   // Declare variables
   Declare Numeric fact = 1 // factorial result
   Declare Numeric index // loop index
  
   // Loop
   For index = num to 1 Step -1
      fact = fact * index
   End For
   Return fact
End Function
D. Module unKnown(Integer n, sourcePeg, targetPeg, sparePeg)
   If (n > 0) Then
      moveDiscs(n - 1, sourcePeg, sparePeg, targetPeg)
   // Move disc from sourcePeg to targetPeg
      moveDiscs(n - 1, sparePeg, targetPeg, sourcePeg)
   End If
End Module


Answer: A

Computer Science & Information Technology

You might also like to view...

RS-449

a. is bound to replace RS-232-C in most applications b. allows for only a single transmission method c. allows transmission at 10 Mbps for 4000 feet d. is faster than RS-232-C, but also more expensive

Computer Science & Information Technology

Which two components would be used when performing preventive maintenance? (Select two.)

A) Mask B) Antistatic bag C) Antistatic mat D) Wrist strap E) Safety goggles

Computer Science & Information Technology

Which of the following would not be a troubleshooting tip if the page numbers of your report did not number correctly?

A. Check the Link to Previous buttons in the header and footer to be sure the links are broken. B. Be sure the Different First Page command is not selected when you begin numbering pages. C. Remove all page numbers in the header and footer and start over. D. Be sure you are in Draft view to insert page numbers.

Computer Science & Information Technology

What is the Recovery Console?

What will be an ideal response?

Computer Science & Information Technology