Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

SET-1

Q1: Write a Menu Driven Python Program to create a Binary File CLASSXII.DAT to enter records of students of your
class. Display all the records of the file . Also search & display the details of students having Science stream. Students
details should contain Admission No, Name, Phone number & stream. 8

Menu should be

1. Create
2. Search
3. Display
4. Exit

Q2: Complete the Python Stub program: 4


Statement 1 that will Create the Table Per_inf with roll_no,name,class in school1 database
Statement 2 Write the query for inserting a student detail .
Statement 3 Write a query to display the details of student with name nm entered by the user.
Statement 4 Add a new attribute named contactno in the table Per_inf.

import mysql.connector as m
mydb = m.connect(user="root",passwd="root",host="localhost")
mycur=mydb.cursor()
mycur.execute("create database school1")
mycur.execute("________ statement 1”)
mycur.execute("________statement 2")
nm=input("Enter the name")
mycur.execute("________statement 3 ")
myrec=mycur.fetchall()
print(myrec)
mycur.execute("__________Statement 4")
mycur.execute("Desc per_inf")
for i in mycur:
print(i)

SET-2
Q1: Write a Menu Driven Python Program to perform all operation on STACK of employees of DAV Ashok Vihar. Each
element of stack should contain Employee name & his salary. 7

Menu should be

1. Push
2. Pop
3. Display
4. Exit

Q2: Complete the Python Stub program: 4


Statement 1 that will Create the Table Stu_mark with adm_no,name,class,marks in school1 database
Statement 2 Write the query for inserting a student detail .
Statement 3 Write a query to display the details of students with marks>=50
Statement 4 Add a new attribute named contactno in the table Stu_mark
import mysql.connector as m
mydb = m.connect(user="root",passwd="root",host="localhost")
mycur=mydb.cursor()
mycur.execute("create database school1")
mycur.execute("________ statement 1”)
mycur.execute("________statement 2")
nm=input("Enter the name")
mycur.execute("________statement 3 ")
myrec=mycur.fetchall()
print(myrec)
mycur.execute("__________Statement 4")
mycur.execute("Desc per_inf")
for i in mycur:
print(i)
Set – 3
Q1: Write a Menu Driven Python Program to create a CSV file of employee records MYFILE.CSV. File should contain
employee code (Ecode), name (Ename) & salary(Esal). Also print the details of the employee having Ecode 105. Menu
should be 7

1. Create
2. Search
3. Display
4. Exit

Q2: Complete the Python Stub program: 4


Statement 1 that will Create the Table Stu_mark with adm_no,name,class,marks in school1 database
Statement 2 Write the query for inserting a student detail .
Statement 3 Write a query to display the details of students with marks>=50
Statement 4 Add a new attribute named contactno in the table Stu_mark

import mysql.connector as m
mydb = m.connect(user="root",passwd="root",host="localhost")
mycur=mydb.cursor()
mycur.execute("create database school1")
mycur.execute("________ statement 1”)
mycur.execute("________statement 2")
nm=input("Enter the name")
mycur.execute("________statement 3 ")
myrec=mycur.fetchall()
print(myrec)
mycur.execute("__________Statement 4")
mycur.execute("Desc per_inf")
for i in mycur:
print(i)
SET-4
Q1: Write a Menu Driven Python Program to perform different operations on STACK. Stack should contain details of
Books like Book No., Book name, Author name & No. of copies. 7

Menu should be

1. Push
2. Pop
3. Display
4. Exit

Q2: Complete the Python Stub program: 4


Statement 1 that will Create the Table Per_inf with roll_no,name,class in school1 database
Statement 2 Write the query for inserting a student detail .
Statement 3 Write a query to display the details of student with name nm entered by the user.
Statement 4 Add a new attribute named contactno in the table Per_inf.
import mysql.connector as m
mydb = m.connect(user="root",passwd="root",host="localhost")
mycur=mydb.cursor()
mycur.execute("create database school1")
mycur.execute("________ statement 1”)
mycur.execute("________statement 2")
nm=input("Enter the name")
mycur.execute("________statement 3 ")
myrec=mycur.fetchall()
print(myrec)
mycur.execute("__________Statement 4")
mycur.execute("Desc per_inf")
for i in mycur:
print(i)
SET-5
Q1: Write a Menu driven Python program to count the No. of vowels,
consonants, Digits, Uppercase alphabets, Lowercase alphabets, Special
characters like (, .) in a text file “Help.txt”. 7
Menu should be
1. Give the content
2. Count total vowels
3. Count total consonants
4. Count total Digits
5. Count total special characters
6. Total Lowercase alphabets
7. Total Uppercase alphabets
8. Display the content
9. Exit
Q2: Complete the Python Stub program: 4
Statement 1 that will Create the Table Per_inf with roll_no,name,class in school1 database
Statement 2 Write the query for inserting a student detail .
Statement 3 Write a query to display the details of student with name nm entered by the user.
Statement 4 Add a new attribute named contactno in the table Per_inf.

import mysql.connector as m
mydb = m.connect(user="root",passwd="root",host="localhost")
mycur=mydb.cursor()
mycur.execute("create database school1")
mycur.execute("________ statement 1”)
mycur.execute("________statement 2")
nm=input("Enter the name")
mycur.execute("________statement 3 ")
myrec=mycur.fetchall()
print(myrec)
mycur.execute("__________Statement 4")
mycur.execute("Desc per_inf")
for i in mycur:
print(i)

You might also like