Professional Documents
Culture Documents
Practical File: AISSCE 2022 Examination
Practical File: AISSCE 2022 Examination
PRACTICAL FILE
for
Submitted by:
Darsh Marothi
[Reg No. ___________]
Ms. Akhila B
PGT (CSc)
………………………………… …………………………………..
1
CERTIFICATE
……….…………………
Signature of Principal
………………………………… …………………………………..
2
INDEX
Write a program to implement all the basic operations of a stack.
1. (push, pop, peak, etc.) and show the outputs.
MYSQL
To create a table “student” with the following fields - S.No., Admin
1. No., Name of student, City, Maths Physics, Chemistry and display
the table. Then execute the following commands
Create a table Employee and use the “group by” clause, to find the
2. minimum, maximum, sum of salary and count and average for an
employee table and department table.
MYSQL CONNECTOR/PYTHON
3
Question:
Write a program to implement all the basic operations of a stack. (push, pop,
peak, etc.) and show the outputs.
Aim:
To Write a program to implement all the basic operations of a stack. (push, pop,
peak, etc.) and show the outputs.
Program:
def push(s,i):
s.append(i)
t=len(s)-1
print(s)
def pop(s):
x=s.pop()
if len(s)==0:
top=None
else:
top=len(s)-1
return x
s=[]
top=None
ch='y'
while True:
print("enter 1 to push,enter 2 to pop:")
u=input("enter choice:")
if u=='1':
n=int(input("enter item:"))
push(s,n)
elif u=='2':
y=pop(s)
print("item popped:",y)
else:
4
break
Ouput:
Result:
The above program has been executed and the required output has been
obtained.
5
Vowels In A Stack
Question: Write a program to display the vowels present in a given word using
stacks.
Aim: To write a program to display the vowels present in a given word using
stacks.
Program:
def push(s,i):
s.append(i)
s=[]
top=None
n=input("enter word:")
for i in range(len(n)):
if n[i]=='a' or n[i]=='A' or n[i]=='e' or n[i]=='E' or n[i]=='i' or n[i]=='I' or
n[i]=='o' or n[i]=='O' or n[i]=='u' or n[i]=='U':
push(s,n[i])
print("Vowels present in the word:",s)
Output:
Result:
The above program has been executed and the required output has been
obtained.
6
MySQL
Question:
To create a table “student” with the following fields - S.No., Admin No., Name
of student, City, Maths , Physics, Chemistry and display the table. Then execute
the following commands:
(i) Display records of students who have scored more than 90 in Maths.
Program:
Select * from student where Maths >90;
Output:
(ii) Display records of students whose names start with the letter 'A'.
Program:
Select * from student where Name Like ‘A%’;
Ouput:
7
(iii) Display the records of the students whose name's fourth letter is 'e'.
Program:
Select * from student where Name Like ‘___e%’;
Output:
Program:
Select * from student order by Name desc;
Output:
8
(v) Increase the marks by 2 in Physics for students who secured 80.
Program:
Update student set Physics=Physics+2 where Physics=80;
Output:
Program:
Select * from student where City =’Coimbatore’;
Output:
9
(iv) Change the size at 'Name of student' column from 30 to 40.
Program:
Alter table student modify Name varchar(40);
Output:
(v) Display the total Math marks of all students and also display the
average.
Program:
Select sum(Maths), avg(Maths) from student;
Output:
10
(vi) Display the record with maximum marks in Physics.
Program:
Select Max(Physics) from student;
Output:
Program:
Delete from student where Name=’Ajay’;
Output:
Program:
Show databases;
11
Output:
Program:
Show tables;
Output:
Program:
Use <databasename>;
Desc <tablename>;
12
Output:
Program:
Output:
13
Create and Display
Question: Create a table Employee and use the “group by” clause, to find the
minimum, maximum, sum of salary and count and average for an employee
table and department table.
Aim: To create a table Employee and use the “group by” clause, to find the
minimum, maximum, sum of salary and count and average for an employee
table and department table and display the output.
Output:
14
(ii) Maximum Salary:
Ouput:
Output:
15
(iv) Total Employees:
Output:
Output:
MYSQL CONNECTOR/PYTHON
16
1.Question: Write a program to connect with database and store record of
employee and display records.
Program:
Output:
Result:
The above program has been executed and the required output has been
obtained.
17
2.Question: Write a program to create student table which contains 5 students
details and display first three rows student table of MySQL database “test”.
Program:
import mysql.connector as sql
mycon=sql.connect(host='localhost',user='root',passwd='*',database='test')
if mycon.is_connected():
print("connected")
else:
print("error")
c=mycon.cursor()
s='select * from student'
c.execute(s)
data=c.fetchmany(3)
for row in data:
print(row)
Output:
Result:
The above program has been executed and the required output has been
obtained.
18
3.Question: Write a program to connect with database and search employee
number in table employee and display record, if employee number not found,
displaying appropriate message.
Aim: To write a program to connect with database and search employee number
in table employee and display record, if employee number not found, displaying
appropriate message.
Program:
import mysql.connector as sql
mycon=sql.connect(host='localhost',user='root',passwd='darsh0104',database='s
chl')
if mycon.is_connected():
print("connected")
else:
print("error")
Output:
Result:
The above program has been executed and the required output has been
obtained.
19
4. Question: Write a program to connect with database and update the
employee record related to the employee number entered by the user.
Aim: To write a program to connect with database and update the employee
record related to the employee number entered by the user.
Program:
import mysql.connector as sql
mycon=sql.connect(host='localhost',user='root',passwd='darsh0104',database='s
chl')
if mycon.is_connected():
print("connected")
else:
print("error")
Output:
20
Result:
The above program has been updated and the required output has been obtained.
Deleting Record
21
5.Question: Write a program to connect with database and delete the record of
the entered employee number.
Aim: To write a program to connect with database and delete the record of the
entered employee number.
Program:
import mysql.connector as sql
mycon=sql.connect(host='localhost',user='root',passwd='darsh0104',database='s
chl')
if mycon.is_connected():
print("connected")
else:
print("error")
Output:
22
Result:
The above program has been executed and the required output has been
obtained.
23