Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
44 views
10 pages
Sample Paper Together With
Together with sample paper
Uploaded by
Arush Verma
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Sample paper together with For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
44 views
10 pages
Sample Paper Together With
Together with sample paper
Uploaded by
Arush Verma
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Sample paper together with For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Sample paper together with For Later
You are on page 1
/ 10
Search
Fullscreen
ee, | Sample Practical Paper 1, WAP # menu program to implement the stack of ‘Ans. def push(1st): nseval(input(‘Enter no, *)) list using concepts of stacks. na=input(‘Enter name *) Ast.append([n,na]) def pop(Ist): if Ist=[]: print (‘UNDERFLOW') else: print('Enployee record’ ,1st.pop(), ‘deleted") def display(1st): if Ist= print( ‘UNDERFLOW') else: for i in range(1en(Ist)-1,-1,-1): print(1st[i]) def peek(1st): if Aste=[]: print ( ‘UNDERFLOW') else: print(1st[len(1st)-1]) consty’ Ast=[] while con: print(*' ‘Press 1 to add records in stack\nPress 2 to delete records in stack\ ecords in stack. Press 4 to return the top most element nPress 3 to display all 1 in stack’’') xeint(input(*Enter your choice ')) if xe-ds push(1st)100 ageeher waek® Computer Science (Python) —12 display (1st) elif x=*4: peek(1st) else: print("Enter a valid choice") consinput("Press y to continue or any other key to exit’) 2. The given program is used to add a new record in a table customer. CustNO, CustNane, City, Email, Amount You are required to complete the statements so that program can be executed properly. import pymysql def addrecord(): try: r=int(input("Enter Customer Number")) nasinput("Enter Customer Name") ct+input ("Enter City") em=input ("Enter email") at-float(input("Enter amount") #CustNO, CustName, City, Email, Amount query = “INSERT INTO customer(cno, cname, city, email, amount) VALUES (Oth. 0)".format(x, na, ct,em,at) cr. _(query) ‘Python method to send the SOL statement to the database db. () furite 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) Walling Statement _Main()__ ty: ymysql.connect (host="localhost",user=' Toot", password="smsmb") Q #Method to open the cursor object print("Connected Successfully !!!!") Dateer secre #SQL command to open the database Board execute (Data) rint("Database Opened! !!!!") cept Exception as e: rint("Database connection error",e) \ddrecord()we spython method to send the So. stat | Sample Practical Paper 101 execute (Quety ‘enent to the database a) wurite the TCL command to save the except Exception as e: atiane of the class to generate the error curedd. cursor () Method to open the cursor object pata="use board” SOL command to open the database Board 4, wAmenu driven program fo create the database with table m fields: custNO, CustName, City, Email, Arount data into the database ‘ame customer having following ‘The program should add a new record and dis, in Mumbai. inport ‘sConplete the statement with appropriate library nane def display(): try: cr=db. cursor() Tow-cr.execute("Select * from customer") x=cr.fetchall() print("Customer Number No\tCustmerName\t\t\tCity\t\t\témail\t\t\tAnount\n") for row in x: if =="Mumbai": #Statment to compare the record print (“{}\t\t{Ae\eve\e{Ae\e\e{e\e\e{}". (ii) form at (rou 0), rou{2), row [2] row[3], row[4])) ——___ase: fame of the class to generate the error Brint("Error in insertion *,e) ut Statement _Main() play all the records of the customer who lives except ob =pymysql.connect . (host="localhost", user=root", password: "smsnb") Curedb, Q) “Method to open the cursor object Print (“Connected Sucessfully !!!!") Data. 7 ee CECE Ee ; “SQL command to open the database “Boardi vl 12 102 Fagecher werh® Computer Science (Python)—' cr-execute (Data) print("Database Openned!!!!!") except Exception as e+ i print ("Database connection error",e) addrecord() pymysal rou[2] Exception (iv) cursor () Use Board 4. The given program is used to connect with MYSQL and show all the record from the tae “Emp” from the database "Test".You are required to complete the statements so tht i, code can be executed properly. inport #Complete the statement with appropriate library name db =pynysql. (host="1ocalhost" ,user="root” ,passuord="snsmb") ‘#Fill the statement with appropriate method cur=db. 0 ‘Method to open the cursor object data="test" print( ) *Method to extract all the record from the cursor object cur.execute(" *) *SOL statement to read all the records from the table secur. fetchall() Print ("All the record of the table") for i in s: print (i) Ans. (i) pymysql (ii) row{2) Gi) Exception (@) cursor (¥) Use BoardSample Practical Paper 103 5, The given program is used to connect with MYSQL and show the name of all the database available in MySQL Server. You are required to complete the statements so that the code can be executed properly. import (i) Complete the statement with appropriate library nane db =pynysql. — (4a) (host="localhost” users "root", password="snsmb") #Fi11 the statement with appropriate method curedb.____() (iid) #Hethod to open the cursor object cur.execute(* ) (av) # Command to display all the database nane print (cur. ) Ww Method to extract all the required from the cursor Ans. (i) pymysql (ii) connect (iii) cursor (iv) show databases (v) fetchall() 6. WAP a menu program to implement the stack of list using concepts of stacks. Ans. def push(Emp): eno-int (input("Enter the Empolyee Number") ename=input ("Enter the Employee Name”) sal-float (input ("Enter the Salary*)) Emp. append([eno, enane, sal]) def pop(Emp): if Emp==[]: print("Under Flow") else: print("Employee Record Deleted”, £mp.pop()) def display(Emp): print(“Underflow! !!") else: print("Employee record in Stack\n")104 agether week® Computer Science (Python)—12 Ls1en(Emp) for i in range(1-1,-1.-1): print(Emp[(i]) Emp=[] while True: print ("\ni. Pushi\n2, Pop \n3. Display\nd. Exit") ch=int(input ("Enter your choice")) if chestr push (Emp) elif ch==2: pop (Emp) elif ch display (Emp) else: break Output: 1. Push 2. Pop 3. Display 4. Exit Enter your choicel Enter the Empolyee Nunber1 Enter the Employee NameDeyansh Enter the Salary3000000 1. Push 2. Pop 3. Display 4 Exit Enter your choicet Enter the Empolyee Nunber2 Enter the Employee NaneTigesh Enter the Salary4o0000 1. Push 2. Pop 3. Display4 exit enter your choicel enter the Enpolyee Nunber3 enter the Employee Naneshivaye enter the Salary2300000 w Push 2. Pop 3. Display a. Exit enter your choice? Employee record in Stack [3, ‘Shivaye’, 2300000.0] [2, ‘Tigesh’, 4000.0] [1, ‘Deyansh', 3000000.0] 1. Push 2. Pop 3. Display 4 Exit Enter your choice2 Employee Record Deleted [3, ‘Shivaye’, 2300000.0] 1. Push 2. Pop 3. Display 4. Exit Enter your choice3 Employee record in Stack la, ‘Tigesh', 400000.0) 1, ‘Deyansh', 3000000.0] Lush 2 Pop 3, Display 4 exit & nt "8 your choices Sample Practical Paper 105puter Science (Python) —12 106 Tagether eocth® COM gram to create the database with table name customer h 7. WA menu driven pros fields: CustNO, CustName, City, Email, Amount m should add a new record and display all the records. The prograample Practical Paper 107 Howecrenerute(selert © fram customer") veer ferehal lO) PHIAEC Customer Huber no Castner fame OE ry Ot temai L\E\e\témount\n") print CHSESEESE EXEL ESE MENE EF format (rou[O), row[ 1}, cowl 2], rowl 3}, row{4])) except Feception ase ty db = py passuils print ("Conn Data credb. cur Cr execute (Da print ("Data except bee print(* Chior", e) loc «(host host ly localhost 1H your host, u your usernan wb") 8 your mysql password sfully HEE) USE board” 0 a) 6 Openned! 1111") © connection error",e) Main Program while Try print ("Mer + Add \n2. Display") cheint (input (“Enter Choice*)) if elifeh dis cavinpur( if cnes'Nt break © to continue” hed addrecord() 2 splay() els print("Enter valid choices") or cnee'n's ‘The given program is used to connect with MYSQL and show the name of all the tables vailable in MySQL. Server "TEST" database. You are required to complete the statements that the code can be executed properly.108 Fapceher ewith® Computer Science (Python) —12 (i) #Conplete the statement with appropriate library nane import db =pymysql.. (ii) (host="Localhost", use WFill the statement with appropriate method “root” password: "smsmb") () (di) Method to open the cursor object curedb. data="test" cur. execute (" “edata) (iv) #Command to open the database cur.execute(" ee) ¥), #Conmand to display name of all the tables print (cur.fetchall()) Ans. (i) pymysql (ii) connect (iif) cursor (iv) use (%) show tables
You might also like
Aissce 2024 Xii
PDF
No ratings yet
Aissce 2024 Xii
2 pages
Practical File-Sql Query
PDF
No ratings yet
Practical File-Sql Query
9 pages
LabManual (14 17)
PDF
No ratings yet
LabManual (14 17)
10 pages
ASdfkkdkdoeoosmns PDF
PDF
No ratings yet
ASdfkkdkdoeoosmns PDF
10 pages
Practice Questions For Practical
PDF
100% (1)
Practice Questions For Practical
11 pages
PROGRAMMS 11 Split Merge
PDF
No ratings yet
PROGRAMMS 11 Split Merge
20 pages
2 Interface Python With Mysql - Programs
PDF
No ratings yet
2 Interface Python With Mysql - Programs
2 pages
SQL Connecting
PDF
No ratings yet
SQL Connecting
8 pages
SQL Connectivity Nizam
PDF
No ratings yet
SQL Connectivity Nizam
15 pages
Cs Pracfile12
PDF
No ratings yet
Cs Pracfile12
14 pages
Exp10 Python
PDF
No ratings yet
Exp10 Python
10 pages
Python Databaseconnectivity
PDF
No ratings yet
Python Databaseconnectivity
5 pages
0996 HKK
PDF
No ratings yet
0996 HKK
18 pages
Interface 2
PDF
No ratings yet
Interface 2
18 pages
70 Python Experiment No. 14 Nakhwa Arman Anis
PDF
No ratings yet
70 Python Experiment No. 14 Nakhwa Arman Anis
13 pages
Computer Science Project Work Class 12
PDF
No ratings yet
Computer Science Project Work Class 12
17 pages
Student Registration System
PDF
No ratings yet
Student Registration System
19 pages
Project SQL
PDF
No ratings yet
Project SQL
27 pages
Interface Python With MySQL
PDF
100% (1)
Interface Python With MySQL
40 pages
MySQL Connectivity ShortNotes
PDF
No ratings yet
MySQL Connectivity ShortNotes
7 pages
MySQL Interface Python
PDF
No ratings yet
MySQL Interface Python
8 pages
Python Mysql Database
PDF
No ratings yet
Python Mysql Database
15 pages
12TH CS TERM 2 - Python
PDF
No ratings yet
12TH CS TERM 2 - Python
8 pages
Alumni Management
PDF
No ratings yet
Alumni Management
31 pages
6 Ju 6 RJ
PDF
No ratings yet
6 Ju 6 RJ
27 pages
Cs Program 16 To 20
PDF
No ratings yet
Cs Program 16 To 20
5 pages
Payroll Management System Project
PDF
100% (1)
Payroll Management System Project
16 pages
Practical Programs
PDF
No ratings yet
Practical Programs
6 pages
Structure of Mangement
PDF
No ratings yet
Structure of Mangement
14 pages
Python Connecting To Mysql Database
PDF
No ratings yet
Python Connecting To Mysql Database
6 pages
Cs Journal Dhruval
PDF
No ratings yet
Cs Journal Dhruval
53 pages
J.B. Memorial Manas Academy Pithoragarh: Practical File OF Computer Science
PDF
No ratings yet
J.B. Memorial Manas Academy Pithoragarh: Practical File OF Computer Science
21 pages
SQL Python Prject-2024 FINAL4
PDF
No ratings yet
SQL Python Prject-2024 FINAL4
26 pages
Interface Python With MySQL - 1
PDF
No ratings yet
Interface Python With MySQL - 1
28 pages
Connecting Python With SQL Database
PDF
No ratings yet
Connecting Python With SQL Database
21 pages
CSC Lab 2023-2024
PDF
No ratings yet
CSC Lab 2023-2024
21 pages
Assignment - 6
PDF
No ratings yet
Assignment - 6
9 pages
SOLUTIONS
PDF
No ratings yet
SOLUTIONS
4 pages
12 Practical
PDF
No ratings yet
12 Practical
4 pages
Modify
PDF
No ratings yet
Modify
24 pages
Computer Science Project
PDF
No ratings yet
Computer Science Project
34 pages
ML SQL Programs
PDF
No ratings yet
ML SQL Programs
9 pages
Interface Python With Mysql Notes
PDF
No ratings yet
Interface Python With Mysql Notes
2 pages
Com Record
PDF
No ratings yet
Com Record
20 pages
CS Project
PDF
No ratings yet
CS Project
15 pages
Python MYSQL
PDF
No ratings yet
Python MYSQL
29 pages
L9 Python and MySQL DB Connection
PDF
No ratings yet
L9 Python and MySQL DB Connection
6 pages
CS Practical File 2022-23
PDF
No ratings yet
CS Practical File 2022-23
24 pages
Comp Progs
PDF
No ratings yet
Comp Progs
9 pages
CS Board Practical Exam Sample Papers
PDF
No ratings yet
CS Board Practical Exam Sample Papers
6 pages
Python + MySql Connectivity
PDF
No ratings yet
Python + MySql Connectivity
4 pages
ANIRUTH SRINIVASAN Board Praticals CS
PDF
No ratings yet
ANIRUTH SRINIVASAN Board Praticals CS
9 pages
Vansh Kumar
PDF
No ratings yet
Vansh Kumar
39 pages
Project No 1 - 2
PDF
No ratings yet
Project No 1 - 2
23 pages
Student Registration System
PDF
No ratings yet
Student Registration System
19 pages
DB Connectivity
PDF
No ratings yet
DB Connectivity
67 pages
Asdasd
PDF
No ratings yet
Asdasd
14 pages
12cs-Model Practical To Print
PDF
No ratings yet
12cs-Model Practical To Print
6 pages
CS Phyton-SQL Connectivity
PDF
No ratings yet
CS Phyton-SQL Connectivity
10 pages
Ncert Class 12 Chapter 1 Part 5
PDF
No ratings yet
Ncert Class 12 Chapter 1 Part 5
5 pages
Ncert Class 12 Chapter 1
PDF
No ratings yet
Ncert Class 12 Chapter 1
5 pages
Ncert Class 12 Chapter 1
PDF
100% (1)
Ncert Class 12 Chapter 1
5 pages
Pradeep Chemistry Class 12 Volume 1
PDF
No ratings yet
Pradeep Chemistry Class 12 Volume 1
9 pages
Pradeep Chemistry Class 12 Volume 1
PDF
No ratings yet
Pradeep Chemistry Class 12 Volume 1
6 pages
Together With Class 12
PDF
No ratings yet
Together With Class 12
8 pages
Pradeep Chemistry Class 12 Volume 1
PDF
No ratings yet
Pradeep Chemistry Class 12 Volume 1
6 pages