AISSCE PRACTICAL EXAM – 2023-24
SUB: COMPUTER SCIENCE (083)- XII
Python Programming
S.N List of Practicals Completion
. date
1 Write a Program to define a function FACTO(n) which accepts an integer and return the
factorial of a number.
2 Write a function in python which accept a number from user to return True, if the number
is a prime number else return False. Use this function to print all prime numbers from 1 to
100.
3 Define a function PALINDROME(N) which accepts an integer and check whether it is
palindrome or not. Print appropriate massage.
4 Write a function in python which accept a list of marks of students and return the minimum
mark, maximum mark and the average marks. Use the same function to test.
5 Write a Program to demonstrate linear search.
6 Write a Program to read a text file “myfile.txt” line by line and display each word
separated by a #.
7 Write a Program to read a text file “myfile.txt” and display the number of vowels/
consonants/ uppercase/ lowercase characters in the file.
8 Write a Program to create binary file to store Rollno and Name, Search any Rollno and
display name if Rollno found, otherwise “Rollno not found”.
9 Write a Program to create binary file to store Rollno, Name and Marks and update
marks of entered Rollno.
10 Write a Program to read the content of file line by line and write it to another file
except for the lines starting with letter ‘a’.
11 Write a Program to create CSV file and store empno, name, salary and search any
empno and display name, salary and if not found, print appropriate message.
12 Write a Program to read a text file ‘data.txt’ to print the frequency of the word ‘He’ and
‘She’ found in the file.
13 Write a Program to read a CSV file (containing item no, name, rate) from hard disc and print
all the items whose rate is between Rs 500 and Rs 1000.
14 Write a method display_word() to read lines from a text file ‘story.txt’ and display those
words which are less than 5 characters.
15 Write a random number generator that generates random numbers between 1 and 6
(simulates a dice). Throw the two dices for 10 times and print their total.
16 Write a Program to pass an integer list as stack to a function and push only those elements
in the stack which are divisible by 7. Display all the elements.
17 Write a Program to connect with database and search employee number in table
employee and display record, if empno not found display appropriate message.
18 Write a Program to connect Python with MySQL using database connectivity and perform
the following operation on data in database:
Fetch records from the table using fetchone( ), fetchall() and fetchmany( ).
19 Write a Program to connect Python with MySQL using database connectivity and Update
student’s record based on the roll no entered by the user.
20 Write a Program to connect Python with MySQL using database connectivity and perform
the operation- deletion of record from student table based on the roll no entered.
SQL Queries
Write a Python program to connect with database and sends a SQL query to perform
operations.
Q.21 Consider the tables given below and answer the questions that follow:
Table: Employee
ENo Name Salary Zone Age Grade Dept
1 Mukul 30000 West 28 A 10
2 Kritika 35000 Centre 30 A 10
3 Naveen 32000 West 40 NULL 20
4 Uday 38000 North 38 C 30
5 Nupur 32000 East 26 NULL 20
6 Moksh 37000 South 28 B 10
7 Shelly 36000 North 26 A 30
Table: Department
Dept DName MinSal MaxSal HOD
10 Sales 25000 32000 1
20 Finance 30000 50000 5
30 Admin 25000 40000 7
Write SQL commands to:
Create Table
1. Create the table Employee.
2. Create the table Department.
Insert data in a table
3. Insert data in the table Employee
4. Insert data in the table Department.
Simple Select
5. Display the details of all the employees.
6. Display the Salary, Zone, and Grade of all the employees.
7. Display the records of all the employees in descending order of salary.
8. Display the records of all the employees along with their annual salaries. The Salary
column of the table contains monthly salaries of the employees. The new column should be
given the name “Annual Salary”.
Conditional Select using Where Clause
9. Display the details of all the employees who are below 30 years of age.
10. Display the names of all the employees working in North zone.
11. Display the salaries of all the employees of department 10.
12. Display the details of all the employees whose Grade is not NULL.
Using DISTINCT Clause
13. Display the names of various zones from the table Employee. A zone name should appear
only once.
14. Display the various department numbers from the table Employee. A department number
should be displayed only once.
Using Logical Operators (NOT, AND, OR)
15. Display the details of all the employees of department 10 who are above 30 years of age.
16. Display the details of all the employees who are getting a salary of more than 35000 in the
department 30.
17. Display the names and salaries of all the employees who are not working in department
20.
18. Display the names and salaries of all the employees who are working neither in West zone
nor in Centre zone.
19. Display the names of all the employees who are working in department 20 or 30.
20. Display the details of all the employees whose salary is between 32000 and 38000.
21. Display the details of all the employees whose grade is between ‘A’ and ‘C’.
22. Display the details of all the employees aged above 30 in West zone.
Using IN Operator
23. Display the names of all the employees who are working in department 20 or 30. (Using IN
operator)
24. Display the names and salaries of all the employees who are working neither in West zone
nor in Centre zone. (Using IN operator)
Using BETWEEN Operator
25. Display the details of all the employees whose salary is between 32000 and 38000.
(Using BETWEEN operator)
26. Display the details of all the employees whose grade is between ‘A’ and ‘C’.
(Using BETWEEN operator)
Using LIKE Operator
27. Display the name, salary, and age of all the employees whose names start with ‘M’.
28. Display the name, salary, and age of all the employees whose names end with ‘a’.
29. Display the name, salary, and age of all the employees whose names contain ‘a’
30. Display the name, salary, and age of all the employees whose names do not contain ‘a’
31. Display the details of all the employees whose names contain ‘a’ as the second character.
Using ORDER BY clause
32. Display the details of all the employees in the ascending order of their salaries.
33. Display the details of all the employees in the descending order of their names.
34. Display the details of all the employees in the ascending order of their grades and within
grades in the descending order of their salaries.
Using UPDATE, DELETE, ALTER TABLE
35. Put the grade B for all those whose grade is NULL.
36. Increase the salary of all the employees above 30 years of age by 10%.
37. Delete the records of all the employees whose grade is C and salary is below 30000.
38. Delete the records of all the employees of department 10 who are above 40 years of age.
==00==