0% found this document useful (0 votes)
24 views

Final Practical File (1)

Uploaded by

Dhyaan Kanoja
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Final Practical File (1)

Uploaded by

Dhyaan Kanoja
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

CENTRAL BOARD OF SECONDARY EDUCATION

Sapphire International School

SS - 1, Sector 70 Pk Rd, Sector 70, Noida, Basi Bahuddin


Nagar, Uttar Pradesh 201301

A PRACTICAL RECORD FILE IS SUBMITTED TO DEPARTMENT OF COMPUTER


SCIENCE FOR THE PARTIAL FULFILLMENT OF AISSCE EXAMINATION FOR THE
ACADEMIC SESSION : 2024-25

Submitted by : Dhyaan Kanoja

Teacher Name : Mr. Ravi Khera

Class : XII
ACKNOWLEDGEMENT
I wish to express my deep sense of gratitude and
indebtedness to our learned teacher Mr. Ravi Khera, PGT
COMPUTER SCIENCE, Sapphire International School,Noida for his
invaluable help, advice and guidance in the preparation of this practical
file.
I am also greatly indebted to our director principal Mrs.
Saurabh Sehgal and school authorities for providing me with the
facilities and requisite laboratory conditions for making this practical
file.
I also extend my thanks to a number of teachers, my
classmates and friends who helped me to complete this practical file
successfully

Dhyaan Kanoja
CERTIFICATE
This is to certify that Dhyaan Kanoja , student of Class XII, Sapphire

International School ,Noida has completed the PRACTICAL FILE during

the academic year 2024-25 towards partial fulfillment of credit for the

Computer Science practical evaluation of CBSE AISSCE- 2025 and

submitted satisfactory report, as compiled in the following pages, under

my supervision.

Total number of practical certified are : 24

Internal Examiner External Examiner

Date : School Seal Principal


Contents
SNo. Practical Date Signature
1 Working with functions
1 Write a python program using a function to print factorial 20-04-24

number series from n to m numbers.


2 Write a python Program to find the maximum of three numbers 24-04-24
using recursion.
3 Write a python program to demonstrate the concept of variable 26-04-24
length argument to calculate the product and power
of the first 10 numbers.
2 Data File handling
4 Create a text file "text.txt" in python and ask the user to 21-06-24

write a single line of text by user input.


5 Write a program to capitalize the first letter of a sentence form 24-06-24
data.txt file to file1.txt.
6 Write a program to replace all spaces from text with - (dash) 26-06-24

from the file text.txt.


7 Write a program to know the cursor position and print the text 28-06-24
according to the below-given specifications:
● Print the initial position
● Move the cursor to 4th position
● Display next 5 characters
● Move the cursor to the next 10 characters
● Print the current cursor position
● Print next 10 characters from the current cursor position
SNo. Practical Date Signature
8 Create a binary file client.dat to hold records like ClientID, 12-07-24
Client name, and Address using the dictionary. Write functions
to write data, read them, and print on the screen.

9 Write a program to inserting/appending a record in a binary 12-07-24


file-student.

10 Write a program to write data into binary file marks.dat and 16-07-24
display the records of students who scored more than 95
marks.
11 Read a CSV file batsman.csv and print the contents in a proper 26-07-24
format. The data for top5.csv file are as following:

12 Read a CSV file batsman.csv and print them with tab delimiter. 29-07-24
Ignore first row header to print in tabular form.
13 31-07-24
Write a program to count number of records from the CSV file.

3 Data Structure – Stack


14 Write a menu-driven python program to implement stack 22-08-24
operation.
15 Write a program to implement a stack for the employee 28-08-24

details (empno, name).


4 Database management (MySQL Queries)
16 Queries Set 1 (Fetching records) 06-09-24
17 Queries Set 2 (Based on Aggregate Functions) 07-09-24
18 Queries Set 3 (DDL Commands) 27-09-24
19 Queries set 4 (Based on Two Tables) 28-09-24

20 Queries Set 5 (Group by , Order By) 07-10-24


5 Python-MySQL Connectivity
21 Write a MySQL connectivity program in Python to 25-11-24
● Create a database school
● Create a table students with the specifications -
ROLLNO integer, STNAME character(10) in
MySQL and perform the following operations:
o Insert two records in it

o Display the contents of the table


22 Perform all the operations with reference to table ‘students’ 27-11-24
through MySQL-Python connectivity.

23 SS public school is managing student data in “student” table in 28-11-24


“School” database. Write a python code that connects to
database school and retrieves all records and displays total
number of
students.
24 Divine Hotel needs to store ,retrieve and delete the records of its 29-11-24
clients. Devlop an interface that provides front-end interaction
through python and stores and updates record using MySQL.
The table clients can be used to perform different operations.
Answer the following questions.
a. Write a program to read and display all the records
from the clients table having bill amount more than Rs.
10000.
b. Write a program to update the records of the clients by
reducing the bill amount Rs. 1000 of all those clients who are
having bill > 150000.
Part 1 working with functions
1. Write a python program using a function to print factorial number series from n to m
numbers

Output:
2. Write a python Program to find the maximum of three numbers using recursion.

Output :
3. Write a python program to demonstrate the concept of variable length argument to
calculate product and power of the first 10 numbers.

Output :
Part 2 Data file handling
4. Create a text file "text.txt" in python and ask the user to write a single line text by
user input.

Output :
5. Write a program to capitalize the first letter of a sentence form data.txt file to file1.txt.
6. Write a program to replace all spaces from text with - (dash) from the file text.txt.

Output:

7. Write a program to know the cursor position and print the text according to
the below-given specifications.

a. Print the initial position


b. Move the cursor to 4th position
c. Display next 5 characters
d. Move cursor to next 10 characters
e. Print the current cursor position
f. Print next 10 characters from current position
Output:
8. Create a binary file client.dat to hold records like ClientID, Client name, and Address
using the dictionary. Write functions to write data, read them, and print on the screen.

Output:
9. Write a program to inserting/appending a record in a binary file-student.

Output:
10.Write a program to write data into binary file marks.dat and display the records of
students who scored more than 95 marks.

Output:
11.Read a CSV file batsman.csv and print the contents in a proper format. The data for
top5.csv file are as following:

Output:
12.Read a CSV file top5.csv and print them with tab delimiter. Ignore first row header to
print in tabular form.

Output:
13. Write a program to count number of records from the CSV file.

Output:
14. Write a menu-driven python program to implement stack operation.
Output:
15. Write a program to implement a stack for the employee details (empno, name).
Output:
Part 4 SQL queries
16. Consider the following MOVIE table and write the SQL queries based on it.

a) Display all information from

movie . Ans. Select * from Movie;

b) Display the type of movies.

Ans. Select distinct type from movie;


c) Display movie id, movie name, total_eraning by showing the business done by the
movies. Calculate the business done by movie using the sum of production cost and business
cost.
Ans. Select Movie_Id, Movie_Name, Production+Cost-Business_cost “Total Earnings” from
Movie;

d) Display movie id, movie name and production cost for all movieswith production
cost greater than 150000 and less than 1000000.
Ans. Select Movie_Id, Movie_Name, Production_Cost from Movie
Where Production_Cost >150000 and Production_Cost <1000000;

e) Display the movie of type action and


romance. Ans. Select Movie_Name from Movie
Where Type='Action' or Type='Romance';
f) Display the list of movies which are going to release in February,
2022. Ans. Select Movie_Name from Movie
Where Release_Date>='2022-02-01' and Release_Date<='2022-02-28';

17. Consider the given table patient and Write following queries:

a) Display the total charges of patient admitted in the month of


November. Ans. Select sum(charges) from Patient
Where Date_Of_Adm like ‘%-11-%’;
b) Display the eldest patient with name and
age. Ans. Select PName, max(Age) from Patient;

c) Count the unique departments.


Ans. Select count(distinct Department) from Patient;

d) Display an average charges.


Ans. Select avg(Charges) from Patient;
17. Suppose your school management has decided to conduct cricket matches between
students of Class XI and Class XII. Students of each class are asked to join any one of
the four teams – Team Titan, Team Rockers, Team Magnet and Team Hurricane. During
summer vacations, various matches will be conducted between these teams. Help your
sports teacher to do the following:

a) Create Database “Sports”.

b) Create a table “Team” with following considerations:

- It should have a column TeamID for storing an integer value between 1 to


9, which refers to unique identification of a team.
- Each TeamID should have its associated name (TeamName), which should be
a string of length not less than 10 characters.
-Using table level constraint, make TeamID as the primary key.

Ans. Create table Team


(
TeamID Integer(1),
TeamName varchar(10)
);
c) Show the structure of the table TEAM using a SQL statement.
Ans. Desc Team;

d) As per the preferences of the students four teams were formed as given below. Insert
these four rows in TEAM table:
a. Row 1: (1, Jal)
b. Row 2: (2, Vayu)
c. Row 3: (3, Agni)
d. Row 3: (4,
Prithvi) Ans. Insert into team
Values(1,’Jal’);
e) Show the contents of the table TEAM using a DML statement.

Ans. Select * from Team;

f) Now create another table MATCH_DETAILS and insert data as shown below.
Choose appropriate data types and constraints for each attribute.

Ans. create table Match_Details


(
Match_ID varchar(2) Primary Key,
Match_Date Date,
First_Team_ID int(1) references team(TeamID),
Second_Team_ID int(1) references team(TeamID),
First_Team_Score int(3),
Second_Team_Score int(3)
)
19. Write following queries.

a) Display the match id, team id, team score who scored more than 70 in first innings
along with team name.

Ans.

Select Match_Details.Match_ID,Match_Details.First_Team_ID,Team.TeamName,

Match_Details.First_Team_Score from Match_Details,Team

Where Match_Details.First_Team_ID=Team.TeamID and


Match_Details.First_Team_Score>70;
b) Display match id, team name and second team score between 100 to
160. Ans.
Select Match_ID,TeamName,Second_Team_Score from Match_Details,Team
Where Match_Details.Second_Team_ID=team.TeamID
and Match_Details.Second_Team_Score between 100 and 160;

c) Display match id, team names along with match


dates. Ans.
Select Match_ID,TeamName,Match_Date from Match_Details, Team
Where Match_Details.First_Team_ID=team.TeamID
d) Display unique team names
Ans. select distinct(Teamname) from team;

e) Display match id and match date played by Jal and Agni.


Ans. Select Match_ID,Match_Date from Match_Details, Team
Where Match_Details.First_Team_ID=team.TeamID
and team.TeamName in ('Jal','Agni');
20. Consider the following table and write the queries.

a) Display all the items in the ascending order of


stockdate. Ans. Select * from stock
Order by Stock_Date;

b) Display maximum price of items for each dealer individually as per dcode from
stock. Ans. Select dcode,max(unitprice) from stock
Group by dcode;
c) Display all the items in descending orders of item names.
Ans. Select * from stock
Order by Item desc;

d) Display average price of items for each dealer individually as per dcode from
stock which average price is more than 5.
Ans. Select dcode,avg(unitprice) from stock
group by dcode
having avg(unitprice)>5;

e) Display the sum of quantity for each dcode.


Ans. Select dcode,sum(qty) from stock
group by dcode;
Part 5 Python Database connectivity

21. Write a MySQL connectivity program in Python to


● Create a database school

Output:

● Create a table students with the specifications - ROLLNO integer, STNAME


character(10) in MySQL and perform the following operations:
o Insert two records in it

o Display the contents of the table

Output:
Output:
22. Perform all the operations with reference to table ‘student’ through MySQL-
Python connectivity.
Output:
23. SS public school is managing student data in “student” table in “School” database.
Write a python code that connects to database school and retrieves all records and displays
total number of students.

Output:
24. Divine Hotel needs to store ,retrieve and delete the records of its clients. Devlop
an interface that provides front-end interaction through python and stores and
updates record using MySQL. The table clients can be used to perform different
operations. Answer the following questions.
a. Write a program to read and display all the records from the clients table having
bill amount more than Rs. 10000.

Output:
b. Write a program to update the records of the clients by reducing the bill amount
Rs. 1000 of all those clients who are having bill > 150000.

Output :

You might also like