class 12 computer science practical paper with solution 2023


class 12 computer science practical paper with solution 2023

AISSCE Practical Examination 2021


Time : 3 Hours                                                                                      M.M.  30


Q1.                                                                                                                                                                                                                  8

(i) Write a user defined function countvowels() in Python to count and display the number of vowels in a text file “data.txt”.
(ii) A binary file “employee.dat” has structure [Empid,  EName, Designation ].
a) Write a user defined function Create() to input data for a record and add it to employee.dat .
b) Write a user defined function Display() in Python to display those records from “employee.dat” where Empid is more than 101.

Q2.                                                                                                                                                                                                               4

The code given below inserts the following record in the table  Student:

RollNo – integer
Name – string
Clas – integer
Marks – integer
Note the following to establish connectivity between Python and MYSQL:

  • Username is root
  • Password is root
  • The table exists in a MYSQL database named school.
  • The details (RollNo, Name, Clas and Marks) are to be accepted from the

Write the following missing statements to complete the code:   2+3

Statement 1 – to form the cursor object
Statement 2 – to execute the command that inserts the record in the table Student.
Statement 3- to add the record permanently in the database
Statement 4- to close the database connection.

import mysql.connector as mysql
def sql_data():
con1=mysql.connect(host=”localhost”,user=”root”, password=”root”, database=”school”)
mycursor=                              #Statement 1   
RollNo=int(input(“Enter Roll Number :: “))
Name=input(“Enter name :: “)
Cas=int(input(“Enter class :: “))
Marks=int(input(“Enter Marks :: “))
querry=”insert into student values({},'{}’,{},{})”.format(rno,name,clas,marks)
____________________________  #Statement 2
_____________________________ # Statement 3
print(“Data Added successfully”)

____________________________  #Statement 4


Q3.Practical File                                                                       7

Q4.Project File                                                                          8

Q5.Viva-Voce                                                                             3





def countvowels():
    for d in data:
           if d in [‘a’,’e’,’i’,’o’,’u’]:

   print(‘Number of vowels=’,count)


(a) import pickle

 def Create():
    Empid=int(input(“Enter Empid: “))
    EName=input(“Enter Name of employee:”)
    Designation = input(“Enter Designation: “)
    record=[Empid, EName,Designation]
    pickle.dump(record, f)


def Display():
        while True:
             if record[0]>101:


#Statement 1 – con1.cursor()
#Statement 2 – mycursor.execute(querry)
#Statement 3 – con1.commit()
#Statement 4 – con1.close()

Class xii computer science Practical paper – 2

Class xii computer science project file

Class 12 Computer Science Practical File

Click here for Quiz on Python Basics

Popular Books of Computer Science

Spread the love
Lesson tags: class 12 computer science practical paper, class 12 computer science practical paper with solution 2023, computer science practical paper class 12
Back to: CBSE class 12 Computer Science notes
Spread the love