Question: Question 1: Tracing Recursive functions Refer to Unit 9 Recursion Lecture Slides for Tracing examples. The solution should be handwritten in paper and upload the
Question 1: Tracing Recursive functions Refer to "Unit 9 Recursion Lecture Slides" for Tracing examples. The solution should be handwritten in paper and upload the pictures of solution to a PDF file. a) Trace the following recursive method for the function call "multiplyDigits(58746)" and show the output result (6 Points) public class Trace 2\{ public static void main(String [] args) \{ System.out.println (myMethod (3,6)); \} public static int myMethod(int a, int b) \{ if (a==1) return b; else return b+myMethod(a1,b); \} \} Answer the following questions: 1) Which line(s) of this program define(s) the base case of method? 2) Which line(s) of this program include recursive call(s)? 3) At what step of your recursion tracing did you hit the base case? 4) What is the final output of this code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
