---
title: "Functions Class 12 Computer Science: Notes and Questions"
description: "Functions class 12 computer science (083): notes, positional and default arguments, scope traces, six marked programs and 18 original questions with answers."
canonical: https://learn.modernagecoders.com/cbse-class-12-computer-science-functions
source: src/pages/cbse-class-12-computer-science-functions.html
---
> Functions class 12 computer science (083): notes, positional and default arguments, scope traces, six marked programs and 18 original questions with answers.

Start here

## Where this chapter is taught

One course covers the whole 083 syllabus. The other two build the Python fluency and the database half around it.

[![Computer Science Class 11 and 12 course thumbnail](/images/ip-cs-class-11-12.webp)  083 / Both years Computer Science 11 and 12 The CBSE track moves from Class 11 lists and strings into functions, exceptions, files, the stack and SQL, and you can join in any month. Open the course →](/courses/cbse-icse-computer-science-class-11-12-python-java-complete-course)[![Python for Teens course thumbnail](/images/python-teens.webp)  Python / Write more Python for Teens For a student who follows every def on the board but cannot start one alone: many small programs, each one written and not copied. Open the course →](/courses/python-complete-masterclass-teens)[![MySQL for Teens course thumbnail](/images/mysql-teens.webp)  SQL / Next unit MySQL for Teens The database unit is another 20 marks, and its Python programs are functions with a query inside. Open the course →](/courses/mysql-mastery-for-teens)

Ans. The short version

Functions in class 12 computer science (CBSE 083, 2026-27) means built-in functions, functions defined in a module and user defined functions: how to define and call them, positional and default parameters, return values, flow of execution, and global and local scope. Positional arguments match by order; a default is used only when its argument is left out; a name assigned inside a function is local unless declared global. Modern Age Coders teaches this chapter live, personalised one to one, at your own days and timing, and a priority demo lets you try one full class before you enrol.

Q1. What does the syllabus ask for?

## Functions in Python Class 12 notes: what must you know?

A function is a named block of statements that runs only when it is called. The 083 syllabus lists types of function, creating a user defined function, arguments and parameters, positional and default parameters, returning values, flow of execution, and scope.

| Type of function | Where it comes from | What you do before using it | Example |
| --- | --- | --- | --- |
| Built-in | Already part of Python | Nothing, just call it | `len(name)`, `max(marks)` |
| Defined in a module | A module such as `math` or `random` | Import the module | `math.ceil(4.2)`, `random.randint(1, 6)` |
| User defined | You write it with `def` | Define it above the call | `parcel_charge(3)` |

***Seven parts in six lines**parcel.py*

```
def parcel_charge(weight, rate=40):
    """Return the charge for one parcel."""
    charge = weight * rate
    return charge

bill = parcel_charge(3)
print("Charge:", bill)
```

**Output**

```
Charge: 120
```

- **Header:** the `def` line. It must end with a colon.
- **Parameters:**`weight` and `rate`, the names that receive values.
- **Docstring:** the first string in the body. It says what the function is for, which counts towards the documentation share of the lab test.
- **Body:** the indented statements.
- **Return:** sends `charge` back and ends the function.
- **Call:**`parcel_charge(3)`. No call, no output.
- **Argument:** 3, the actual value sent to `weight`.

CBSE gives no separate marks for this chapter: it sits inside the 40 marks of Unit 1. In the 2026-27 sample paper, though, functions appear as a 1-mark scope question, a 2-mark choice on global and local variables, a 2-mark function to write and a 3-mark function to write, before you count the file and stack answers.

Q2. Which value lands in which parameter?

## Positional, default and keyword arguments in Class 12

Positional arguments fill parameters from left to right. A default parameter keeps its own value when no argument reaches it. Most lost marks come from a call that skips a parameter in the middle.

Every row below is a call to the same function. Cover the right-hand columns and decide for yourself.

***The function being called**one required, two defaults*

```
def tour(seats, city="Mysuru", rate=250):
    return city + " " + str(seats * rate)
```

| Call | seats | city | rate | Result |
| --- | --- | --- | --- | --- |
| `tour(4)` | 4 | Mysuru | 250 | `'Mysuru 1000'` |
| `tour(4, "Ooty")` | 4 | Ooty | 250 | `'Ooty 1000'` |
| `tour(4, "Ooty", 300)` | 4 | Ooty | 300 | `'Ooty 1200'` |
| `tour(4, 300)` | 4 | 300 | 250 | TypeError: 300 went to `city`, and a number cannot be joined to a string |
| `tour()` | none | Mysuru | 250 | TypeError: `seats` is required |
| `tour(4, "Ooty", 300, 1)` |   |   |   | TypeError: four arguments for three parameters |
| `tour(rate=300, seats=2)` | 2 | Mysuru | 300 | `'Mysuru 600'` (keyword call) |
| `tour(city="Ooty", 4)` |   |   |   | SyntaxError: a positional argument cannot follow a keyword one |

### Four rules to write in the margin

1. #### Required first, defaults last

  In the header, once one parameter has a default, all those after it must have one too. `def tour(seats=1, city)` is a SyntaxError.
2. #### Order decides

  Python does not read the names of your variables. The first argument goes to the first parameter, whatever it is called.
3. #### A default is a spare value

  An argument that is passed always wins over the default.
4. #### Same count, or a TypeError

  Too few for the required parameters, or too many in all, and the body never starts.

**Are keyword arguments in the syllabus?** The 2026-27 line for 083 names positional and default parameters only. Keyword arguments, where the call itself says `rate=300`, are not listed. You already use them in `print(x, end=" ")` and you may meet them in a book, so recognise one, but put your practice time into the other two.

### When the argument is a list

***Change it, or replace it?**team.py*

```
def add_name(names):
    names.append("Ira")

def new_list(names):
    names = ["Zoya"]

team = ["Om", "Neel"]
add_name(team)
print(team)
new_list(team)
print(team)
```

**Output**

```
['Om', 'Neel', 'Ira']
['Om', 'Neel', 'Ira']
```

`append()` works on the list itself, so `team` grows. The second function only points its own local name at a new list.

Q3. In what order do the lines run?

## Flow of execution and functions returning values

Python reads the file from the top, remembers each def without running its body, and jumps into the body only at a call. When the function ends, control comes back to the exact place it left.

***Trace the line numbers**kettle.py*

```
def add_gst(price):                      # 1
    total = price + price * 18 / 100     # 2
    return total                         # 3

def show_bill(item, price):              # 5
    print("Item:", item)                 # 6
    amount = add_gst(price)              # 7
    print("Pay:", amount)                # 8

show_bill("Kettle", 1000)                # 10
print("Thank you")                       # 11
```

**Output**

```
Item: Kettle
Pay: 1180.0
Thank you
```

**Flow:** 1, 5, 10, 5, 6, 7, 1, 2, 3, 7, 8, 11. Line 7 appears twice: once to make the call, once to store what came back. The answer is 1180.0, a float, since `/` always gives a float.

***One return, three answers**rain.py*

```
def rainfall(days):
    """Return total, highest and dry days."""
    dry = 0
    for mm in days:
        if mm == 0:
            dry += 1
    return sum(days), max(days), dry

week = [0, 12, 30, 0, 8, 5, 0]
answer = rainfall(week)
print(answer, type(answer))
total, highest, dry = rainfall(week)
print("Total", total, "Highest", highest)
print("Dry days", dry)
```

**Output**

```
(55, 30, 3) <class 'tuple'>
Total 55 Highest 30
Dry days 3
```

Values separated by commas come back as a single tuple. Unpack it into as many names as there are values.

### print or return: which one does the question want?

Use `return` when the question says return, and `print()` when it says display. They are not the same thing to the caller.

Here `double_print(6)` shows 12 on its own line and hands back `None`. The other function shows nothing and hands back 12.

***What the caller receives**double.py*

```
def double_print(n):
    print(n * 2)

def double_return(n):
    return n * 2

x = double_print(6)
y = double_return(6)
print(x, y)
```

**Output**

```
12
None 12
```

Q4. Which variable does this name mean?

## Scope of variable in Class 12: global and local

A variable made inside a function is local: it exists only while that call runs. A variable made outside every function is global: any function may read it, but only a function that declares it with global may assign to it.

| Inside the function | What happens with a global `fee = 500` | Value of fee afterwards |
| --- | --- | --- |
| `print(fee)` | No assignment, so Python finds the global and prints 500 | 500 |
| `fee = 800` | Makes a new local `fee`. The global is hidden, not changed | 500 |
| `global fee` then `fee = 800` | The assignment is made on the global itself | 800 |
| `fee = fee + 50` | Assignment makes `fee` local, and it is read before it has a value: UnboundLocalError | Program stops |
| `def show(fee):` | The parameter is a local name, separate from the global one | 500 |

***A full scope trace**gifts.py*

```
stock = 20

def sell(qty):
    global stock
    stock = stock - qty
    return stock

def gift(stock):
    stock = stock - 1
    return stock

print(sell(5), stock)
print(gift(stock), stock)
stock = stock + 10
print(sell(gift(8)), stock)
```

**Output**

```
15 15
14 15
18 18
```

### The same trace, on paper

| Statement | Global stock | Local stock | Printed |
| --- | --- | --- | --- |
| `sell(5)` | 20 becomes 15 | none | 15 15 |
| `gift(stock)` | 15 | 15 becomes 14 | 14 15 |
| `stock = stock + 10` | 25 | none |   |
| `gift(8)` | 25 | 8 becomes 7 |   |
| `sell(7)` | 18 | none | 18 18 |

Keep one column for the global and one for the locals, and draw a line when a call ends: the locals vanish there. This is the habit we build in class, as most wrong answers come from holding two variables with the same name in the head.

More trace practice: [Class 12 output questions](/cbse-class-12-computer-science-output-questions).

Q5. How are function answers marked?

## Important function programs for Class 12 Computer Science

In the 2026-27 marking scheme, a 2-mark function gives half a mark for the definition, one for the logic and half for the output line; a 3-mark one gives half, two and half. So a correct header and a correct last line are safe marks even when the logic wobbles.

***1. Letters at odd positions**2 marks*

```
def odd_letters(text):
    """Return the letters at index 1, 3, 5..."""
    result = ""
    for i in range(1, len(text), 2):
        result = result + text[i]
    return result

print(odd_letters("Brahmaputra"))
```

**Output**

```
rhaur
```

**Half:** header. **One:** loop with a step of 2. **Half:** return.

***2. A new list of codes**2 marks*

```
def station_codes(names):
    """Return a list of 3-letter codes."""
    codes = []
    for name in names:
        codes.append(name[:3].upper())
    return codes

print(station_codes(["Nagpur", "Itarsi", "Bhopal"]))
```

**Output**

```
['NAG', 'ITA', 'BHO']
```

The list must be created before the loop. Inside it, every pass would start again.

***3. Library fine with a default rate**3 marks*

```
def late_fine(days, rate=2):
    """First 7 days at rate, later days at double."""
    if days <= 7:
        return days * rate
    return 7 * rate + (days - 7) * rate * 2

print(late_fine(5))
print(late_fine(10))
print(late_fine(10, 3))
```

**Output**

```
10
26
39
```

No `else` is needed: the first return has already ended the function.

***4. Lengths in a dictionary**3 marks*

```
def length_table(words):
    """Return {word: length} for words over 4 letters."""
    table = {}
    for w in words:
        if len(w) > 4:
            table[w] = len(w)
    return table

print(length_table(["kite", "monsoon", "river", "sun"]))
```

**Output**

```
{'monsoon': 7, 'river': 5}
```

**Half:** header. **Two:** loop, test and assignment by key. **Half:** return.

***5. A tuple of pairs**3 marks*

```
bags = (("Asha", 14), ("Vikram", 19), ("Noor", 22))

def heavy_bags(data, limit=15):
    """Display owners over the limit, return how many."""
    count = 0
    for owner, kg in data:
        if kg > limit:
            print(owner, "is over by", kg - limit)
            count += 1
    return count

print("Bags charged:", heavy_bags(bags))
print("Bags charged:", heavy_bags(bags, 20))
```

**Output**

```
Vikram is over by 4
Noor is over by 7
Bags charged: 2
Noor is over by 2
Bags charged: 1
```

One call displays and returns, so read the question for both verbs.

***6. Using a function from a module**2 marks*

```
import math

def boxes_needed(laddoos, per_box=12):
    """Return how many boxes hold all the laddoos."""
    return math.ceil(laddoos / per_box)

print(boxes_needed(36))
print(boxes_needed(40))
print(boxes_needed(40, 25))
```

**Output**

```
3
4
2
```

Three kinds of function meet here: `print()` is built in, `ceil()` comes from a module, and `boxes_needed()` is yours.

For the report file, see [the Class 12 practical file programs](/blog/python-practical-file-class-12). The same writing style carries straight into [file handling](/cbse-class-12-computer-science-file-handling) and [the stack](/cbse-class-12-computer-science-stack).

Q6. Can you answer these with the notes closed?

## Functions Class 12 important questions, and previous year practice

Eighteen original questions follow, in the one, two and three mark shapes that the 083 paper uses. Write each answer on paper before you open ours.

### One mark

1. For `def pack(item, qty=1, gift=False):` which call fails? (a) `pack("Pen")` (b) `pack("Pen", 3)` (c) `pack()` (d) `pack("Pen", 3, True)`Answer**(c) pack()**. `item` has no default, so a TypeError is raised.
2. What value does a function give back if it has no return statement? Answer`None`, whose type is `NoneType`.
3. State True or False: a variable created inside one function can be used in another function. Answer**False.** It is local to the function that made it.
4. Fill in: a name in the def header is a ______, and a value in the call is an ______. Answer**parameter**, and **argument**.
5. `sqrt()` in `math.sqrt(49)` is which type of function? Answer A function defined in a module. The module must be imported first.
6. How many objects does `return p, q, r` send back? Answer One: a tuple holding three values.
7. What happens to statements written in the same block after `return`? Answer They never run. The function has already ended.
8. **Assertion (A):** A function can change the contents of a list passed to it. **Reason (R):** A list is mutable, and the parameter refers to the same list as the argument. Answer**Both A and R are true, and R is the correct explanation of A.** The team example above shows it.

### Two marks, theory

1. Differentiate between a parameter and an argument, with an example. Answer A parameter is a name in the function header that receives a value; an argument is the value supplied in the call. In `def area(side):` and `area(9)`, `side` is the parameter and 9 is the argument.
2. Differentiate between a built-in function and a user defined function. Answer A built-in function comes with Python and can be called directly, such as `len()`. A user defined function is written by the programmer with `def` and must be defined before it is called.
3. Why does `print(late_fine)` not show a fine? Answer There are no brackets, so the function is not called. Python prints a description of the function object. Write `print(late_fine(5))`.

### Writing a function

1. (2 marks) Write `count_endings(words, letter="a")` to return how many words end with the given letter. Answer

  ***Q12**one good answer*

  ```
  def count_endings(words, letter="a"):
      count = 0
      for w in words:
          if w.endswith(letter):
              count += 1
      return count

  print(count_endings(["Ganga", "Beas", "Yamuna"]))
  print(count_endings(["Ganga", "Beas", "Yamuna"], "s"))
  ```

  **Output**

  ```
  2
  1
  ```
2. (3 marks) A dictionary holds runs by each player. Write `top_scorer(runs)` to return the name and runs of the highest scorer, without using `max()`. Answer

  ***Q13**one good answer*

  ```
  def top_scorer(runs):
      best_name, best = "", -1
      for name in runs:
          if runs[name] > best:
              best_name, best = name, runs[name]
      return best_name, best

  print(top_scorer({"Anu": 34, "Reena": 71, "Kavya": 52}))
  ```

  **Output**

  ```
  ('Reena', 71)
  ```

Looking for functions class 12 previous year questions? CBSE puts its own papers and marking schemes on its website, and those are the ones to trust. After a past paper, use this page to repair whichever type you missed. A full mixed set is on [Class 12 CS important questions](/cbse-class-12-computer-science-important-questions).

### Two marks, output and errors

1. Predict the output.

  ***Q14**predict*

  ```
  def mix(a, b=3):
      a = a + b
      b = a - b
      return a, b

  x, y = mix(7)
  print(x, y)
  x, y = mix(y, x)
  print(x, y)
  ```

  Answer**Output**`10 7``17 7`First call: a is 7 + 3 = 10, then b is 10 - 3 = 7. The second call sends 7 and 10, in that order.
2. Predict the output.

  ***Q15**predict*

  ```
  def scramble(word, step=2):
      out = ""
      for i in range(0, len(word), step):
          out = word[i] + out
      return out

  print(scramble("MONSOON"))
  print(scramble("MONSOON", 3))
  ```

  Answer**Output**`NONM``NSM`Each new letter is put in front, so the picked letters come out reversed.
3. Predict the output.

  ***Q16**predict*

  ```
  count = 1

  def step(n):
      global count
      count = count * n
      return count

  for i in range(1, 4):
      print(step(i), end="#")
  print(count)
  ```

  Answer**Output**`1#2#6#6`The same global is multiplied by 1, 2 and 3. There is no newline until the last print.
4. Predict the output.

  ***Q17**predict*

  ```
  def half(n):
      return n // 2

  def add(n, more=1):
      return n + more

  print(half(add(9)), add(half(9), 10))
  ```

  Answer**Output**`5 14`Inner calls finish first: add(9) is 10 and its half is 5; half(9) is 4 and 4 + 10 is 14.
5. Rewrite after removing all errors, and underline each correction.

  ***Q18**four errors*

  ```
  def Average(marks)
      total = 0
      for m in marks:
          total =+ m
      Return total / len(marks)
  print(average([40, 50, 60]))
  ```

  Answer

  ***Q18 corrected**half a mark each*

  ```
  def Average(marks):              # 1. colon
      total = 0
      for m in marks:
          total += m               # 2. +=, not =+
      return total / len(marks)    # 3. small r
  print(Average([40, 50, 60]))     # 4. same name
  ```

  **Output**

  ```
  50.0
  ```

### Blank page first

In a one to one class you write the header and the return line before anything else, since those are marks no logic error can take away.

### Change one thing

The teacher alters a call, a default or a global line in your own program and asks for the new output before you run it.

### Marks shown on screen

Your answer is split into halves and ones beside you, so you learn where marks come from and stop guessing.

Next chapter in the syllabus: [exception handling for Class 12](/cbse-class-12-computer-science-exception-handling). For the other chapters, go to [Class 12 CS notes](/cbse-class-12-computer-science-notes).

One student, one teacher

## You learn functions by writing them while someone watches

A wrong scope idea can survive a whole year if nobody sees you trace. Classes are personalised one to one only, on days you choose and at your own timing, so the teacher sees the line where you hesitate. Begin with a priority demo: it is a full class, and its fee is adjusted against your first month if you enrol. If you only want a short look, take the free demo class. You pay month by month with no admission fee, and may stop at the end of any month.

Before you enrol · Try a class

### Priority demo, at a slot you pick

a full live class of about 45 to 60 minutes

- You write one function from a question you have not seen
- Your answer is marked in halves, as the board scheme does it
- One scope trace on paper, to find which rule is shaky
- A written skill report on defining, calling, returning and scope

[Book a priority demo](/book-demo)

The classes · Choose your own timing

### Personalised one to one

₹4,999

per month, 4 private classes, fully flexible timing

- Starts from your school test paper or your weakest question type
- You type every program yourself, with the teacher on the call
- Lists, strings and dictionaries from Class 11 repaired on the way
- Files, stack and connectivity follow, all as functions

Ask for a personalised plan

Some students need two sessions on this chapter and others need a month, because the gap is often in Class 11 loops and lists and not in def at all. One to one lets the plan follow that. The monthly fee is the one on this page, in the currency of your country.

Studying outside India?

## Learning the functions chapter from another country

CBSE schools in Dubai, Doha, Kuwait City or Kathmandu teach the same 083 functions line and sit the same paper, so the class is the same too. Only the clock changes, and you set it.

| Where you live | Time difference | Usual class window, local time | Format |
| --- | --- | --- | --- |
| India every Indian city | Indian time | Any time you choose | Personalised 1-on-1 |
| UAE and Oman Dubai, Abu Dhabi, Sharjah, Muscat | 1 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Saudi Arabia, Qatar, Kuwait, Bahrain Riyadh, Jeddah, Dammam, Doha, Kuwait City, Manama | 2 h 30 min behind India | 3:00 PM to 9:00 PM | Personalised 1-on-1 |
| Nepal Kathmandu | 15 min ahead of India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Ethiopia and East Africa Addis Ababa and East Africa Time | 2 h 30 min behind India | 4:30 PM to 9:00 PM | Personalised 1-on-1 |
| Singapore and Malaysia Singapore, Kuala Lumpur | 2 h 30 min ahead of India | 3:30 PM to 9:00 PM | Personalised 1-on-1 |

You need a computer with Python installed and a screen to share. Some students join from a school laptop in the evening and some before school. Tell us your free hours and we look for a teacher who fits them.

What families say

## Rated 4.9 across 547 Google reviews

Real reviews from real families. We neither write nor commission them.

★★★★★

"The one step solution for my son. Modern Age Coders make learning coding so simple that kids love it. The teachers explain complex concepts clearly with practical exercises and interactive content."

Ria Mukherjee

Parent

★★★★★

"Modern Age Coders has been a game-changer for me. I struggled to grasp IT concepts and coding before joining, but their classes transformed everything. I can now confidently write complex programs with ease."

Samriddha Mondal

Student

★★★★★

"One of the most wonderful education centres out there. Education is not limited to school syllabus but focuses on skill development."

Vansh Agarwal

Student

★★★★★

"My child Dhairya is really enjoying the Modern Age Coders classes. This is his first online class and he eagerly looks forward to it. I can already see his improvement, and the teachers are very cooperative."

Sonam Oswal

Parent of Dhairya

★★★★★

"Modern Age Coders have wonderful teachers who teach in a clear, easy and practical way. The teacher boosts students' confidence and inspires them to learn without hesitation."

Sonu Goyal

Parent

★★★★★

"I highly recommend this computer coding class! The teachers are incredibly knowledgeable and passionate about coding."

Ritu Kedia

Parent

The rest of the Class 12 series

## More pages for Class 12 students

Every page in the CBSE Class 12 Computer Science series, grouped by what you need.

### Practicals, project and viva

- [Class 12 CS viva questions](/cbse-class-12-computer-science-viva-questions)
- [Class 12 CS project with source code](/cbse-class-12-computer-science-project-python-mysql)
- [Class 12 CS project topics](/cbse-class-12-computer-science-project-topics)

### Exam, papers and marks

- [Class 12 CS sample paper practice](/cbse-class-12-computer-science-sample-paper-2026-27)
- [Class 12 CS exam date, pattern and marks](/cbse-class-12-computer-science-paper-pattern-and-marking-scheme)
- [Class 12 CS important questions](/cbse-class-12-computer-science-important-questions)

### Questions and practice

- [Class 12 CS MCQ test](/cbse-class-12-computer-science-mcq-test)
- [Class 12 CS output questions](/cbse-class-12-computer-science-output-questions)
- [Class 12 CS case study questions](/cbse-class-12-computer-science-case-study-questions)
- [Class 12 CS SQL questions](/cbse-class-12-computer-science-sql-queries)

### Chapter by chapter

- [Exception handling Class 12](/cbse-class-12-computer-science-exception-handling)
- [Text file handling Class 12](/cbse-class-12-computer-science-file-handling)
- [CSV and binary files Class 12](/cbse-class-12-computer-science-csv-and-binary-files)
- [Stack Class 12 Computer Science](/cbse-class-12-computer-science-stack)
- [Computer networks Class 12](/cbse-class-12-computer-science-computer-networks)
- [Python MySQL connectivity Class 12](/cbse-class-12-computer-science-python-mysql-connectivity)

### Notes, revision and help

- [Class 12 CS syllabus 2026-27](/cbse-class-12-computer-science-syllabus-2026-27)
- [Class 12 CS notes](/cbse-class-12-computer-science-notes)
- [Class 12 CS revision plan](/cbse-class-12-computer-science-revision-plan)
- [Class 12 CS crash course](/cbse-class-12-computer-science-crash-course)

**CBSE Class 12 Informatics Practices (065):** [Class 12 IP practical file](/cbse-class-12-informatics-practices-practical-file)  [Class 12 IP project with source code](/cbse-class-12-informatics-practices-project)  [Class 12 IP sample paper practice](/cbse-class-12-informatics-practices-sample-paper-2026-27)  [Class 12 IP important questions](/cbse-class-12-informatics-practices-important-questions)

**CBSE Class 12 Information Technology (802):** [IT 802 practical and project file](/cbse-class-12-it-802-practical-and-project-file)  [IT 802 Java notes and programs](/cbse-class-12-it-802-java-programs)  [IT 802 notes](/cbse-class-12-it-802-notes)

**CBSE Class 11 CS, IP and AI:** [Class 11 CS practical file](/cbse-class-11-computer-science-practical-file)  [Class 11 IP practical file](/cbse-class-11-informatics-practices-practical-file)  [CS or IP in Class 11](/computer-science-or-informatics-practices-class-11)

**ISC Computer Science (868):** [ISC Class 12 CS syllabus 2027](/isc-class-12-computer-science-syllabus-2027)  [ISC Class 12 CS practice paper](/isc-class-12-computer-science-specimen-paper-practice)  [ISC Class 12 practical questions solved](/isc-class-12-computer-science-practical-questions)  [ISC Boolean algebra and K-maps](/isc-class-12-computer-science-boolean-algebra)

**Program lists with output:** [Class 12 CS practical file](/blog/python-practical-file-class-12)  [20 Python programs for Class 12](/blog/python-programs-for-cbse-class-12)  [Menu-driven programs in Python](/blog/how-to-build-menu-driven-program-in-python)

Questions about this chapter

## Functions in Class 12 Python: common questions

### What are functions in Class 12 Computer Science?

A function is a named block of code that runs when it is called, can take values through parameters, and can return values. CBSE 083 for 2026-27 covers built-in functions, functions defined in a module and user defined functions, with positional and default parameters, return values, flow of execution and scope of a variable.

### How many marks do functions carry in Class 12 Computer Science?

CBSE gives no separate figure. Functions belong to Unit 1, Computational Thinking and Programming 2, which carries 40 of the 70 theory marks. In the 2026-27 sample paper they appear directly in 1, 2 and 3 mark questions, and most file and stack answers are written as functions as well.

### What is the difference between positional and default arguments?

A positional argument is matched to a parameter by its place in the call and must be supplied if that parameter has no default. A default parameter has a value in the header, used only when the call leaves that argument out. In the header, parameters with defaults come after those without.

### Are keyword arguments in the CBSE Class 12 syllabus?

The 083 syllabus for 2026-27 lists default parameters and positional parameters. Keyword arguments are not named. It still helps to recognise a call such as tour(rate=300, seats=2), where the parameter name is written in the call and the order no longer matters.

### What is the scope of a variable in Python Class 12?

Scope is the part of the program where a name can be used. A global variable is created outside all functions and can be read anywhere in the program. A local variable is created inside a function, including its parameters, and disappears when that call ends.

### Why do I get UnboundLocalError in a function?

Because the function assigns to a name somewhere in its body, Python treats that name as local for the whole function. If you read it before that assignment, it has no value yet. Either pass the value in as a parameter and return the result, or declare the name with global.

### Is recursion in the Class 12 Computer Science syllabus 2026-27?

No. Recursion does not appear in the 083 syllabus for Class 12 in 2026-27, and neither does *args. If a book or an old list includes recursive programs, leave them until you have finished functions, files and the stack.

### Where can I find functions class 12 previous year questions?

CBSE puts its question papers and marking schemes on its own website. Practise from those, and check the year, because the syllabus has changed over time. The 18 questions here are our own, in the same shapes, so they are useful after the official ones are finished.

### Can a Python function return more than one value?

It can return several values separated by commas, and Python sends them back as one tuple. You may keep the tuple in one variable or unpack it, as in total, highest, dry = rainfall(week). The number of names must match the number of values.

### Can I get one to one help with Python functions for Class 12?

Yes. Modern Age Coders teaches 083 live and one to one, at days and times you pick. A priority demo is a full class of about 45 to 60 minutes with a written skill report, its fee adjusted against the first month if you join. A free demo class is also available.

Start

## Send one function you could not write.

Bring it to the free demo class and the teacher will start it with you: header, parameters, what must come back, then the loop in between.

To test the chapter properly, choose a **priority demo** at a slot that suits you. You write, trace and correct for a whole class, and the skill report tells you which of the four areas needs work: arguments, flow, return or scope. The fee counts towards the first month if you carry on.

Revising alone this week? Try the [Class 12 CS MCQ test](/cbse-class-12-computer-science-mcq-test) after the one-mark set above.

[WhatsApp us](https://wa.me/919123366161?text=Hello%20Modern%20Age%20Coders.%20I%20want%20one%20to%20one%20classes%20for%20the%20Functions%20chapter%20in%20CBSE%20Class%2012%20Computer%20Science%20083.) · [+91 91233 66161](tel:+919123366161) · [connect@modernagecoders.com](mailto:connect@modernagecoders.com)

Every class is live video. The form requests a callback and reserves nothing.

### Want it sooner? Book a priority demo

A full live class of about 45 to 60 minutes at a slot you pick, with a written skill report and learning roadmap on WhatsApp afterwards. The fee is adjusted against your first month if you enrol.

[Book a priority demo](/book-demo)

## Keep exploring Modern Age Coders

### By class and age

- [Number System Class 11 Computer Science: Conversions, Logic](/cbse-class-11-number-system-conversion)
- [Class 11 IP Sample Paper 2026-27 With Solution, 70 Marks](/cbse-class-11-informatics-practices-sample-paper)
- [Class 11 IP Notes 2026-27: All Four Units, With Code](/cbse-class-11-informatics-practices-notes)
- [Class 11 Computer Science Sample Paper 2026-27, Solved](/cbse-class-11-computer-science-sample-paper)
- [Class 11 Computer Science Project in Python, with Topics](/cbse-class-11-computer-science-project)
- [Class 11 Computer Science Notes 2026-27, Chapter Wise](/cbse-class-11-computer-science-notes)
- [ISC Class 12 Computer Science Project and Work File 2027](/isc-class-12-computer-science-work-file-and-project)
- [ISC Class 12 Computer Science Important Questions, Pattern](/isc-class-12-computer-science-paper-pattern-and-important-questions)
- [ISC Class 12 Computer Science Crash Course 2027, One to One](/isc-class-12-computer-science-crash-course)

### Learn more

- [AP Computer Science A Practice Questions, With Answers](/ap-computer-science-a-practice-questions)
- [CS Summer Programs for High School Students: 2027 Guide](/computer-science-summer-programs-for-high-school-students)
- [Cambridge IGCSE Computer Science Tuition](/cambridge-igcse-computer-science-tuition)
- [AQA GCSE Computer Science 8525 Help](/aqa-gcse-computer-science-8525-help)

### Free resources

- [HTML & CSS Tutorial: Build Websites from Scratch](/resources/html-and-css)
- [Project: Build an Animated Portfolio Website](/resources/html-and-css/project-animated-portfolio-website)
- [STL Algorithms and Iterators](/resources/cpp/stl-algorithms-and-iterators)
- [Typography and Google Fonts](/resources/html-and-css/typography-and-fonts)

### From the blog

- [Python Programs for Class 11 CBSE (CS and IP) With Output](/blog/python-programs-for-class-11)
- [ICSE Class 10 Computer Applications: Revision Guide](/blog/icse-class-10-computer-applications-revision)
- [Java Programs for ISC Class 11 and 12 (Solved, 2026)](/blog/java-programs-for-isc-class-11-and-12)

### Start here

- [What Modern Age Coders families say](/love)
- [Book a free demo class with Modern Age Coders](/book-demo)

---

*Canonical: https://learn.modernagecoders.com/cbse-class-12-computer-science-functions*
