Class 12 Computer Science: Functions and Recursion

Answer key included

This worksheet will test your understanding of defining and calling functions in Python, as well as the concept of recursion and its application.

Class 12CBSEComputer Scienceeasy

Your device's Print screen will open — choose "Save as PDF" to download.

Track practice: print a star chart

Class 12 · Computer Science
Name: ____________
  1. Q1.Which keyword is used to define a function in Python?
    • A.function
    • B.define
    • C.def
    • D.func
  2. Q2.A function that calls itself is known as a _______________ function.
  3. Q3.Explain the purpose of the 'return' statement in a Python function.
  4. Q4.What is the output of the following Python code: def greet(name): print('Hello, ' + name) greet('Alice')
    • A.Hello
    • B.Hello, Alice
    • C.Alice
    • D.Error

Preview — full sheet in the PDF

What's inside this workbook

This Class 12 Computer Science Practice contains 10 questions across 2 printable pages and includes a full answer key at easy difficulty. Aligned to the CBSE and NCERT syllabus.

How this worksheet helps your child

  • Builds confidence in core Computer Science concepts taught in Class 12 through repeated, varied practice.
  • Aligned to CBSE and NCERT — questions mirror the pattern children see in school tests and unit assessments.
  • Comes with an answer key so parents and students can self-check in minutes, without needing a teacher.
  • Pitched at easy level — use it for daily homework, weekend revision or quick exam warm-ups.

About this worksheet

Welcome to our Class 12 Computer Science practice worksheet, designed specifically for students following the CBSE curriculum. This worksheet focuses on the fundamental concepts of functions and recursion in Python, which are crucial building blocks for advanced programming. Understanding how to define, call, and effectively use functions helps students write modular, reusable, and efficient code. Recursion, a powerful programming technique where a function calls itself, is also covered, enabling students to solve complex problems elegantly. This practice sheet is ideal for Class 12 students aiming to solidify their understanding of these core programming paradigms, ensuring they are well-prepared for their board examinations and future coding challenges. It aligns perfectly with NCERT guidelines, providing targeted practice to reinforce classroom learning.

What your child will learn

  • Identify the correct syntax for defining and calling functions in Python.
  • Practice passing arguments to functions and returning values.
  • Recognise the characteristics and applications of recursive functions.
  • Trace the execution flow of simple recursive programs.
  • Solve problems using both iterative and recursive approaches.
  • Apply function and recursion concepts to simple Python programs.

Understanding the concept

In computer programming, functions are like mini-programs or routines within a larger program, designed to perform a specific task. Imagine you need to calculate the area of a circle multiple times in your code; instead of writing the calculation steps repeatedly, you can define a 'function' called, say, `calculate_circle_area`. This function takes the radius as input and returns the area. Then, whenever you need to calculate the area, you simply 'call' this function with the desired radius. This makes your code organised, easier to read, and simpler to fix if there's an error. Recursion, on the other hand, is a powerful technique where a function calls itself to solve a smaller version of the same problem. Think of searching for a definition in a dictionary: if the word is not on the current page, you might be told to 'see page X', and on page X, you might again be told to 'see page Y', until you finally find the definition. Similarly, a recursive function keeps calling itself with a simpler version of the original problem until it reaches a very basic case that it can solve directly (this is called the 'base case'). For example, calculating a factorial (like 5! = 5 * 4 * 3 * 2 * 1) can be done recursively: 5! = 5 * (4!), and 4! = 4 * (3!), and so on, until 1! = 1, which is the base case. Understanding both functions and recursion is vital for building complex and efficient software.

Tips for parents & teachers

  • Encourage your child to first review their class notes and textbook chapters on functions and recursion before attempting the worksheet.
  • Suggest that they trace the output of recursive functions manually on paper step-by-step to better understand their execution flow.
  • Have them try to write simple Python programs using both functions and recursive techniques after completing the worksheet problems.
  • Discuss the difference between recursive and iterative solutions for problems like factorial or Fibonacci series, highlighting pros and cons.
  • Review any incorrect answers together, focusing on understanding the underlying concept rather than just memorising the correct solution.

Topics covered

pythonfunctionsrecursionclass 12cbsecomputer science

How to use this worksheet at home

Open the print view and use your browser's Print dialog to print on regular A4 paper or save as a PDF. Hand the printed sheet to your child (Class 12) and set a relaxed time limit — 15 to 25 minutes works for most Computer Science worksheets. When they're done, open the "With answer key" view and let them self-mark question by question. Re-print as many times as you need; the file never expires and there's no download limit.

Frequently asked questions

Is this Computer Science worksheet really free?
Yes — every workbook on WorkbookWala is 100% free to download and print. No login, no email, no paywall. We're free for students, parents and teachers.
Is it aligned to the CBSE / NCERT syllabus?
Yes. All Class 12 worksheets are built around the CBSE and NCERT pattern so they map cleanly to what your child is studying in school.
Can I print this worksheet at home?
Yes. Click "Open print view" and use your browser's Print dialog to print on standard A4 paper, or save it as a PDF for later. The layout is designed to fit cleanly without scaling.
Does it include an answer key?
Yes — click "With answer key" to print a version with answers included, so parents and students can self-mark in minutes.

More Computer Science worksheets for Class 12

View all →
Something off with this worksheet? Report an issue
Print / Save as PDF