With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

Chapter 23

Answers to Chapter 23 Review Questions

 1: What is the output from the following method if you call it with the argument 1?```01: public static void Recurs(int number) 02: { 03: if(number > 8) 04: return; 05: else 06: { 07: Console.WriteLine("Number: { 0} ", number); 08: Recurs(number * 2); 09: } 10: } ``` A1: Number: 1Number: 2Number: 4Number: 8 2: Identify in the Recurs method of question 1 the main ingredients found in most successful recursive methods. A2: A branching statement (if-else) spanning lines 3–9. A base case in line 4, a recursive call (or recursive step) in line 8. Each recursive call moves towards the base case. 3: Rewrite the Recurs method in question 1 so that it (by still using recursion) provides the following output if ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required