DAV PUBLIC SCHOOL,SECTOR-14,GURUGRAM
CLASS XII
List of Programs for Practical File
Topic :Functions
Q 1) Write a random number generator that generates random numbers between 1 and 6
(simulates a dice).
Q 2) Write a Python function sin(x, n) to calculate the value of sin(x) using its Taylor series
expansion up to n terms. Compare the values of sin(x) for different values of n with the
correct value.
Q 3) Recursively find the factorial of a natural number.
Q 4) Write a recursive code to find the sum of all elements of a list.
Q 5) Write a recursive code to compute the nth Fibonacci number.
Q 6) Write a recursive Python program to test if a string is a palindrome or not.
Q 7) Write a recursive Python program to search a no using Binary search
Topic :File Handling
Q 8) Write a function countdigit( ) to count the number of digits containing a file article.txt.
Q 9) Write a function countloser( ) to count the number of lower case characters containing a file
article.txt.
Q 10) Write a function countuser( ) to count the number of words starting with ‘a’ containing a
file article.txt.
Q 11) Read a file line by line and print it.
Q 12) Remove all the lines that contain the character `a' in a file and write it to another file.
Topic :Stack and Queue
Q 13) Write a Python program to implement a stack using a list data-structure.
Q 14) Write a Python program to implement queue using a list data-structure.
Topic : Data visualization using Pyplot
Q 15) Write a Python program to plot the function y = x2 using the pyplot or matplotlib libraries.
Q 16) Create a graphical application that accepts user inputs, performs some operation on
them, and then writes the output on the screen. For example, write a small calculator. Use
the tkinter library.
Q 17) Open a webpage using the urllib library.
Q 18) Compute EMIs for a loan using the numpy or scipy libraries.
Q 19) Take a sample of 10 phishing e-mails and find the most common words.
Topic : SQL Table
Q 20) Create the following tables
(a) Table Name: Hospitals
Attributes:
Hospital_Id (Primary Key) Integer
Hospital_Name Text
Bed_Count Integer
Location Text
(b) Table Name: Doctors
Attributes:
Doctor_Id (Primary key) Integer
Doctor_Name
Hospital_Id (Foreign Key)
Joining_Date
Speciality
Salary
Experience
Write a SQL query to
i. Create Tables Hospitals and Doctors
ii. Find the min, max, sum, and average of the salary in a table Doctors.
iii. Find the total number of doctors from each Hospital in the table .
iv. Order the (Hospital_Id,Hospital_Name) table in descending order of the Bed_Count.
v. Find all the doctors in the hospital in ‘Delhi’.
vi. Find Sum of salaries of the doctors with more than 5 years experience in the hospitals.
Data Management: SQL and web-server
Q 21) Integrate SQL with Python by importing the MySQL module to add doctor to the table
Doctors
Q 22) Integrate SQL with Python by importing the MySQL module to modify the joining date of a
doctor
Q 23) Integrate SQL with Python by importing the MySQL module to delete doctor with give
doctor_id
Q 24) Integrate SQL with Python by importing the MySQL module to display all the doctor in the
city ‘Mumbai’
Q 25) Integrate SQL with Python by importing the MySQL module to display the doctor with
maximum salary
Topic :Django
Q 26) Write a Django based web server to parse a user request (POST), and write it to a CSV
file.