Aissce 2024 Xii
Aissce 2024 Xii
Aissce 2024 Xii
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
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)