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 represent the general case?

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


Answer: D

Computer Science & Information Technology

You might also like to view...

What will the following code display?

int number = 6; cout << number++ << endl; a. 6 b. 5 c. 7 d. 0

Computer Science & Information Technology

Briefly explain how to obtain an NIS client and an NIS server.

What will be an ideal response?

Computer Science & Information Technology

List three categories of printed reports.

What will be an ideal response?

Computer Science & Information Technology

Which of the following is a product characteristic that can be trademarked?

A. sounds B. shapes C. colors D. All of the above

Computer Science & Information Technology