int foo(int n)               //Line 1{                            //Line 2  if (n == 0)                //Line 3     return 0;               //Line 4  else                       //Line 5     return n + foo(n - 1);  //Line 6}                            //Line 7
Consider the accompanying definition of a recursive function. Which of the statements represents the base case?

A. Statements in Lines 1-6.
B. Statements in Lines 3 and 4.
C. Statements in Lines 5 and 6.
D. Statements in Lines 3, 4, and 5.

Answer: B

Computer Science & Information Technology

You might also like to view...

A network administrator suspects a broadcast storm is causing performance issues on the network. Which of the following would be used to verify this situation?

A. Environmental monitor B. Multimeter C. Toner probe D. Protocol analyzer

Computer Science & Information Technology

Which is a function of an operating system?

a.Browse the Internet b.Edit images c.Protect against malware d.Provide a user interface

Computer Science & Information Technology