Class 12 CS Record File 2023-2024

Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

SHERWOOD HALL SENIOR SECONDARY SCHOOL

7, 13th Avenue, Harrington Road, Chennai - 600031

SUBJECT: COMPUTER SCIENCE


PRACTICAL RECORD

Certified to be the bonafide record work done by


___________________
of Class XII
during the academic year 2023 - 2024
Register No:

PRINCIPAL TEACHER IN CHARGE

Submitted for the practical examination held on____________ at


SHERWOOD HALL SENIOR SECONDARY SCHOOL
7, 13th Avenue, Harrington Road, Chennai - 600031

Internal Examiner External Examiner


Class XII Computer Science
Record Programs 2023-2024
Index

Program Date Program Name


Number

1 20/6/2023 Random number Generator (simulate a


dice)
2 20/6/2023 Program to make user define module and
import same in another module or
program.
3 4/7/2023 Read a text file line by line and display
each word separated by a #.

4 4/7/2023 Read a text file and display the number of


vowels/consonants/uppercase/lowercase
characters in the file.
5 4/7/2023 Remove all the lines that contain the
character 'a' in a file and write it to
another file.
6 2/8/2023 Binary File-Creation and Searching
7 2/8/2023 Binary File-Creation and Updating
8 8/8/2023 CSV File-Creation and Search based on
roll number
9 8/8/2023 CSV File-Creation and Search based on
username

10 16/8/2023 Program to implement a stack using a list


data-structure (using Function)

11 16/8/2023 Find most commonly occurring words in


phishing mails

12 22/8/2023 SQL- CUSTOMERBANK


13 22/8/2023 SQL-STUDENT

14 22/8/2023 SQL-ACCOUNT_TRANSACT

15 22/8/2023 SQL-PRODUCT-CLIENT

16 22/8/2023 SQL-TEACHER-POSTING

17 29/8/2023 Integrate SQL with Python-Creation and


display of a record

18 29/8/2023 Integrate SQL with Python-Searching of a


record

19 30/8/2023 Integrate SQL with Python-Updating a


record

20 30/8/2023 Integrate SQL with Python-


Deletion of a record
Prog:1 Random number generator (simulates a dice).
Aim:
To write a random number generator that generates random numbers
between 1 and 6 (simulates a dice).
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:

Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified.
Prog:2 Python program to make user define module and import same
in another module or program.
Aim:
To write a Python program to make user define module and import same
in another module or program.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the codes separately as Area_square and Area_rect and run import package
by pressing F5 key
Source Code:
Area_square.py

Area_rect.py

Import package.py

Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified.
Prog:3 Read a text file line by line and display each word
separated by a #.
Aim:
To read a text file line by line and display each word separated by a #.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:

Output:
Result:
Thus, the Python program is executed successfully, and the output is
verified
Prog:4 Read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
Aim:
To read a text file and display the number of
vowels/consonants/uppercase/lowercase characters in the file.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified
Prog:5 Remove all the lines that contain the character 'a' in a
file and write it to another file.
Aim:
To remove all the lines that contain the character 'a' in a file and write it
to another file.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified
Prog:6 Binary File-Creation and Searching

Aim:
To create a binary file with name and roll number. Search for a given roll
number

Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified
Prog:7 Binary File-Creation and Updating
Aim:
To create a binary file with roll number, name and marks. Input a roll
number and update the marks
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified
Prog:8 CSV File-Creation and Search based on roll number
Aim:
To create a CSV file with name and roll number.Search for a given roll
number and display the name,if not found display appropriate message.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified
Prog:9 CSV File-Creation and Search based on username
Aim:
To create a CSV file with user-id and password.Search for a given
userid and display the password, if not found display appropriate message.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:
Result:
Thus, the Python program is executed successfully, and the output is
verified.
Prog:10 Program to implement a stack using a list data-structure
(Using Function)

Aim:
To write a Python program to implement a stack using a list
data-structure (using Function)

Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:
Result:
Thus, the given program is executed successfully, and the output is
verified.
Prog:11 Find most commonly occurring words in phishing mails
Aim:
To find most commonly occurring words in phishing mails.
Procedure:
Save the code and run it by pressing F5 key
Source Code:

Output:

Result:
Thus, the Python program is executed successfully, and the output is
verified
Prog:12 SQL- CUSTOMERBANK
Create the following table with the data given and perform the queries
given below:
a. Display the amount and date of joining of savings accounts.

b. Display name and gender of current account holders.


c. Display the names of customer with their date of joining in descending
order.

d. Display the customers who have joined after 1998 May 31.

e. Display female customers with accumulated amount greater than


1025000.

f. Display the customer having 5 letters name.


g. Display the account types of the bank.

h. To give boost to spending by females the government wants to add Rs.


5000 to all accounts held by females. Write command to do this.
i. Add a new column named ‘limit’. This is the limit of one time
withdrawal. Choose the appropriate data type.

j. Delete all the accounts opened before 1 Jan 1999.


Prog:13 SQL- STUDENT

Create the following table with the data given and perform the queries
given below:
(i) To display the records from table student in alphabetical order as per
the name of the student.

(ii) To display Class, Dob and City whose marks is between 450 and 551.
(iii) To display Name, Class and total number of students who have secured
more than 450 marks.

(iv) To increase marks of all students by 20 whose class is “XII”


Write the output for SQL queries (i) to (iii), which are based on the table:
STUDENT
(i) SELECT COUNT(*), City FROM STUDENT GROUP BY CITY
HAVING COUNT(*)>1;

(ii) SELECT MAX(DOB),MIN(DOB) FROM STUDENT;

(iii) SELECT NAME,GENDER FROM STUDENT WHERE


CITY=”Delhi”;
Prog:14 SQL-ACCOUNT_TRANSACT
Create the following table with the data given:

TABLE: ACCOUNT
ANO ANAME ADDRESS
101 Yuvraj Singh Bangalore
102 Rohan Gupta Chennai
103 Ali Reza Hyderabad
104 Rishabh Jain Chennai
105 Simran Kaur Chandigarh

TABLE: TRANSACT
TNO ANO AMOUNT TYPE DOT
T001 101 2500 Withdraw 2017-12-21
T002 103 3000 Deposit 2017-06-01
T003 102 2000 Withdraw 2017-06-12
T004 103 1000 Deposit 2017-10-22
T005 101 12000 Deposit 2017-11-06
Write SQL commands for the following queries (i) to (iv) based on the
relations Account and Transact given below
i. To display details of all transactions of TYPE Deposit from Table
TRANSACT

ii. To display the ANO and AMOUNT of all Deposits and Withdrawals
done in the month of October2017 from table TRANSACT
iii. To display the last date of transaction (DOT) from the table
TRANSACT for the Accounts having ANO as 103

iv. To display all ANO, ANAME and DOT of those persons from tables
ACCOUNT and TRANSACT who have done transactions less than
or equal to 3000.

Write the outputs of the SQL queries (i) to (v) based on the relations
Account and Transact given below:
i. SELECT ANO, COUNT (*), MIN (AMOUNT) FROM TRANSACT
GROUP BY ANO HAVING COUNT(*) > 1;
ii. SELECT COUNT (*),SUM(AMOUNT) FROM TRANSACT
WHERE DOT < = '2017-06-12';

iii. SELECT AND, ANAME FROM ACCOUNT WHERE ADDRESS


NOT IN ('CHENNAI', 'BANGALORE');

iv. SELECT DISTINCT ANO FROM TRANSACT;

v. SELECT ACCOUNT.ANO,ANAME FROM


ACCOUNT,TRANSACT WHERE
ACCOUNT.ANO=TRANSACT.ANO AND TYPE='WITHDRAW';
Prog:15 SQL- PRODUCT-CLIENT

Create the following table with the data given and perform the queries
given below:
\
(i) To display the details of those Clients whose City is Delhi.

(ii) To display the details of Products whose Price is in the range of 50 to


100(Both values included)

(iii) To display the ClientName, City from Table Client, and ProductName
and Price from Table Product, with their corresponding matching P_ID.

(iv) To increase the Price of all Products by 10.


(v) To display the distinct cities from the Client Table.

(vi) To display the maximum and minimum price of each manufacturer


and the count of products from each manufacturer.
(vii) To display the ClientName of the respective Product.

(viii) To display price for 4 of each product from Product Table


Prog:16 SQL- TEACHER-POSTING
Create the following table with the data given:
Write SQL commands for the following queries (i) to (v) based on the
relations Teacher and Posting given below:
(i) To show all information about the teacher of History department.

(ii) To list the names of female teachers who are in Mathematics


department.
(ill) To list the names of all teachers with their date of joining in ascending
order.

(iv)) To display teacher's name, salary, age for male teachers only.

(v) To display name, bonus for each teacher where bonus is 10% of salary
Write the outputs of the SQL queries (i) to (iii) based on the relations
Teacher and Posting given below:
(i) SELECT Department, count(*) FROM Teacher GROUP BY
Department;

(ii) SELECT Max(date_of_join),Min(date_of_join) from teacher;

(iii SELECT teacher.name,teacher.department,posting.place from


teacher,posting where teacher.department=posting.department and
posting.place='DELHI';
Prog:17 Connect with database and store record of employee
and display records.

Aim:
To integrate SQL with Python by importing the MySQL module to
store a record of employee and display the record.

Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the given program is executed successfully, and the output is
verified
Prog:18 Integrate SQL with Python by importing the MySQL module
to search an employee using employee no.
Aim:
To integrate SQL with Python by importing the MySQL module to
connect with a database and search employee number in table employee and
display record, if employee no not found display appropriate message
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:

Output:

Result:
Thus, the given program is executed successfully, and the output is
verified
Prog19 Integrate SQL with Python by importing the MySQL module
to search an employee using employee no and update the record.
Aim:
To integrate SQL with Python by importing the MySQL module to search
an employee using employee no and update the record.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the given program is executed successfully, and the output is
verified
Prog:20 Integrate SQL with Python by importing the MySQL module
to search an employee using employee no and delete the record..
Aim:
To integrate SQL with Python by importing the MySQL module to search
an employee using employee no and delete the record.
Procedure:
Start Python IDLE. Click File->New File and type the following code.
Save the code and run it by pressing F5 key
Source Code:
Output:

Result:
Thus, the given program is executed successfully, and the output is
verified

You might also like