CBSE 2026 results are out, Mukul scored a perfect 100/100 in Computer ScienceSee all toppers →
CBSE Class 11 · Computer Science · Practical

CBSE Class 11 Computer Science Practical File, Python Programs with Output

The CBSE Class 11 Computer Science (083) practical carries 30 marks, and the report file needs programs covering Python fundamentals, strings, lists, dictionaries and files. Every program below was run before it was published and the output you see is the output it actually produced.

1. Check whether a number is prime

Program
num = 29
if num < 2:
    print(num, "is not prime")
else:
    for i in range(2, int(num ** 0.5) + 1):
        if num % i == 0:
            print(num, "is not prime")
            break
    else:
        print(num, "is prime")
Output
29 is prime

2. Sum of the digits of a number

Program
num = 4829
total = 0
n = num
while n > 0:
    total += n % 10
    n //= 10
print("Number:", num)
print("Sum of digits:", total)
Output
Number: 4829
Sum of digits: 23

3. Print the Fibonacci series up to n terms

Program
n = 10
a, b = 0, 1
series = []
for _ in range(n):
    series.append(a)
    a, b = b, a + b
print("First", n, "Fibonacci numbers:")
print(series)
Output
First 10 Fibonacci numbers:
[0, 1, 1, 2, 3, 5, 8, 13, 21, 34]

4. Count vowels, consonants, digits and spaces in a string

Program
text = "Kwickprep Class 11 Computer Science"
vowels = consonants = digits = spaces = 0
for ch in text:
    if ch.isalpha():
        if ch.lower() in "aeiou":
            vowels += 1
        else:
            consonants += 1
    elif ch.isdigit():
        digits += 1
    elif ch == " ":
        spaces += 1
print("String :", text)
print("Vowels :", vowels)
print("Consonants:", consonants)
print("Digits :", digits)
print("Spaces :", spaces)
Output
String : Kwickprep Class 11 Computer Science
Vowels : 9
Consonants: 20
Digits : 2
Spaces : 4

5. Find the largest and smallest element in a list

Program
marks = [67, 92, 45, 88, 73, 51]
largest = smallest = marks[0]
for m in marks:
    if m > largest:
        largest = m
    if m < smallest:
        smallest = m
print("List    :", marks)
print("Largest :", largest)
print("Smallest:", smallest)
Output
List    : [67, 92, 45, 88, 73, 51]
Largest : 92
Smallest: 45

6. Linear search in a list

Program
roll = [11, 24, 37, 42, 58, 63]
target = 42
found = -1
for i in range(len(roll)):
    if roll[i] == target:
        found = i
        break
if found == -1:
    print(target, "not found")
else:
    print(target, "found at index", found)
Output
42 found at index 3

7. Count the frequency of each word in a sentence

Program
sentence = "the exam is the same the syllabus is not"
freq = {}
for word in sentence.split():
    freq[word] = freq.get(word, 0) + 1
for word in sorted(freq):
    print(word, ":", freq[word])
Output
exam : 1
is : 2
not : 1
same : 1
syllabus : 1
the : 3

8. Write to a text file and read it back

Program
with open("notes.txt", "w") as f:
    f.write("Computer Science 083\n")
    f.write("Informatics Practices 065\n")
with open("notes.txt", "r") as f:
    for line in f:
        print(line.strip())
Output
Computer Science 083
Informatics Practices 065

9. Count the lines and words in a text file

Program
with open("essay.txt", "w") as f:
    f.write("A stack is a LIFO structure.\n")
    f.write("A queue is a FIFO structure.\n")
    f.write("Both are linear data structures.\n")
lines = words = 0
with open("essay.txt") as f:
    for line in f:
        lines += 1
        words += len(line.split())
print("Lines:", lines)
print("Words:", words)
Output
Lines: 3
Words: 17

10. Sort a list using bubble sort

Program
data = [45, 12, 78, 33, 9, 61]
n = len(data)
for i in range(n - 1):
    for j in range(n - 1 - i):
        if data[j] > data[j + 1]:
            data[j], data[j + 1] = data[j + 1], data[j]
print("Sorted list:", data)
Output
Sorted list: [9, 12, 33, 45, 61, 78]

11. Build a dictionary of student marks and find the topper

Program
marks = {"Aarav": 78, "Diya": 91, "Ishaan": 84, "Meera": 91}
top = max(marks.values())
toppers = [name for name in marks if marks[name] == top]
print("Marks  :", marks)
print("Highest:", top)
print("Topper :", ", ".join(sorted(toppers)))
Output
Marks  : {'Aarav': 78, 'Diya': 91, 'Ishaan': 84, 'Meera': 91}
Highest: 91
Topper : Diya, Meera

12. Check whether a string is a palindrome

Program
for word in ["level", "python", "madam"]:
    clean = word.lower()
    print(word, "->", "Palindrome" if clean == clean[::-1] else "Not a palindrome")
Output
level -> Palindrome
python -> Not a palindrome
madam -> Palindrome

Get the full practical-file pack, free

Every program, the exact practical-file format your school expects, and the viva questions that come up most — sent on WhatsApp.

Get it on WhatsApp Book a free demo class

Related: Class 11 CS syllabus · Try the code in the Python Playground · Class 12 CS practical file

Stuck on your practical file or the viva?

Kajal Ma'am has been teaching these practicals since 2004. See a real class first — no payment, no commitment.

Book a free demo class

Every program on this page was executed and its output captured from the run. Curated by Kajal Ma'am (MCA), teaching computer subjects since 2004.

Frequently asked questions

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

CBSE expects the Class 11 report file to carry a set of Python programs covering the prescribed practical list — conditionals, loops, strings, lists, dictionaries and text files. Most schools ask for 12 to 15. The practical is 30 marks in total.

Are these the programs my school will accept?

They are standard programs from the CBSE Class 11 (083) practical list, so the topics match. Schools vary in how they want the file written up, so follow your teacher's format for the header, aim and result sections.

Is the output real?

Yes. Every program here was executed and its output captured from the run. Nothing on this page is typed out by hand or guessed.

{ }

Frequently asked questions

How many programs are needed in the CBSE Class 12 CS practical file?+
As per CBSE, the report file should contain a minimum of 15 Python programs and 5 sets of SQL queries. The practical is 30 marks (lab test 12, report file 7, project 8, viva 3).
Are these programs part of the CBSE syllabus?+
Yes, these are standard CBSE Class 12 Computer Science (083) practical concepts: stacks, file handling, recursion, searching, dictionaries and Python-MySQL connectivity. Every program here has been run and its output verified.
Can I get the full practical file and viva questions?+
Yes, request the full pack (15+ programs, the CBSE practical-file format and likely viva questions) on WhatsApp, free. Kajal Ma'am's team can also guide you through your own file.

Want to ace your boards?

See a real class before you decide. No pressure, no payment.

Book Free Demo on WhatsApp

Studying outside India?

We coach CBSE, IGCSE & international students across the globe, one-to-one, in your local time zone.

Visit International →