Test Your Knowledge 5
Let's take a small quiz!
We'll cover the following...
Quiz on Arrays
This Quiz will take approximately 10 minutes.
1
The function below prints a string recursively, meaning that one character is printed in each recursive call.
def printArray(array, startIndex, length) :
# Base case
_______________________________
print(arr[startIndex] + "\t")
#Recursively calling printArray to print next element in the array
printArray(array, startIndex + 1, length)
What should the base case of the following code be?
A)
if startIndex >= length :
return
B)
if startIndex <= length :
return
C)
if startIndex >= length/2 :
return
D)
if startIndex >= 0 :
return
Question 1 of 30 attempted
In the next chapter, we will use recursion to solve problems with data structures.