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...

In what circumstances is multiprogramming undesirable?

What will be an ideal response?

Computer Science & Information Technology

If your spreadsheet is organized correctly, the AutoSum function will always pick the right range of cells

Indicate whether the statement is true or false

Computer Science & Information Technology

When TCP/IP was developed, the host table concept was expanded into a hierarchical name system for matching computer names and numbers using this service:

A. HTTP B. NSDB C. URNS D. DNS

Computer Science & Information Technology

The wildcard character is the ____.

A. % B. & C. * D. @

Computer Science & Information Technology