Recursion and Factorials
- 11Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
For a positive integer n, what does n! represent?
For a positive integer n, what does n! represent?
11 questions
- 1
For a positive integer n, what does n! represent?
- A
The product of the integers from n down to 1
- B
The product of n and the next integer only
- C
The sum of the integers from n down to 1
- D
The number of integers from 1 through n
Correct answer
AThe product of the integers from n down to 1
Explanation
The factorial of a positive integer is the product n(n−1)(n−2)⋯3⋅2⋅1.
- A
- 2
What is the value of 4!?
- A
16
- B
12
- C
24
- D
36
Correct answer
C24
Explanation
4!=4⋅3⋅2⋅1=24.
- A
- 3
What is the value of 2!?
- A
2
- B
3
- C
4
- D
1
Correct answer
A2
Explanation
2!=2⋅1=2.
- A
- 4
What is the value of 1!?
- A
2
- B
It is undefined
- C
1
- D
0
Correct answer
C1
Explanation
1! is the product containing just 1, so its value is 1.
- A
- 5
According to the definition given, what is 0!?
- A
It equals −1!
- B
It is undefined
- C
1
- D
0
Correct answer
C1
Explanation
0! is defined to be 1.
- A
- 6
What kind of input is the function
factintended to accept in the example?- A
Any positive real number
- B
Only positive even integers
- C
A positive integer or zero
- D
Any integer, including negative integers
Correct answer
CA positive integer or zero
Explanation
The example describes
factas taking a positive integer or zero and returning that number's factorial. - A
- 7
In computer science, what makes a solution recursive?
- A
A function stores every result in a list
- B
A function divides a problem into unrelated tasks
- C
A function calls itself to help solve a problem
- D
A function repeats instructions without calling itself
Correct answer
CA function calls itself to help solve a problem
Explanation
Recursion is a way of solving a problem in which a function calls itself.
- A
- 8
For n≥1, which relationship expresses a factorial recursively?
- A
n!=(n−1)!
- B
n!=n⋅n!
- C
n!=n+(n−1)!
- D
n!=n(n−1)!
Correct answer
Dn!=n(n−1)!
Explanation
For n≥1, the factors after the initial n make up (n−1)!, so n!=n(n−1)!.
- A
- 9
Why is the rule n!=n(n−1)! not a complete definition of factorials by itself?
- A
At n=0, it refers to (−1)!, which is undefined
- B
It cannot be applied to any positive integer
- C
It requires factorials to be sums rather than products
- D
It gives the wrong result whenever n is greater than 1
Correct answer
AAt n=0, it refers to (−1)!, which is undefined
Explanation
Substituting n=0 gives 0!=0⋅(−1)!, but (−1)! is not defined. The recursive rule therefore needs a separate base case.
- A
- 10
Which base case completes the recursive definition for factorials of nonnegative integers?
- A
(−1)!=1
- B
0!=1
- C
0!=0
- D
1!=0
Correct answer
B0!=1
Explanation
The complete definition uses n!=n(n−1)! for n≥1 and the base case 0!=1.
- A
- 11
Using the recursive rule and the base case, what is 3!?
- A
6
- B
9
- C
3
- D
12
Correct answer
A6
Explanation
Apply the rule repeatedly: 3!=3⋅2!=3⋅2⋅1!=3⋅2⋅1=6.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.