class 12 computer science practical paper with solution

Preview

class 12 computer science practical paper with solution

AISSCE Practical Examination 2021

COMPUTER SCIENCE (083)

Time : 3 Hours                                                                                      M.M.  30

 

Q1.  A binary file “student.dat” has structure [Rollno,  Name, Class ].                                    7
a) Write a user defined function Create() to input data for a record and add to Student.dat .
b) Write a function Display() in Python to display all records contained in  “Student.dat    

Q2. Write a program in python to display all the records of table “Teacher” already created in MySQL database named teachers.                                                                                                                             5

Q3.Practical File                                                                                                                                               7

Q4.Project File                                                                                                                                                  8

Q5.Viva-Voce                                                                                                                                                    3

 

Solution:

 Q1 (a)

import pickle

 def create():
    f=open(“student.dat”,”ab”)
    Rollno=int(input(“Enter Roll no: “))
    Name=input(“Enter Name of student :”)
    Class = input(“Enter class: “)
    record=[Rollno, Name, Class]
    pickle.dump(record, f)
    f.close()

 (b)

def display():
    f=open(“student.dat”,”rb”)
    try:
        while True:
            record=pickle.load(f)
            print(record)
    except:
        f.close()
 

 Q2.

import mysql.connector
mydb = mysql.connector.connect(host=”localhost”,   user=”root”,passwd=”root”, database=”teachers”)
mycursor = mydb.cursor()
mycursor.execute(“Select * from teacher;”)
for i in mycursor:   
      print(i)


Download Documentation of Project 

Download Project Code [Copy code to python file]

Class 12 Computer Science Practical File




Lesson tags: class 12 computer science practical paper, computer science practical paper class 12
Back to: CBSE class 12 Computer Science notes