Which of the following represents the sum of squares?
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
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
Correct Answer:
Verified
Q34: 4!/0! = _.
A) 2
B) 15
C) 24
D) 32
Q35: (10! / 5!) / 10 = _.
A)
Q36: Which of the following represents the factorial
Q37: The following sequence is known as the
Q38: Which of the following represents the Fibonnacci
Q40: The sum of squares of -5 and
Q41: The sum of squares of the first
Q42: The sum of squares can be defined
Q43: Which of the following is played with
Q44:
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents