Exam 14: Recursion

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Given the following code that uses recursion to find the factorial of a number, how many times will the else clause be executed if n = 5? private static int factorial(int n) { If (n == 0) Return 1; Else Return n * factorial(n - 1); }

(Multiple Choice)
4.8/5
(88)

Whereas a recursive algorithm might result in faster execution time, the programmer might be able to design an iterative algorithm faster.

(True/False)
4.8/5
(86)

The actions performed by the JVM that take place with each method call are sometimes referred to as

(Multiple Choice)
4.7/5
(76)

The recursive binary search algorithm is a good example of repeatedly breaking a problem down into smaller pieces until it is solved.

(True/False)
4.9/5
(84)
Showing 21 - 24 of 24
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)