---
title: "Class 11 Computer Science Practical File 2026-27, Python"
description: "Class 11 Computer Science practical file for CBSE 083, 2026-27: 25 Python programs with real output, cover, certificate, index and viva answers."
canonical: https://learn.modernagecoders.com/cbse-class-11-computer-science-practical-file
source: src/pages/cbse-class-11-computer-science-practical-file.html
---
> Class 11 Computer Science practical file for CBSE 083, 2026-27: 25 Python programs with real output, cover, certificate, index and viva answers.

Start here

## Courses for the student who is making this file

The Class 11 and 12 Computer Science course follows the 083 syllabus, so the file grows with the chapters. Python for Teens suits a student who wants more coding than the syllabus asks for, and MySQL gets Class 12 ready early.

[![Computer Science Class 11 and 12 course thumbnail](/images/ip-cs-class-11-12.webp)  This subject / 083 Computer Science Class 11 and 12 The full board syllabus with practical file programs, project guidance and viva preparation built in. Open the course →](/courses/cbse-icse-computer-science-class-11-12-python-java-complete-course)[![Python for Teens course thumbnail](/images/python-teens.webp)  More Python / Teens Python for Teens From the first print statement to games, web apps, data and a capstone, for students who finish the syllabus programs and want harder ones. Open the course →](/courses/python-complete-masterclass-teens)[![MySQL for Teens course thumbnail](/images/mysql-teens.webp)  Towards Class 12 / SQL MySQL for Teens SQL is not in Class 11 Computer Science, but it carries 20 theory marks in Class 12. This course starts from the first SELECT. Open the course →](/courses/mysql-mastery-for-teens)

Ans. The short version

A Class 11 Computer Science practical file for CBSE 083 must hold at least 20 Python programs and earns 7 of the 30 practical marks in 2026-27; the lab test is 12, the project 8 and the viva 3. The file usually has a cover, certificate, acknowledgement and index, then one entry per program: aim, code, output. This page gives 25 original programs that cover the whole official suggested list, each with real output. Modern Age Coders helps students write their own file in live one to one classes, and a priority demo lets you try a full class first.

Q1. What does CBSE ask for?

## How many programs are needed in the Class 11 Computer Science practical file?

At least 20 Python programs. That is the wording in the CBSE Class XI curriculum for 2026-27, and it is for the report file alone: the project is marked separately.

| Practical component | Marks | What it means for you |
| --- | --- | --- |
| Lab test: one Python program | 12 | 60% for logic, 20% for documentation, 20% for code quality, which works out to 7.2, 2.4 and 2.4 marks |
| Report file: minimum 20 Python programs | 7 | The practical file on this page |
| Viva voce | 3 | Spoken questions; be ready on every page of your own file |
| Project using most of the concepts learnt | 8 | A bigger program of your own, kept apart from the 20 |
| **Total** | **30** | Added to 70 marks of theory |

The suggested list has only 15 lines, which worries students who need 20. Count again: the pattern line holds three patterns, the series line holds four sums, the number line names three checks and one string line asks for two jobs. Written separately, those 15 lines become 23 programs, and that is how the index below reaches the minimum without any padding.

One more thing about level. The Class 11 syllabus does not list writing your own functions, exception handling or data files, so nothing on this page uses them. If a downloaded file is full of `def` and `open()`, it was made for Class 12. The Class 12 version is in our [Class 12 practical file guide](/blog/python-practical-file-class-12), and the rest of this year’s theory is in the [Class 11 Computer Science notes](/cbse-class-11-computer-science-notes).

Q2. What goes on the first pages?

## Class 11 CS practical file format: cover, certificate, acknowledgement, index

Four front pages come before Program 1. CBSE does not print a layout for them, so a layout given by your teacher always wins. Where the school leaves it open, the wording below is safe to adapt; fill in the bracketed parts.

### Cover page

[Name of school]
 **Computer Science (083)**
 Report File: Python Programs
 Session 2026-27

Submitted by: [name]
 Class and section: XI [section]
 Roll number: [number]
 Submitted to: [teacher’s name]

### Certificate

Certified that [name], roll number [number] of Class XI [section], has written and executed the Python programs in this file in the computer laboratory of [school] during the session 2026-27, as required for Computer Science (083).

Date: [date]
 Signature of subject teacher: [blank]
 Signature of examiner: [blank]
 School stamp: [blank]

### Acknowledgement

I am grateful to [teacher’s name], who taught me to test a program before trusting it, and to [principal’s name] for the laboratory time in which this file was made. I also thank my classmates who ran my programs and told me where they broke.

[Your name], Class XI [section]

### One entry in the file

**Program number and date** at the top, then the **aim** in one sentence, the **program** with comments, and the **output** with the typed values visible.

Where a program makes a decision, paste two runs, one for each answer. Leave space for the teacher’s signature at the foot of the page.

### Index of the practical file (25 programs)

Copy the first two columns into your own index and add Date, Page and Teacher’s signature. The third column shows which line of the CBSE list each entry answers.

| No. | Program | Where it comes from |
| --- | --- | --- |
| 1 | Welcome message inside a border | Suggested list, line 1 |
| 2 | Larger and smaller of two numbers | Line 2 |
| 3 | Largest and smallest of three numbers | Line 3 |
| 4 to 6 | Three patterns with nested loops | Line 4, Patterns 1, 2 and 3 |
| 7 to 10 | Sums of four series in x and n | Line 5, four series |
| 11 | Perfect number | Line 6 |
| 12 | Armstrong number | Line 6 |
| 13 | Palindrome number | Line 6 |
| 14 | Prime or composite | Line 7 |
| 15 | Fibonacci terms up to a limit | Line 8 |
| 16 | GCD and LCM | Line 9 |
| 17 | Vowels, consonants, capitals, small letters | Line 10 |
| 18 | Palindrome string | Line 11 |
| 19 | Case conversion | Line 11 |
| 20 | Largest and smallest in a list and a tuple | Line 12 |
| 21 | Swap even and odd locations | Line 13 |
| 22 | Search in a tuple | Line 14 |
| 23 | Students above 75 | Line 15 |
| 24 | Employees and salaries | Syllabus, dictionary topic |
| 25 | math, random and statistics | Syllabus, modules topic |

Q3. What do Programs 1 to 10 look like?

## Class 11 Computer Science practical file with Python programs 1 to 10: input, patterns, series

The first ten entries read values, make a decision, draw three patterns and add four series. In the output boxes, whatever follows a prompt was typed at the keyboard; two runs in one box are separated by a blank line.

### Program 1: welcome message

**Aim:** To input a welcome message and display it neatly.

***Program 1**Python code*

```
# Program 1: welcome message inside a border
# Written by: <your name>, Class XI <section>, <date>
visitor = input("Your name: ")
message = input("Welcome message: ")

line = message + ", " + visitor
border = "*" * (len(line) + 4)    # 2 characters on each side

print(border)
print("* " + line + " *")
print(border)
```

***Output**one run*

```
Your name: Ritika
Welcome message: Good morning and welcome
************************************
* Good morning and welcome, Ritika *
************************************
```

**To say in the viva:** the border grows with the message because its length comes from `len()`. Multiplying a string by a number repeats it.

### Program 2: larger and smaller of two numbers

**Aim:** To input two numbers and display the larger and the smaller.

***Program 2**Python code*

```
# Program 2: larger and smaller of two numbers
first = int(input("First number : "))
second = int(input("Second number: "))

if first == second:
    print("Both numbers are the same")
else:
    if first < second:
        first, second = second, first   # bigger first
    print("Larger number :", first)
    print("Smaller number:", second)
    print("They differ by:", first - second)
```

***Output**2 runs*

```
First number : -18
Second number: 6
Larger number : 6
Smaller number: -18
They differ by: 24

First number : 40
Second number: 40
Both numbers are the same
```

**To say in the viva:** one tuple assignment puts the numbers in order, so only one pair of print lines is needed. The equal case is tested first; without it the program would claim that 40 is larger than 40.

### Program 3: largest and smallest of three numbers

**Aim:** To input three numbers and display the largest and the smallest.

***Program 3**Python code*

```
# Program 3: largest and smallest of three numbers
p = float(input("Number 1: "))
q = float(input("Number 2: "))
r = float(input("Number 3: "))

# >= (not >) so that equal numbers are handled too
if p >= q and p >= r:
    big = p
elif q >= r:
    big = q
else:
    big = r

if p <= q and p <= r:
    small = p
elif q <= r:
    small = q
else:
    small = r

print("Largest :", big)
print("Smallest:", small)
```

***Output**2 runs*

```
Number 1: 36.6
Number 2: 38.2
Number 3: 37.1
Largest : 38.2
Smallest: 36.6

Number 1: 5
Number 2: 5
Number 3: 2
Largest : 5.0
Smallest: 2.0
```

**To say in the viva:** `float()` accepts body temperatures as well as whole numbers. The second run has a tie, and `>=` is what keeps the tie from falling into the wrong branch.

### Program 4: Pattern-1, stars

**Aim:** To print a triangle of stars using nested loops.

***Program 4**Python code*

```
# Program 4: Pattern-1, a triangle of stars
height = int(input("How many rows? "))

row = 1
while row <= height:
    star = 1
    while star <= row:          # row r has r stars
        print("*", end="")
        star += 1
    print()                     # go to the next line
    row += 1
```

***Output**one run*

```
How many rows? 5
*
**
***
****
*****
```

**To say in the viva:** the outer loop chooses the row and the inner loop prints that row. `end=""` stops print from starting a new line after each star.

### Program 5: Pattern-2, numbers

**Aim:** To print 12345, 1234, 123, 12, 1 using nested loops.

***Program 5**Python code*

```
# Program 5: Pattern-2, numbers 1 to 5, one fewer each row
last = 5
while last >= 1:
    for number in range(1, last + 1):
        print(number, end="")
    print()
    last -= 1
```

***Output**one run*

```
12345
1234
123
12
1
```

**To say in the viva:** a while loop sits outside and a for loop inside; mixing the two kinds is allowed. The variable `last` is both the end of the row and the row counter.

### Program 6: Pattern-3, letters

**Aim:** To print A, AB, ABC, ABCD, ABCDE using nested loops.

***Program 6**Python code*

```
# Program 6: Pattern-3, a triangle of letters
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
rows = int(input("Rows (1 to 26): "))

if rows < 1 or rows > 26:
    print("Only 26 letters are available")
else:
    for r in range(rows):
        for position in range(r + 1):
            print(letters[position], end="")
        print()
```

***Output**2 runs*

```
Rows (1 to 26): 5
A
AB
ABC
ABCD
ABCDE

Rows (1 to 26): 30
Only 26 letters are available
```

**To say in the viva:** the letters are picked from a string by index, so no ASCII codes are needed. The check at the top prevents an IndexError when someone asks for 30 rows.

### Program 7: sum of 1 + x + x² + ... + xⁿ

**Aim:** To input x and n and print the sum of the first series.

***Program 7**Python code*

```
# Program 7: sum of 1 + x + x^2 + x^3 + ... + x^n
x = int(input("x = "))
n = int(input("n = "))

term = 1            # the first term
series_sum = 0
for power in range(n + 1):
    print("x ^", power, "=", term)
    series_sum += term
    term = term * x      # next term = this term times x

print("Sum of the series =", series_sum)
```

***Output**one run*

```
x = 3
n = 4
x ^ 0 = 1
x ^ 1 = 3
x ^ 2 = 9
x ^ 3 = 27
x ^ 4 = 81
Sum of the series = 121
```

**To say in the viva:** each term is made from the one before it, so the program never uses the power operator. With x = 3 the terms are 1, 3, 9, 27 and 81, and they add to 121.

### Program 8: sum of 1 - x + x² - x³ + ...

**Aim:** To input x and n and print the sum of the series with alternating signs.

***Program 8**Python code*

```
# Program 8: sum of 1 - x + x^2 - x^3 + ... up to x^n
x = int(input("x = "))
n = int(input("n = "))

series_sum = 0
for power in range(n + 1):
    if power % 2 == 0:
        series_sum += x ** power     # even power: add
    else:
        series_sum -= x ** power     # odd power: subtract

print("Sum up to x ^", n, "=", series_sum)
```

***Output**2 runs*

```
x = 3
n = 4
Sum up to x ^ 4 = 61

x = 3
n = 5
Sum up to x ^ 5 = -182
```

**To say in the viva:** an even power is added and an odd power is subtracted, which `power % 2` decides. The two runs end on different signs: 1 - 3 + 9 - 27 + 81 is 61, and taking away 243 leaves -182.

### Program 9: sum of x + x²/2 + x³/3 + ... + xⁿ/n

**Aim:** To input x and n and print the sum of the third series.

***Program 9**Python code*

```
# Program 9: sum of x + x^2/2 + x^3/3 + ... + x^n/n
x = float(input("x = "))
n = int(input("n = "))

power_of_x = 1
series_sum = 0.0
k = 1
while k <= n:
    power_of_x *= x              # x, x^2, x^3, ...
    term = power_of_x / k
    series_sum += term
    print("Term", k, "=", round(term, 4))
    k += 1

print("Sum =", round(series_sum, 4))
```

***Output**one run*

```
x = 3
n = 4
Term 1 = 3.0
Term 2 = 4.5
Term 3 = 9.0
Term 4 = 20.25
Sum = 36.75
```

**To say in the viva:** the loop starts at 1 because the first term is x, not 1, and because dividing by 0 would stop the program. Printing the terms lets you check them on paper: 3, 4.5, 9 and 20.25.

### Program 10: sum of x + x²/2! + x³/3! + ... + xⁿ/n!

**Aim:** To input x and n and print the sum of the factorial series.

***Program 10**Python code*

```
# Program 10: sum of x + x^2/2! + x^3/3! + ... + x^n/n!
x = float(input("x = "))
n = int(input("n = "))

term = 1.0
series_sum = 0.0
for k in range(1, n + 1):
    term = term * x / k     # x^k / k! made from the last term
    series_sum += term

print("Sum of", n, "terms =", round(series_sum, 4))
```

***Output**2 runs*

```
x = 3
n = 4
Sum of 4 terms = 15.375

x = 3
n = 15
Sum of 15 terms = 19.0855
```

**To say in the viva:** there is no factorial loop. Multiplying the last term by `x / k` gives the new term, because x^k/k! is the previous term times x divided by k.

Q4. Which number programs are on the list?

## Class 11 CS practical file with output: number programs 11 to 16

Lines 6 to 9 of the list name seven number tasks: perfect, Armstrong, palindrome, prime or composite, Fibonacci, GCD and LCM. Each program here prints its working, so a wrong answer can be traced to a line.

### Program 11: perfect number

**Aim:** To determine whether a number is a perfect number.

***Program 11**Python code*

```
# Program 11: is the number a perfect number?
number = int(input("Positive whole number: "))

factors = []                    # proper factors only
for f in range(1, number // 2 + 1):
    if number % f == 0:
        factors.append(f)

print("Proper factors:", factors)
print("Their sum     :", sum(factors))
if number > 0 and sum(factors) == number:
    print(number, "is perfect")
else:
    print(number, "is not perfect")
```

***Output**2 runs*

```
Positive whole number: 496
Proper factors: [1, 2, 4, 8, 16, 31, 62, 124, 248]
Their sum     : 496
496 is perfect

Positive whole number: 18
Proper factors: [1, 2, 3, 6, 9]
Their sum     : 21
18 is not perfect
```

**To say in the viva:** no proper factor of a number can be bigger than half of it, so the loop ends at `number // 2`. For 496 the nine factors add back to 496.

### Program 12: Armstrong number

**Aim:** To determine whether a number is an Armstrong number.

***Program 12**Python code*

```
# Program 12: is the number an Armstrong number?
text = input("Positive whole number: ")
how_many = len(text)            # the power to use

total = 0
for ch in text:                 # one digit at a time
    value = int(ch) ** how_many
    print(ch, "^", how_many, "=", value)
    total += value

print("Sum of powers =", total)
if total == int(text):
    print("Armstrong number")
else:
    print("Not an Armstrong number")
```

***Output**2 runs*

```
Positive whole number: 8208
8 ^ 4 = 4096
2 ^ 4 = 16
0 ^ 4 = 0
8 ^ 4 = 4096
Sum of powers = 8208
Armstrong number

Positive whole number: 124
1 ^ 3 = 1
2 ^ 3 = 8
4 ^ 3 = 64
Sum of powers = 73
Not an Armstrong number
```

**To say in the viva:** the number is kept as a string, so each character is one digit and `len()` gives the power. 8208 has four digits, so its digits are raised to the power 4, not 3.

### Program 13: palindrome number

**Aim:** To determine whether a number is a palindrome.

***Program 13**Python code*

```
# Program 13: is the number a palindrome?
text = input("Whole number: ")
left = 0
right = len(text) - 1
same = True

while left < right:
    if text[left] != text[right]:
        same = False
        break                   # one mismatch is enough
    left += 1
    right -= 1

if same:
    print(text, "reads the same both ways: palindrome")
else:
    print(text, "is not a palindrome: digits", text[left],
          "and", text[right], "differ")
```

***Output**2 runs*

```
Whole number: 70407
70407 reads the same both ways: palindrome

Whole number: 52335
52335 is not a palindrome: digits 2 and 3 differ
```

**To say in the viva:** two index variables walk inwards from the ends, and `break` stops at the first pair that differs. Nothing is reversed, so no second copy of the number is stored.

### Program 14: prime or composite

**Aim:** To input a number and check whether it is prime or composite.

***Program 14**Python code*

```
# Program 14: prime or composite
number = int(input("Whole number: "))

if number < 2:
    print(number, "is neither prime nor composite")
else:
    divisor = 2
    while number % divisor != 0:    # stops at first factor
        divisor += 1

    if divisor == number:
        print(number, "is prime")
    else:
        print(number, "is composite")
        print("because", divisor, "x", number // divisor,
              "=", number)
```

***Output**3 runs*

```
Whole number: 97
97 is prime

Whole number: 221
221 is composite
because 13 x 17 = 221

Whole number: 1
1 is neither prime nor composite
```

**To say in the viva:** the while loop always ends, because a number divides itself. If the first divisor found is the number itself, it is prime. 1 is neither, and it needs its own test.

### Program 15: Fibonacci series

**Aim:** To display the terms of the Fibonacci series up to a limit.

***Program 15**Python code*

```
# Program 15: Fibonacci terms up to a limit
limit = int(input("Show terms up to: "))

series = []
current = 0
following = 1
while current <= limit:
    series.append(current)
    upcoming = current + following
    current = following
    following = upcoming

print("Terms:", series)
print("Number of terms:", len(series))
```

***Output**2 runs*

```
Show terms up to: 60
Terms: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
Number of terms: 11

Show terms up to: 0
Terms: [0]
Number of terms: 1
```

**To say in the viva:** the limit is a value, not a count, so a while loop fits better than a for loop. `upcoming` must be worked out before `current` is overwritten.

### Program 16: GCD and LCM

**Aim:** To compute the greatest common divisor and least common multiple of two integers.

***Program 16**Python code*

```
# Program 16: GCD and LCM of two positive integers
m = int(input("First integer : "))
n = int(input("Second integer: "))

# GCD: try every number downwards, stop at the first hit
gcd = min(m, n)
while m % gcd != 0 or n % gcd != 0:
    gcd -= 1

# LCM: try the multiples of the bigger number
lcm = max(m, n)
while lcm % m != 0 or lcm % n != 0:
    lcm += max(m, n)

print("GCD =", gcd)
print("LCM =", lcm)
print("Check: GCD x LCM =", gcd * lcm, "and m x n =", m * n)
```

***Output**2 runs*

```
First integer : 18
Second integer: 48
GCD = 6
LCM = 144
Check: GCD x LCM = 864 and m x n = 864

First integer : 9
Second integer: 16
GCD = 1
LCM = 144
Check: GCD x LCM = 144 and m x n = 144
```

**To say in the viva:** both answers come straight from their definitions: the first common divisor going down and the first common multiple going up. The last line is a check: GCD times LCM must equal the product of the two integers. Enter positive integers; a zero would mean dividing by zero.

Programs about converting numbers between bases are not on this list, but the conversions themselves are in Unit 1 and done by hand; they are worked on [number system conversion for Class 11](/cbse-class-11-number-system-conversion).

Q5. Which entries cover strings, lists and dictionaries?

## Python programs 17 to 25: strings, lists, tuples, dictionaries and modules

Entries 17 to 23 finish the suggested list. Entries 24 and 25 come from the topics of Unit 2, so the file also shows dictionary methods and the three modules the syllabus names.

### Program 17: counting characters in a string

**Aim:** To count vowels, consonants, uppercase and lowercase characters in a string.

***Program 17**Python code*

```
# Program 17: vowels, consonants, capitals, small letters
sentence = input("Type a sentence: ")
capitals = small = vowel_count = other = 0

for ch in sentence:
    if ch.isupper():
        capitals += 1
    elif ch.islower():
        small += 1
    else:
        other += 1              # digits, spaces, symbols
    if ch in "aeiouAEIOU":
        vowel_count += 1

letters = capitals + small
print("Vowels           :", vowel_count)
print("Consonants       :", letters - vowel_count)
print("Uppercase letters:", capitals)
print("Lowercase letters:", small)
print("Everything else  :", other)
```

***Output**one run*

```
Type a sentence: Room 12B opens at 9 AM
Vowels           : 6
Consonants       : 8
Uppercase letters: 4
Lowercase letters: 10
Everything else  : 8
```

**To say in the viva:** consonants are not counted directly; they are letters minus vowels. Spaces and digits land in the last counter, so all 22 characters of the sentence are accounted for.

### Program 18: palindrome string

**Aim:** To input a string and determine whether it is a palindrome.

***Program 18**Python code*

```
# Program 18: is the string a palindrome?
phrase = input("Word or phrase: ")

backwards = ""
forwards = ""
for ch in phrase:
    if ch.isalnum():               # ignore spaces and commas
        forwards = forwards + ch.lower()
        backwards = ch.lower() + backwards

print("Compared:", forwards, "with", backwards)
if forwards != "" and forwards == backwards:
    print("Palindrome")
else:
    print("Not a palindrome")
```

***Output**2 runs*

```
Word or phrase: Was it a car or a cat I saw?
Compared: wasitacaroracatisaw with wasitacaroracatisaw
Palindrome

Word or phrase: Notebook
Compared: notebook with koobeton
Not a palindrome
```

**To say in the viva:** writing `ch + backwards` puts each new character in front, which reverses the phrase without slicing. `isalnum()` drops the spaces and the question mark before comparing.

### Program 19: case conversion

**Aim:** To convert the case of the characters in a string.

***Program 19**Python code*

```
# Program 19: convert the case of every character
original = input("Text: ")
changed = ""

for ch in original:
    if ch.isupper():
        changed += ch.lower()
    elif ch.islower():
        changed += ch.upper()
    else:
        changed += ch            # digits and spaces stay

print("Case changed :", changed)
print("All capitals :", original.upper())
print("First capital:", original.capitalize())
```

***Output**one run*

```
Text: rEPORT fILE 2027
Case changed : Report File 2027
All capitals : REPORT FILE 2027
First capital: Report file 2027
```

**To say in the viva:** strings are immutable, so a new string is built character by character. The last line shows the difference between `capitalize()`, which touches one letter, and `upper()`, which touches all.

### Program 20: largest and smallest in a list and a tuple

**Aim:** To find the largest and the smallest number in a list and in a tuple.

***Program 20**Python code*

```
# Program 20: largest and smallest in a list and a tuple
entries = input("Numbers with spaces: ").split()
heights = []
for e in entries:
    heights.append(int(e))

high = low = 0                  # positions, not values
for i in range(1, len(heights)):
    if heights[i] > heights[high]:
        high = i
    if heights[i] < heights[low]:
        low = i

print("List    :", heights)
print("Largest :", heights[high], "at index", high)
print("Smallest:", heights[low], "at index", low)

fixed = tuple(heights)          # same check on a tuple
print("Tuple   :", fixed, "max", max(fixed), "min", min(fixed))
```

***Output**one run*

```
Numbers with spaces: 158 171 149 165 171
List    : [158, 171, 149, 165, 171]
Largest : 171 at index 1
Smallest: 149 at index 2
Tuple   : (158, 171, 149, 165, 171) max 171 min 149
```

**To say in the viva:** the loop remembers positions rather than values, so it can also report where the answer is. 171 appears twice; `>` keeps the first position, and `>=` would report index 4.

### Program 21: swapping even and odd locations

**Aim:** To input a list of numbers and swap elements at even locations with those at odd locations.

***Program 21**Python code*

```
# Program 21: swap even locations with odd locations
count = int(input("How many numbers? "))
values = []
for i in range(count):
    values.append(int(input("Value at index " + str(i) + ": ")))
print("Before:", values)

i = 0
while i + 1 < count:            # a pair must exist
    temp = values[i]
    values[i] = values[i + 1]
    values[i + 1] = temp
    i += 2

print("After :", values)
```

***Output**one run*

```
How many numbers? 5
Value at index 0: 11
Value at index 1: 22
Value at index 2: 33
Value at index 3: 44
Value at index 4: 55
Before: [11, 22, 33, 44, 55]
After : [22, 11, 44, 33, 55]
```

**To say in the viva:** the condition `i + 1 < count` asks whether a partner exists. With five values, 55 has no partner and stays where it is.

### Program 22: search in a tuple

**Aim:** To search for a given element in a tuple.

***Program 22**Python code*

```
# Program 22: search for an element in a tuple
stock = ("pen", "ruler", "eraser", "pen", "stapler")
print("Tuple:", stock)
wanted = input("Item to find: ").strip().lower()

places = []
for i in range(len(stock)):
    if stock[i] == wanted:
        places.append(i)         # keep every match

if len(places) == 0:
    print(wanted, "is not in the tuple")
else:
    print(wanted, "found", len(places), "time(s), index", places)
```

***Output**2 runs*

```
Tuple: ('pen', 'ruler', 'eraser', 'pen', 'stapler')
Item to find:   Pen
pen found 2 time(s), index [0, 3]

Tuple: ('pen', 'ruler', 'eraser', 'pen', 'stapler')
Item to find: compass
compass is not in the tuple
```

**To say in the viva:** this is linear search, and it does not stop at the first match because an item can appear more than once. `strip()` and `lower()` forgive the stray spaces and the capital P in the first run.

### Program 23: students with marks above 75

**Aim:** To create a dictionary with the roll number, name and marks of n students and display the names of those above 75.

***Program 23**Python code*

```
# Program 23: names of students with marks above 75
register = {}                   # roll number : [name, marks]
n = int(input("Students in class: "))

while len(register) < n:
    roll = int(input("Roll no: "))
    if roll in register:
        print("Roll", roll, "is already entered")
    else:
        name = input("Name   : ")
        marks = int(input("Marks  : "))
        register[roll] = [name, marks]

print("Above 75:")
count = 0
for roll in register:
    if register[roll][1] > 75:
        print(roll, register[roll][0])
        count += 1
print(count, "of", n, "students")
```

***Output**one run*

```
Students in class: 3
Roll no: 11
Name   : Farhan
Marks  : 75
Roll no: 11
Roll 11 is already entered
Roll no: 12
Name   : Lavanya
Marks  : 76
Roll no: 13
Name   : Joel
Marks  : 90
Above 75:
12 Lavanya
13 Joel
2 of 3 students
```

**To say in the viva:** the roll number is the key because no two students share one, and a repeated roll number is refused. Farhan has exactly 75, which is not above 75, so his name is not printed.

### Program 24: employees and salaries

**Aim:** To create a dictionary of employees with their salaries and access them.

***Program 24**Python code*

```
# Program 24: employees and salaries in a dictionary
names = ("Gauri", "Imran", "Peter")
pay = dict.fromkeys(names, 30000)     # same starting salary
print(pay)

pay.update({"Imran": 34500, "Sunita": 41000})
pay.setdefault("Peter", 99999)        # key exists: no change
print(pay)

who = input("Salary of which employee? ")
print(who, ":", pay.get(who, "no such employee"))

for name in sorted(pay):
    print(name, "x" * (pay[name] // 5000), pay[name])
print("Highest:", max(pay.values()), "Lowest:", min(pay.values()))
```

***Output**one run*

```
{'Gauri': 30000, 'Imran': 30000, 'Peter': 30000}
{'Gauri': 30000, 'Imran': 34500, 'Peter': 30000, 'Sunita': 41000}
Salary of which employee? Imran
Imran : 34500
Gauri xxxxxx 30000
Imran xxxxxx 34500
Peter xxxxxx 30000
Sunita xxxxxxxx 41000
Highest: 41000 Lowest: 30000
```

**To say in the viva:** `setdefault()` adds a key only if it is missing, so Peter keeps 30000. `get()` takes a second value to return when the name is not a key.

### Program 25: math, random and statistics modules

**Aim:** To use functions of the math, random and statistics modules.

***Program 25**Python code*

```
# Program 25: math, random and statistics modules
import math
import statistics
from random import randint

throws = []
for i in range(12):
    throws.append(randint(1, 6))     # one roll of a die

print("Throws :", throws)
print("Mean   :", round(statistics.mean(throws), 2))
print("Median :", statistics.median(throws))
print("Mode   :", statistics.mode(throws))
print("Boxes of 5 needed for 12 dice:", math.ceil(12 / 5))
```

***Output**one run*

```
Throws : [5, 4, 2, 4, 5, 2, 4, 5, 6, 6, 3, 1]
Mean   : 3.92
Median : 4.0
Mode   : 5
Boxes of 5 needed for 12 dice: 3
```

**To say in the viva:** this is one real run; yours will show other numbers, because `randint(1, 6)` picks afresh each time and includes both 1 and 6. `math.ceil(2.4)` is 3, since a part box is still a box.

Want a different program for the same aim, so that your file does not match a friend’s? The blog has [51 Python programs for Class 11](/blog/python-programs-for-class-11) written another way. Students of Informatics Practices need a different file, with SQL in it: see the [Class 11 IP practical file](/cbse-class-11-informatics-practices-practical-file).

Q6. What can they ask you?

## Class 11 Computer Science viva questions with answers

The viva carries 3 marks and CBSE publishes no list of questions for it. A sensible plan is to prepare in two rounds: your own programs first, then the Python ideas behind them.

### Round 1: questions about the programs above

1. **In Program 2, what does `first, second = second, first` do?** It swaps the two values in one step. The right side is packed as a tuple before anything is assigned, so no third variable is needed.
2. **What if Program 3 used three separate if statements with >?** With two equal largest numbers, no strict comparison would be true for either, and the variable could be left without a value.
3. **In Program 4, how many times does the inner print run for five rows?** 1 + 2 + 3 + 4 + 5, which is 15 times.
4. **Why does Program 9 print a decimal point when Program 7 does not?** Program 7 reads x with `int()` and only adds and multiplies. Program 9 reads a float and divides, and `/` gives a float even for 6 / 3.
5. **What would Program 11 say for a prime such as 13?** Its only proper factor is 1, so the sum is 1 and the answer is not perfect.
6. **Why is `int(text)` needed on the last test of Program 12?**`total` is an integer and `text` is a string. Comparing them without converting is always False.
7. **Does Program 13 compare the middle digit of 70407?** No. The loop stops when left meets right, because a digit always equals itself.
8. **Which runs longer in Program 14, 97 or 221?** 97. It tries every divisor from 2 to 97, while 221 stops at 13.
9. **In Program 15, what type is `series` and why?** A list. The number of terms is not known beforehand and a list can grow with `append()`.
10. **Why does the search in Program 16 start at `min(m, n)`?** No common divisor can be larger than the smaller number.
11. **Can Program 21 be written for a tuple?** Not directly. A tuple is immutable, so you would change a list and convert it with `tuple()`.
12. **In Program 23, what does `register[roll][1]` mean?** The value for that roll number is a list, and index 1 of the list holds the marks.

### Round 2: questions about Python itself

1. **What is the difference between / and //?**`7 / 2` is 3.5 and `7 // 2` is 3. Floor division goes down, so `-7 // 2` is -4.
2. **What does input() return?** Always a string. `"5" * 3` is `555`, which is why numbers are converted with `int()` or `float()`.
3. **Name the three kinds of error.** Syntax error: the code breaks the grammar. Run-time error: it stops while running, such as division by zero. Logical error: it runs and gives a wrong answer.
4. **What happens with `int("12.5")`?** A ValueError, because the text is not a whole number. `float("12.5")` works.
5. **Which types are mutable?** Lists and dictionaries. Numbers, strings and tuples are immutable, so `s[0] = "t"` on a string raises a TypeError.
6. **How do find() and index() differ?** When the substring is missing, `find()` returns -1 and `index()` raises a ValueError.
7. **How do you write a tuple with one element?** With a comma: `(4,)`. Without it, `(4)` is just an integer.
8. **What values does `range(2, 11, 3)` give?** 2, 5 and 8. The stop value is never included.
9. **What is the difference between == and is?**`==` compares values; `is` checks whether two names refer to the same object. After `b = a` for a list, `a is b` is True and a change through b shows in a.
10. **Can a list be a dictionary key?** No. A key must be of an immutable type such as a string, number or tuple, so a list raises a TypeError.
11. **What is the difference between `math.pow(3, 2)` and `3 ** 2`?** The function returns the float 9.0; the operator on two integers returns the integer 9.
12. **What do break and continue do?**`break` leaves the loop at once. `continue` skips the rest of this pass and goes to the next one.

Written versions of these ideas, set as an annual exam, are in the [Class 11 Computer Science sample paper](/cbse-class-11-computer-science-sample-paper).

Q7. How do you turn this into your own file?

## From this page to a practical file that is yours

Type it, change it, run it, then print it. A file you cannot explain costs marks twice, once in the viva and again in the lab test, where you write a program with nothing to copy from.

1. #### Type each program yourself

  Save it as a script with a plain name such as `p11_perfect.py`. Typing shows you the colons, brackets and indents your eye skips when reading.
2. #### Change the names and the data

  Use your own variable names and your own inputs, and write the comments in words you would say aloud. If a line cannot be explained, it should not be in the file.
3. #### Run it twice, once to break it

  Try a tie, a zero, an empty string, a repeated roll number. Keep the awkward run as your second output, because it shows the program was tested.
4. #### Add the documentation the lab test pays for

  An aim line at the top, names that say what they hold, and a comment wherever a reader would ask why. Those habits are worth 20% for documentation and 20% for code quality.
5. #### Make the PDF last

  Paste code and output into a document, put the index in front and export it. To keep this page as a reference PDF, use your browser’s Print command and choose Save as PDF.

In a live class the student shares the screen and writes the entry while the teacher asks the questions an examiner could ask. The 8-mark project is planned the same way, and a full example is on the [Class 11 Computer Science project](/cbse-class-11-computer-science-project) page. Still choosing between subjects? Read [CS or IP in Class 11](/computer-science-or-informatics-practices-class-11).

One to one, with a demo first

## Get the practical file done with a teacher beside you

You can try before enrolling. The priority demo is a paid full live class at a slot you pick, with a written skill report afterwards, and its fee is adjusted against the first month if you enrol. There is a free demo class too. Regular classes are personalised one to one, billed monthly, with no admission fee.

Before you enrol · Try a class

### Priority demo, at a slot you pick

a full live class of about 45 to 60 minutes

- Your child writes one file program from a blank screen, not from a copy
- The teacher marks it out of 12 the way the lab test is split
- Five viva questions on that program, answered aloud
- A written report on logic, comments and testing afterwards

[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

- Days and hour chosen by your family and moved around school tests
- The file built entry by entry as each Python topic is taught
- Time spent on the programs your child cannot yet explain
- Project planning and a full viva rehearsal before submission

Ask for a personalised plan

A student who codes comfortably may need only a few sessions to finish the file and rehearse the viva. One who began Python this year does better with weekly classes, so the file, theory and project move together. Your monthly fee is shown above in your own currency.

CBSE schools abroad

## Practical file classes for CBSE students outside India

A CBSE school in Dubai, Muscat or Kathmandu follows the same Class 11 curriculum, so the file needs the same 20 programs. Class times are fixed one to one after school hours where you live.

| 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 |

Class 11 submission dates are set by each school, in India and abroad, so tell us yours at the demo and the entries are planned backwards from it. Regular tuition is described on [CBSE Class 11 Computer Science classes](/computer-science-class-11-cbse).

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 11 series

## More for Class 11 Computer Science, IP and AI

Every page in the CBSE Class 11 Computer Science, IP and AI series, grouped by what you need.

### Computer Science 083

- [Class 11 CS project](/cbse-class-11-computer-science-project)
- [Class 11 CS notes](/cbse-class-11-computer-science-notes)
- [Class 11 CS sample paper](/cbse-class-11-computer-science-sample-paper)
- [Number system and Boolean logic Class 11](/cbse-class-11-number-system-conversion)

### Informatics Practices 065

- [Class 11 IP practical file](/cbse-class-11-informatics-practices-practical-file)
- [Class 11 IP notes](/cbse-class-11-informatics-practices-notes)
- [Class 11 IP sample paper](/cbse-class-11-informatics-practices-sample-paper)

### Artificial Intelligence 843

- [Class 11 AI 843 notes](/cbse-class-11-ai-843-notes)
- [Class 11 AI 843 syllabus and sample paper](/cbse-class-11-ai-843-syllabus-and-sample-paper)

### Choosing the subject

- [CS or IP in Class 11](/computer-science-or-informatics-practices-class-11)

**CBSE Class 12 Computer Science (083):** [Class 12 CS viva questions](/cbse-class-12-computer-science-viva-questions)  [Class 12 CS sample paper practice](/cbse-class-12-computer-science-sample-paper-2026-27)  [Class 12 CS project with source code](/cbse-class-12-computer-science-project-python-mysql)  [Class 12 CS important questions](/cbse-class-12-computer-science-important-questions)

**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)

**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:** [Python programs for Class 11](/blog/python-programs-for-class-11)  [Python project ideas](/blog/python-project-ideas-for-beginners)

Practical file questions

## What students ask about the Class 11 Computer Science practical file

### How many programs should be in the Class 11 Computer Science practical file?

A minimum of 20 Python programs, as stated in the CBSE Class XI Computer Science (083) curriculum for 2026-27. The file carries 7 marks. Two or three extra entries are a good idea, because one rejected program then does not take you below the minimum. This page has 25.

### Where can I get a Class 11 Computer Science practical file PDF?

Open this page, choose Print in your browser and select Save as PDF to keep all 25 programs with output. Use that copy for reference only. The file you submit should be typed and run by you, with your own inputs, since the viva and lab test check whether you understand it.

### Is SQL needed in the Class 11 CS practical file?

No. The 2026-27 curriculum for Class 11 Computer Science asks for Python programs only, and databases come in Class 12. Class 11 Informatics Practices is different: that file needs at least 14 Python programs and 14 SQL queries.

### Should the practical file be handwritten or printed?

The curriculum document does not say, so follow your school. Many students print code and output and write the aim by hand, but a teacher may want either. Whichever it is, the output should come from a program you actually ran.

### What is the format of a Class 11 computer science practical file?

Cover page, certificate, acknowledgement and index, followed by one entry per program. Each entry has a number, date, aim, commented code and output. CBSE fixes the number of programs and the marks, not the decoration, so use the layout your school gives if there is one.

### How is the Class 11 Computer Science practical marked?

Out of 30 in 2026-27: lab test 12, report file 7, project 8 and viva 3. The lab test is one Python program judged 60% on logic, 20% on documentation and 20% on code quality. Theory carries the other 70 marks.

### Do Class 11 practical programs need functions and file handling?

No. User-defined functions, exception handling and data files are not listed in the Class 11 Computer Science syllabus for 2026-27; they belong to Class 12. Use conditions, loops, strings, lists, tuples, dictionaries and the math, random and statistics modules.

### What viva questions are asked in Class 11 Computer Science?

There is no official list. Prepare to explain any line of your own file, trace a loop for a given input, and answer basics such as the difference between list and tuple, / and //, find() and index(), or == and is. This page has 24 questions with short answers.

### When is the Class 11 Computer Science practical exam in 2027?

Each school sets its own date, because the Class 11 annual examination is held by schools and not by the board. Ask your teacher for the file submission date and the practical date separately, as they are often different days.

### Can I copy programs from the internet into my practical file?

Reading solutions is fine; submitting them unread is the problem. Retype the idea with your own names and inputs, then close the page and write it again from memory. If you can do that, it is ready for the lab test as well as the file.

### Can someone help me complete my Class 11 practical file online?

Yes. In our live one to one classes the student writes and runs every program while the teacher explains and questions; we do not write the file for anyone. You can start with a priority demo at a slot you pick, or with the free demo class.

Start

## Start with one program from your file

Bring the program that will not work, or pick any number from the index above. In the demo class your child writes it live, tests it with two inputs and explains it aloud, and you hear afterwards what the file, the lab test and the viva still need.

If the submission date is close, book a priority demo: you choose the slot, a written skill report follows, and the fee is adjusted against the first month if you enrol.

[WhatsApp us](https://wa.me/919123366161?text=Hello%20Modern%20Age%20Coders.%20I%20need%20one%20to%20one%20help%20with%20the%20CBSE%20Class%2011%20Computer%20Science%20practical%20file.) · [+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

- [Class 10 AI Worksheets 2026-27 (417) with Answers](/cbse-class-10-ai-worksheets)
- [Class 10 AI Viva Questions 2026-27 (417) with Answers](/cbse-class-10-ai-viva-questions)
- [Class 10 AI Textbook Solutions 2026-27: Handbook Guide](/cbse-class-10-ai-textbook-solutions)
- [Class 12 Computer Science Case Study Questions 2027](/cbse-class-12-computer-science-case-study-questions)
- [CBSE Class 10 AI Syllabus 2026-27 (417) Explained, Unit by Unit](/cbse-class-10-ai-syllabus-explained)
- [Computer Networks Class 12 Notes: CS 083 Unit 2 for 2027](/cbse-class-12-computer-science-computer-networks)
- [Class 11 Computer Science Project in Python, with Topics](/cbse-class-11-computer-science-project)
- [CBSE AI Classes for Class 6-8: Where AI Literacy Actually Begins](/ai-classes-for-cbse-class-6-to-8)
- [Exception Handling Class 12 Computer Science: Notes, Q&A](/cbse-class-12-computer-science-exception-handling)

### Learn more

- [Informatics Practices (IP) Class 11-12: CBSE Python & SQL](/courses/cbse-informatics-practices-ip-class-11-12-python-pandas-sql-complete-course)
- [AI and Python Classes for Teens in Fredericton, NB](/ai-and-python-classes-for-teens-in-fredericton)
- [Data Science for Teens: Python & Your First ML Models](/courses/data-science-course-for-teens-python-data)
- [AI and Machine Learning for Teens: Python to Real Models](/courses/ai-ml-masterclass-teens)

### Free resources

- [Python Tutorial for Beginners: Complete Guide](/resources/python)
- [Exception Handling in Python](/resources/python/exception-handling)
- [Installing Python and Setting Up Your Environment](/resources/python/installing-python-and-setup)
- [Lists in Python](/resources/python/lists-in-python)

### From the blog

- [Python Tutorials & Guides](/blog/topic/python)
- [20 Python Programs for CBSE Class 12 Board Exam (083)](/blog/python-programs-for-cbse-class-12)
- [Python Code Examples: 35 Simple Programs With Output](/blog/python-basic-programs-for-beginners)
- [Star Pattern Programs in Python: 30 Patterns With Code](/blog/star-pattern-programs-in-python)

### Start here

- [Try a free trial class with a Modern Age Coders mentor](/free-trial)
- [About Modern Age Coders, teaching since 2020](/about)

---

*Canonical: https://learn.modernagecoders.com/cbse-class-11-computer-science-practical-file*
