← Quiz: C Functions and Recursion: all 10 questions
Quiz: C Functions and Recursion · Question 8 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int power(int b, int e) {
if (e == 0) return 1;
return b * power(b, e - 1);
}
int main(void) {
printf("%d\n", power(3, 4));
return 0;
}
- A.12
- B.64
- C.81
- D.27
Answer & explanation
Correct answer: 81
power(3, 4) = 3 × 3 × 3 × 3 × 1 = 81.
Can you get the rest right without peeking?
Take the timed Quiz: C Functions and Recursion quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →