Quick Quiz on Recursion with Strings!
This quiz will test your understanding of recursion in strings
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
The task is to replace all occurrences of ‘e’ with ‘a’ using recursion.
void replace(string& text, int index, int lenString)
{
//base case
if(index == lenString-1)
return
else
//recursive case
}
What should be the recursive case of the following code?
A.
replace(text,index+1,lenString)
B.
replace(text.substr(1),index,lenString)
C.
replace(text, index+1, lenString-1)
D.
replace(text.substr(1),index,lenString-1)
1 / 2