Question: Hi, I need an answer to these questions and an EXPLANATION, thank you!! :) 12. Given the following recursive method: public int dowhat( int n)
Hi, I need an answer to these questions and an EXPLANATION, thank you!! :)


12. Given the following recursive method: public int dowhat( int n) int temp if in-0) temp - 3; else temp - doWhat (n-1) + 5; System.out.println("N-" + n) return tempi } What is the output produced by the following call? System.out.println( dowhat (3)); 13. Given the following method: public int question! int k, int n) if nk) return k; else if(n > k) return question (k, n-k): else return question (k-n, n); } What is the output produced by the following call? System.out.print( question ( 3,5)); 14. Given the following method: public int what (int m) { int temp if ( m --. || m -- 1) temp = 0; else temp - what (m-2) + m; System.out.println("M-" + m); return temp; ) What is the output produced by the following call? System.out.println(what (5)); 15. Given the following method: public int dunno(int m) int value; if (m--0) value - 3; else value - dunno (m-1) + 3; return value; } What is the output produced by the following statement? System.out.println(dunno (3)); 16. Given the following method: public double power (int x, int n) : "+ n) ; System.out.println( "In power " + x + " if ( no) return 1.0) else if(nt 2 !- 0) return x * Math.pow (power (x, n/2), 2); else return Math.pow (power(x,n/2), 2); } What is output by the call System.out.println (power (2,8))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
