MAKE IT YOURS

A world for every learner

Choose a grade to discover its colours and creative world.

Grade 10 Recursion Worksheet with Answers

Grade 10 (US) · Year 11 (UK) · Class 10 (India) · Computer Science

Unit 5: Going FurtherAdvanced: Recursion PreviewAdvanced

Tracing recursive functions like factorial, Fibonacci and sums, and counting calls. This free high school worksheet has 12 questions and a full answer key. Print it or save it as a PDF — every answer is checked by code, not guessed.

  • Answer keys checked by code
  • No ads, ever
  • No student accounts needed
  • Safety & privacy
Practice Sheetaethelsystems.com

Recursion

Grade 10 · Computer Science

Score___ / 12

Name

Class

Date

Learning goal: Advanced: Recursion Preview

Directions: Read each question carefully and write your answer on the line. Use the diagram to help you.

RememberRecursion

fact(3)3 × fact(2)fact(2)2 × fact(1)fact(1)base case: 1Unwind2 × 1 = 2, 3 × 2 = 6
  1. 1

    What does this program print?

    1def s(n):2if n == 0:3return 04return n + s(n - 1)56print(s(8))
  2. 2

    What does this program print?

    1def fact(n):2if n == 1:3return 14return n * fact(n - 1)56print(fact(5))
  3. 3

    What does this program print?

    1def p(b, e):2if e == 0:3return 14return b * p(b, e - 1)56print(p(2, 4))
  4. 4

    What does this program print?

    1def fact(n):2if n == 1:3return 14return n * fact(n - 1)56print(fact(6))
  5. 5

    What does this program print?

    1def p(b, e):2if e == 0:3return 14return b * p(b, e - 1)56print(p(2, 3))
  6. 6

    What does this program print?

    1def s(n):2if n == 0:3return 04return n + s(n - 1)56print(s(9))
  7. 7

    What does this program print?

    1def s(n):2if n == 0:3return 04return n + s(n - 1)56print(s(4))
  8. 8

    What does this program print?

    1def s(n):2if n == 0:3return 04return n + s(n - 1)56print(s(5))
  9. 9

    What does this program print?

    1def s(n):2if n == 0:3return 04return n + s(n - 1)56print(s(6))
  10. 10

    What does this program print?

    1def fact(n):2if n == 1:3return 14return n * fact(n - 1)56print(fact(3))
  11. 11

    What does this program print?

    1def p(b, e):2if e == 0:3return 14return b * p(b, e - 1)56print(p(2, 5))
  12. 12

    What does this program print?

    1def p(b, e):2if e == 0:3return 14return b * p(b, e - 1)56print(p(3, 4))

★ Challenge corner for fast finishers

A playlist app lets you switch each of 6 songs on or off. How many different playlists (including the empty one) are possible?

How did I do?

Teacher's comments

Free printable worksheets with answer keys · aethelsystems.com/worksheets/computer/10/recursion

Answer key (click to show)
  1. 1.36
  2. 2.120
  3. 3.16
  4. 4.720
  5. 5.8
  6. 6.45
  7. 7.10
  8. 8.15
  9. 9.21
  10. 10.6
  11. 11.32
  12. 12.81
  13. ★64 (challenge corner)

Need another Recursion worksheet?

Generate unlimited fresh versions at easy, medium or hard difficulty, each with its own answer key. Free during our launch — no card needed.

Create a free account

How to use this worksheet

  • Use it for revision before a test, as homework, or as a timed practice set.
  • Students can self-mark with the answer key and note which question types they got wrong.
  • Generate several versions of the same topic for spaced practice in the weeks before an exam.

Can't find what you need? Tell us which worksheet to make next.

Frequently asked questions

Does this Grade 10 Recursion worksheet come with answers?

Yes. The full answer key is on this page, and it prints on its own page after the questions. Every answer is calculated or checked by code rather than written by an AI model, so the key is always correct.

How do I print it or save it as a PDF?

Click "Download PDF" to save a ready-to-print PDF with the answer key on the last page, or click "Print" to send the worksheet and answer key straight to your printer.

Can I get a different Recursion worksheet?

Yes. Create a free account to generate as many fresh Grade 10 Recursion worksheets as you like, at easy, medium or hard difficulty, each with its own answer key.

Is this worksheet free?

Yes. This worksheet is free to print, and Practice Sheet is free to use during our launch with no card needed.