0% found this document useful (0 votes)
13 views2 pages

Aissce 2024 Xii

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

AISSCE 2024 XII-COMPUTER SCIENCE (083)- CBSE PRACTICAL EXAMINATION

SET A

1.Write a program to implement the stack of list using of concepts of Stacks. (8)

2.The given program is used to add a new record in a table customer, Custno,Custname,
City, Email, Amount. You are required to complete the statements so that program can be
executed properly. (4)
import pymysql
def addrecord():
try:
r=int(input(“enter customer number”))
na= input(“enter customer name”)
ct=input(“enter city”)
em=input(“enter mail”)
at=float(input(“enter amount”))
query=”insert into customer(cno,cname,city,email,amount)
values({},’{}’,’{}’,’{}’,{})”.format(r,na,ct,em,at)
cr._____________(query) #python method to send the SQL statement to the database
db.____________() # write the TCL command to save the data into the database
print(“row inserted”)
except_______ as e: # name of the class to generate the error
print(“error in insertion”,e)
try:
db=pymysql.connect(host=”localhost”,user=”root”,password=”smsmb”)
cur=db.______ () # method to open the cursor object
print(“connected successfully”)
Data=”___________” # SQL command to open the database board
cr.execute(Data)
print(“database opened”)
execute Exception as e:
print(“ Database connection error”,e)
addrecord()
AISSCE 2024 XII-COMPUTER SCIENCE (083)- CBSE PRACTICAL EXAMINATION
SET B

1. Make a menu driven program to show the following operations: (8)


(a) ADD # To add a record in a binary file “Test.dat”
(b) Average Marks
(c) Display All
Note:
i. The Binary follows the structure [Testid , subject, maxmarks, scoredmarks] to keep the
records.
ii. The average marks option calculates & display the average of the scoredmarks on the
basis of a particular subject.

2. The given program is used to connect with MYSQL and show the name of all the tables
available in MYSQL Server “Test” database. You are required to complete the statements so
that the code can be executed properly. (4)

import _______________ # complete the statement with appropriate library name


db=pymysql.______________ (host=”localhost”,user=”root”,password=”smsmb”)
cur=db.___________ # method to open the cursor object
data=”test”
cur.execute(“______________”+data) # command to open the database
cur.execute(“________________”) # command to display name of all the tables.
print(cur.fetchall())

You might also like