0% found this document useful (0 votes)
22 views5 pages

Class 12 Computer Sci Holiday Homework 22052024 110241000000009

The document outlines a project for Class XII-ABC in Computer Science, requiring students to create a tangible application using Python file handling or Python-SQL connectivity to solve a real-world problem. It includes detailed instructions for formatting the practical file, a list of programming tasks to complete, and guidelines for submission deadlines and plagiarism policies. Additionally, it covers practical questions related to Python programming, data structures, and SQL queries.

Uploaded by

Saksham Gulati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views5 pages

Class 12 Computer Sci Holiday Homework 22052024 110241000000009

The document outlines a project for Class XII-ABC in Computer Science, requiring students to create a tangible application using Python file handling or Python-SQL connectivity to solve a real-world problem. It includes detailed instructions for formatting the practical file, a list of programming tasks to complete, and guidelines for submission deadlines and plagiarism policies. Additionally, it covers practical questions related to Python programming, data structures, and SQL queries.

Uploaded by

Saksham Gulati
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Computer Science

Class XII-ABC

2024-25

Project- Create something that is tangible and useful using Python file handling/ Python-SQL
connectivity. The aim here is to find a real world problem that is worthwhile to solve.
Use a wide variety of Python libraries to create user friendly applications(AI based)

Practical File – Python Basics, Functions and Data File Handling Data Structures(stacks), SQL
queries and Python-SQL Connectivity.
Instructions for the Project and Practical file

1. Font type to be used Times New Roman


2. Size of the question 14 bold.
3. Size of the code 13-Properly indented and justified
4. Page border to be inserted
5. Screen shot of the output window to be properly cropped and center aligned.
6. Format: Question
Code
Output Screen
7. Project Synopsis to be submitted by 24th May,2024.
8. Kindly adhere to deadlines mentioned. No reminders will be given.
9. Plagiarism will lead to cancellation of practical file.

Practical File Questions


1.Write a program to calculate the sum of primary (principal)and secondary diagonals of a 2D list.

2. Write a Python script to accept a number from the user. Pass this number to a function which
determines whether the number is a Perfect Number or not. Perfect number is a positive integer
that is equal to the sum of its proper divisors
3. Write a Python script to count the number of elements in a list within a specified range

4. Write a menu driven program to input a number and then call the functions :-

count() which returns the number of digits;


reverse() which returns the reverse of a number;
hasdigit(n) which returns True if the number has a digit else False;
show() to show the number as sum of place values of the digits of the number.
The program should continue as long as the user wants.

1
5. Write a random number generator that generates random numbers between 1 and 6 (simulates a dice).

6. Write a Python code with the following functions:


a. AddValues(L) - To add integer values entered by the user in the list L
b. DispValues(L) - To display values of L
c. SwapPair(L) - To re-arrange the content of L by swapping each pair of adjacent
neighboring values
d. SwapHalf(L) - To re-arrange content of L by swapping first half of the list with
second half of the list
Also, call the above functions in the order as a, b, c, b, d and b.

7. Write a program to accept roll no., name and marks of n students from the user.
Store these details separated by commas in a file Marks.txt. For e.g.

1,Anuj,97.5
2,Jiya,78.5

8. Write a program to display the size of a file in bytes.

9.Write a program to display the number of lines in a text file.

10. Write a program to count the number of vowels in a text file.

Contents of the file are:


Alexander the Great was a successful ruler because his actions created
long lasting effects on cultures that continue to the present day. One
example of his legacy was the creation of a Hellenistic society.

11. Write a program using user defined function to read the contents of a text file and
display the following -
1. No. of words
2. No. of digits
3. No. of special characters

Content of the the file:


The Ipsos Mori survey of more than 16000 people worldwide found that 77 %
were happy, a rate that rose to 88 % in Sweden, 85 % in Australia and 83 %
in the US. Happiness levels were lower in Europe, with Spain at the bottom
of the pile. Only 59 % of Spaniards said they were happy. Britain was
close to the average at 76 %.

12. Write a menu driven program to perform read and write operations on a text file "Student.txt" for
student roll no, name and marks using separate functions as given below-

2
(i) writefile() - Student data entry (while writing data into the file the three
elements should be separated with comma operator)
(ii) readfile() - Display all students' details in tabular format
(iii) student_search() - Search for a particular student's roll no and display only
those details.
13. Assuming the tuple Vehicle as (vehicletype, no_of_wheels) where vehicletype is a
string and no_of_wheels is an integer, write a function showfile() to read all
the records present in an already existing binary file SPEED.DAT and display them on
the screen. Also count the number of records present in the file

14. Given a binary file STUDENT.DAT, containing records of the type [S_Admno,
S_Name, Percentage] where these three values are- S_Admno – Admission Number of
student (string)

S_Name – Name of student (string) Percentage – Marks percentage of student (float)

Write a function in PYTHON that would read contents of the file STUDENT.DAT
and display the details of those students whose percentage is above 75.

15. Write a function to search for a BookNo from a binary file BOOK.DAT, assuming
the binary file is containing the records of the following type:

{"BookNo":value, "Book_name":value}
Assume that BookNo <value> is an integer

16. Given a binary file EMP.DAT, containing records of the following type:
{"Empno":integer,"Empname":string, "Salary":integer}
Write functions to
1. Write records into the file
2. Display contents of the file EMP.DAT

Accept Empno from the user and pass it to a function update_emp(). If the employee no. is 125
then update the salary by Rs.2000/-.
17. Create a csv file "Employee.csv". It should contain the following data:
Name, Age, Qualification, Experience e.g. Ananya,32,PG,8
Write a menu driven program to perform the following operations on the file:
(i) Append record(s) to the file
(ii) Display all the data from the file
(iii) Display records with Age<30
(iv) Delete a record with given name and age (to be input from the user).

3
18. Using function in Python, push(client) and pop(Client) to add a new client and delete
from a list of client names, considering them to act as push and pop operations of the
stack data structure.

19. Using a function in Python, push(number) and pop(number) to add a number and
remove a number from a list of numbers, considering them in act as push and pop
operations of the stack data structure.
20. Write a menu driven program to implement a stack for these book details(bookno,
bookname)

MYSQL
15 queries based on 2 tables
CREATE DATABASE
CREATE TABLE
USE TABLE
INSERT INTO
SELECT
UPDATE
DELETE
ALTER TABLE (to add new attributes / modify data type / drop attribute)
LIKE, ORDER BY, IS NULL, IS NOT NULL,GROUP BY,BETWEEN,IN
SUM( ), MAX( ),MIN(), AVG(),COUNT()
JOINS

DATABASE CONNECTIVITY
3 PROGRAMS with all the necessary functions to integrate Python with Mysql

___________________________________________________________________________________

4
INDEX

TOPICS PAGE NOS

Lists, Strings, Tuples, Dictionaries

Functions

File Handling

Data Structures

MYSQL

Python SQL Connectivity

You might also like