🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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;
}
  1. A.12
  2. B.64
  3. C.81
  4. 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 →