Inside the NCERT notes for Class 11 Computer Science Chapter 7 Functions, you will find function syntax, parameters, return values, scope rules and Python library functions. The content follows the 2026-27 NCERT syllabus.

  • Core focus: defining, calling and testing reusable Python functions.
  • Exam focus: parameters, arguments, return values and variable scope.
  • Best use: revise each rule, then trace the sample calls by hand.

Class 11 Computer Science Chapter 7 Functions notes

Each Functions notes section is checked against the 2026-27 NCERT textbook and written for clear program tracing.

Student Feedback: In a Collegedunia poll of 10,620 Class 11 students before the 2026 exams, most students wanted more practice with arguments and return values.

Functions in Python: Meaning, Need and Basic Syntax

A function is a named block of code that performs one task. You define it once and call it whenever needed. This reduces repeated code and makes a program easier to test.

  • Built-in functions: Python provides tools such as print(), input() and len().
  • Module functions: A module provides functions such as math.sqrt().
  • User-defined functions: The programmer creates these with the def keyword.

A function definition starts with def, followed by its name and parentheses. The indented statements form its body. A function runs only when the program calls it.

Python Functions Chapter Overview

Source: Magnet Brains on YouTube

Parameters, Arguments and Return Values in Functions

Parameters and arguments in Python functions compared

Parameters receive data inside a function definition. Arguments are the actual values supplied during a function call. Students should keep this difference clear in theory answers and output questions.

TermMeaningExample
ParameterName written in the function headername in def greet(name):
ArgumentValue passed during a call"Asha" in greet("Asha")
Return valueResult sent back to the callerreturn total

The return statement ends the current call and sends a result back. A function without an explicit return statement gives None. Printing a value is not the same as returning it.

Types of Arguments Used in Python Functions

Python lets a function receive values in several ways. The call must still match the function header. Wrong order or missing values can raise an error.

  • Positional arguments: Python matches values by their order.
  • Keyword arguments: The call names each parameter directly.
  • Default arguments: The definition supplies a value when the caller omits it.

Place parameters with default values after parameters without defaults. This order keeps the function header valid and makes each call easy to read.

Variable Scope and Lifetime in Python Functions

Flow of a Python function call from definition to return

Scope tells where a variable can be used. A local variable belongs to one function call. A global variable is created outside functions and can be read across the program.

Variable typeCreated whereAvailable where
LocalInside a functionInside that function call
GlobalOutside all functionsAcross the program, subject to Python's scope rules

A local variable usually stops existing after the function finishes. Avoid changing global values without a clear need. Local variables make functions safer and easier to test.

Common Errors While Writing Functions in Python

Function questions often test small syntax and logic details. Check the header, indentation and call before tracing the body.

  • Forgetting the colon after the function header.
  • Writing the function body at the wrong indentation level.
  • Passing too many or too few arguments.
  • Using a local variable outside its function.
  • Expecting print() to send a value back.

Tip: Trace each call in a separate box. Write parameter values first, then follow the body line by line.

How to Revise Functions for Class 11 Computer Science

Start with the definition and call structure. Then compare parameter types and scope rules. End with short programs that calculate and return a value.

  1. Write one function with no parameters.
  2. Add positional, keyword and default arguments.
  3. Change a printed result into a returned result.
  4. Trace local and global variables in two calls.

Do not memorise code without tracing it. A short dry run shows when control enters the function and what value comes back.

Related Resources for Functions Class 11 Computer Science

ResourceHow it helpsLink
NCERT Book PDFRead the official explanation and examplesFunctions Class 11 Book PDF
NCERT SolutionsCheck exercise answers and Python programsFunctions Class 11 NCERT Solutions
Handwritten NotesUse a quick handwritten revision copyFunctions Class 11 Handwritten Notes

Class 11 Computer Science Notes for All Chapters

ChapterNotes link
Chapter 5 Getting Started with PythonGetting Started with Python Notes
Chapter 6 Flow of ControlFlow of Control Notes
Chapter 7 FunctionsCurrent chapter notes
Chapter 8 StringsStrings Notes
Chapter 9 ListsLists Notes

Functions Computer Science Notes FAQs

Ques. What is a function in Python?

Ans. A function is a named block of reusable code. It performs a task when the program calls it.

Ques. What is the difference between a parameter and an argument?

Ans. A parameter appears in the function definition. An argument is the actual value passed during a function call.

Ques. How is a user-defined function created in Python?

Ans. Use the def keyword, write the function name and parentheses, add a colon, then indent the body.

Ques. What does the return statement do?

Ans. The return statement ends the current function call and sends a value back to the calling statement.

Ques. What are local and global variables?

Ans. A local variable is created inside a function. A global variable is created outside functions and has wider scope.

Ques. Why are functions useful in a program?

Ans. Functions reduce repeated code. They also split a large program into smaller parts that are easier to test.