...

/

Quick Quiz on Recursion with Arrays!

Quick Quiz on Recursion with Arrays!

This lesson will check your knowledge of recursion with arrays.

We'll cover the following...

Solve this Quiz!

1.

The task is to print the array using recursion.

void printArray(int array[], int startIndex, int len)
{
    cout<<arr[startIndex]<<"\t";
 
    // Recursively calling printArray to print next element in the array
    printArrayarray, startIndex + 1, len);
}

What should be the base case of the following code?

A.
if(startIndex >= len)
        return;
B.
if(startIndex <= len)
        return;
C.
if(startIndex >= len/2)
        return;

1 / 2

Now that we have ...