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

CS Practical File Grade XII

The document provides an index of 15 Python programs and 5 SQL queries exercises for a Grade 12 computer science practical file. The Python programs cover topics like temperature conversion, arithmetic operations, functions, strings, files, and stacks. The SQL queries involve creating and manipulating tables to perform operations like inserting data, updating records, ordering, grouping, joining, and aggregating. An additional section lists 5 Python-SQL connectivity programs involving creating a database and table, inserting records, updating data, and displaying information.

Uploaded by

Harshit Barot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

CS Practical File Grade XII

The document provides an index of 15 Python programs and 5 SQL queries exercises for a Grade 12 computer science practical file. The Python programs cover topics like temperature conversion, arithmetic operations, functions, strings, files, and stacks. The SQL queries involve creating and manipulating tables to perform operations like inserting data, updating records, ordering, grouping, joining, and aggregating. An additional section lists 5 Python-SQL connectivity programs involving creating a database and table, inserting records, updating data, and displaying information.

Uploaded by

Harshit Barot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

COMPUTER SCIENCE 23-24

PRACTICAL FILES
Grade XII
Python Programs

Index
S. Practical’s Name Page Teacher’s
No. No. Sign
1 Write a program to obtain temperature in Celsius and Covert it into
Fahrenheit.
2 Write a program to enter two integers and perform all arithmetic
operations on them.
3 Create Functions in Python to calculate Area and Perimeter of Circle.
Write a Python program to ask user to input their choice 1 or 2. If choice
is 1 calculate Area of Circle, if choice is 2 calculate Perimeter of Circle
otherwise show an error message.
4 Write a function in Python to multiply two integer numbers without
using the * operator, using repeated addition.
5 Write program in python to print the given opposite Floyd’s triangle.
(opposite right angle triangle)
6 Create a function to check the given string is palindrome. If Palindrome
then return True otherwise return False.
7 Create a Function to Guess_Numbers(), which ask a number between 1 to
6 form user. Generate a random number between 1 to 6 through random
module and check the User Guess is matched or not. Display appropriate
message,.
8 Create functions Wrtie_Text() and Read_Text(). Write_Text() to write
the contents in the text file “story.txt” line by line.
Read_Text() read the text file “story.txt” and display each word separated
by a ‘@’.
9 Create a function Count_Characters(filename), which receive filename as
argument.
Count_Character(filename) function will read text file “story.txt” and
display the number of vowels, consonants, uppercase, lowercase,
characters in the file.
10 Create a function Copy_File(target_filename), which receive filename as
argument.
Copy_File(target_filename) function read a text file “story.txt”, copy
those lines only to target_filename, which are not started with either ‘T’
or ‘A’.
11. Create a binary file “Student.dat” with name, roll_number, and marks.
Write a function Search(roll_number) for a given roll number and
display the name, if not found display appropriate message.
12 Create a binary file “Employee.dat” with emp id, name and salary.
Write a function Update_Sal(empid), receive an employee id and
update the salary.
Write a function Display(filename), display the all-updated records.
13. Create a CSV file by entering user_id and password, read and search the
password for given user_id.
14. Crate a CSV file “Score.csv” by entering roll, name and marks.
Write a function Grace_5Marks (), which read the csv file and increase
the marks by 5 of students which scored less than 33.
Write a function Display () to display all records from CSV file.
15. Write a Python program to implement a stack using list.

SQL Queries
S. Practical’s Name Page Teacher’s
No. No. Signature
1 Create a student table (ADMNO, CLASS-SEC, NAME, SCORE) and insert
data. Implement the following SQL commands on the student table:
 ALTER table to add new attributes (SEX CHAR(1) / modify data
type CHAR to VARCHAR/ drop attribute SEX
 UPDATE table to modify data- Increase the marks of all
students by 10 who scored less than 20.
 ORDER BY to display data in ascending / descending order by (i)
NAME wise (ii) SCORE wise
 DELETE to remove tuple(s) having SCORE less than 10.
 GROUP BY and find the min, max, sum, count and average

2 Create a EMPLOYEE table (EID, NAME, SALARY, DEPT) and insert data.
Implement the following SQL commands on the student table:
 ALTER table to add new attributes – HRA int (5) / modify data type of
HRA to decimal / drop attribute HRA
 UPDATE table to modify data – increase the salary by 10%
 ORDER BY to display data in ascending / descending order
(i) SALARY wise (ii) EID wise
 DELETE to remove tuple(s) – employee having emp id 101
 GROUP BY and find the min, max, sum, count and average.
3  Create a Database LIBRARY.
 Create a table BOOKs (book_id (PK), book_name, author_name,
publishers, price, type, qty) and Insert records
 Create a table ISSUED (issue_id, book_id (FK), quantity_issued ) and
Insert records.
 Write the SQL queries –
 To show Book name, Author name and Price of books of First
Publ. publishers. [SELECT, WHERE]
 To list the names from books of Text type. [SELECT, WHERE]
 To display the names and price from books in ascending order.
[ORDER BY]
 To increase the price of all books of EPB publishers by 50.
[UPDATE]
 To display the Book_Id, Book_Name. and Quantity_Issued for
all books which have been issued. [JOIN QUERY]
 To display the list of books having publisher value is NULL.
 To display the unique name of all Publishers.
 To display the Maximum and Average Price of Books Publisher
wise.
 Write the Output of the following queries based on the above tables.
 SELECT COUNT (*) FROM BOOKS;
 SELECT MAX(PRICE) FROM BOOKS
WHERE QUANTITY>= 15;
 SELECT BOOK_NAME, AUTHOR_NAME FROM
BOOKS WHERE PUBLISHERS = “EPB”;
 SELECT COUNT (DISTINCT PUBLISHERS) FROM BOOKS
WHERE PRICE >= 400;
4  Create a Database COMPANY.
 Create a table JOB (JOBID (PK), JOBTITLE, SALARY) and Insert
Records.
 Create a table Employee (EID (PK), NAME, SALES, JOBID
(FK)) and Insert Records
 Write the SQL Queries for the following:
i. To display employee ids, names of employees, job ids,
with corresponding job titles. (JOIN QUERY)
ii. To display names of employees, sales and corresponding job titles
who have achieved sales more than 130000. (JOIN QUERY)
iii. To display names and corresponding job titles of those employees
who have ‘SINGH’ (anywhere) in their names.
iv. Display the name of employee having maximum salary.
v. Write the SQL command to change the JobId to 104 of the
Employee with ID as E4 in the table EMPLOYEE.
5  Create a Table CLUB (CoachId, CoachName, Age, Sports, DateofApp,
Pay, Sex) and Insert Records.
 Write the SQL Queries for the following: -
 To display the list of coach who is playing KARATE.
 To display the records having Pay between 500 to 1000.
 To display the names of coach whose name starts with ‘A’.
 To display the total salary paid to Coach Gender wise.
 To display all records alphabetically on name.
 Give the output of following SQL statements: -
 SELECT COUNT (DISTINCT SPORTS) FROM CLUB;
 SELECT MIN(AGE) FROM CLUB WHERE SEX = ‘M’;
 SELECT AVG(AGE) FROM CLUB GROUP BY SEX;
 SLEECT SUM(PAY) FROM CLUB WHERE DATEOFAPP >
’31-03-1998’

Python - SQL Connectivity Programs


S. Practical’s Name Page Teacher’s
No. No. Signature
1 Write a Python Program to create a Database named “School”. Display
the List of Databases available in MySQL.

2 Write a Python program to Create a Table name “Student” under database


“School” contained RollNo, Name, UT1, and UT2 score.
Note: UT1 and UT2 out of 40 only.

3 Write a Python Program to Insert Records in “Student” table. Display all


records.
Note: UT1 and UT2 out of 40 only

4. Write a Python program to increase the marks of UT1 by 10 of those


students having UT1 marks less than 20. Also display a message how
many records are updated.

5. Write a Python programs to Display Records form table “Student” with


their Total Marks and Percentage.
(totalmarks = UT1 + UT2)
(percentage = totalmarks / 80 * 100

You might also like