Question: Consider a recursive function sumDigits R (num) that returns the sum of the digits of the input parameter, which is an integer called num. It

 Consider a recursive function sumDigits R (num) that returns the sum

of the digits of the input parameter, which is an integer called

num. It can be assumed that 'num' is a non-negative For example:

Consider a recursive function sumDigits R (num) that returns the sum of the digits of the input parameter, which is an integer called num. It can be assumed that 'num' is a non-negative For example: sumDigitsR (1983)=21. Which of the follow statement is true about sumDigitsR? None of the other answers are correct sumDigitsR can be modified to be tail recursive sumDigitsR cannot be modified to be tail recursive sumDigitsR is tail recursive Consider a recursive function findBinary() that prints every possible bit strings of every n-digit binary number that contains more zeros than ones. This function has four parameters, one string, and three 32-bit integers as follow: findBinary (bitstr, n, zeros, ones). For example: findBinary ("",3,0,0) "100" "010" "001" "000" Which of the following is a valid recursive step of findBinary? findBinary (bitstr+"1", n1, zeros, ones+1) Both findBinary (bitstr+"1", n1, zeros, ones+1) and findBinary (bitstr+"0", n1, zerost1, ones) None of the other answers are correct findBinary (bitstr+"0", n1, zerost1, ones) Consider a recursive function called palindromeR (str) that returns true if a string is a palindrome (reads the same backwards and forwards) . What is a valid base case? 1. len (str) ==0 2. str==1 3. Ien(str)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!