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

12 List of Prog 2025

Uploaded by

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

12 List of Prog 2025

Uploaded by

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

Python Programs and SQL Questions for the Practical Record File for 2024-25

Python Programs
1. Write an interactive menu driven program to do the following:
 to input a positive integer (say n); calculate and display number of digits, sum of the digits and product
of the digits
 to input a positive integer (say n); calculate and display number of even digits, number of odd digits,
sum of the even digits and the sum of the odd digits
 to input a positive integer (say n); calculate and display number of even digits, number of odd digits,
product of the even digits and the product of the odd digits
 to input a positive integer (say n); calculate and display number of digits, sum of the square of the digits
and the sum of reciprocal of the digits
 Exit from the menu and quit the program

2. Write an interactive menu driven program to do the following:


 to input two positive integers (say a & b); calculate and display HCF and LCM of the two integers
(without using math.gcd(), math.lcm())
 to input two positive integers (say n & r); calculate and display nPr and nCr of the two integers (without
using math.factorial(), math.perm(), math.comb())
 to input a positive integer (say n); generate and display first n Fibonacci numbers and at the end display
the sum of all the Fibonacci numbers generated (assume first two Fibonacci numbers are 0 and 1)
 to input a positive integer (say n); generate the first n Fibonacci numbers but display only the Fibonacci
Prime numbers (assume first two Fibonacci numbers are 0 and 1)
 Exit from the menu and quit the program

3. Write an interactive menu driven program to do the following:


 to input a positive integer (say n) and check for Perfect Number
 to input a positive integer (say n) and check for Prime Number
 to input a positive integer (say n) and check for Fibonacci Number
 to input a positive integer (say n) and check for Palindrome Number
 to input a positive integer (say n) and check for Armstrong Number
 Exit from the menu and quit the program

4. Write an interactive menu driven program to do the following (without using any list methods):
 to create a list with n (n is a user inputted value) random integers and every integer has 4 digits and
display the list on the screen using a loop
 to calculate and display the sum and the average of odd integers; calculate and display the sum and the
average of even integers present in the list without using sum() and len() functions
 to find and display maximum value and minimum value present in the list along with their position
without using max() and min() functions
 to find and display Arithmetic Mean, Geometric Mean and Harmonic Mean of values present in the list
without using any function from the statistics module
 Exit from the menu and quit the program

5. Write a menu driven program to do the following using only input(), print(), chr() & ord():
 to input a string (must contain uppercase, lowercase, digit and special characters); count and display
number of uppercase vowels, number of uppercase consonants, number of lowercase vowels, number of
lowercase consonants, number of digits and number of special characters
 to input a string (must contain uppercase, lowercase, digit and special characters); obtain a new string by
converting the inputted string into an uppercase string; display the new string
 to input a string (must contain uppercase, lowercase, digit and special characters); obtain a new string by
converting the inputted string into a lowercase string; display the new string
 to input a string (must contain uppercase, lowercase, digit and special characters); obtain a new string by
toggling the characters of the inputted string; display the new string
 to input a string; check whether the inputted string is Palindromic or not (without using slice)
 Exit from the menu and quit the program
6. Write a menu driven program to do the following:

Class XII Page 1 / 5 Subject: Computer Science (083)


Python Programs and SQL Questions for the Practical Record File for 2024-25
 to append the following lines in the text file 100TEST.TXT:
His 32 hundreds, however, are the joint-most alongside Kane
Williamson, who will complete 100 Test matches this week.
 to read and display the text file 100TEST.TXT on the screen; At end display number of characters
present in the text file
 to read the text file 100TEST.TXT and display number of uppercase characters, number of lowercase
characters, number of digits, number of whitespace characters and number of non- whitespace special
characters present in the text file
 to read the text file 100TEST.TXT and display number of uppercase vowels, number of lowercase
vowels, number of uppercase consonants and number of lowercase consonants present in the text file
 Exit from the menu and quit the program

7. Write a menu driven program to do the following:


 to read and display the text file 100TEST.TXT on the screen. At end display number of words present in
the text file
 to read the text file 100TEST.TXT and display number of times words 'THE', 'AN' and 'A' appear in
the text file (count ignoring case and count the articles separately)
 to read the text file 100TEST.TXT and display number of words starting with vowel (count ignoring
case)
 to read the text file 100TEST.TXT and display number of words containing at most 6 characters
 to read the text file 100TEST.TXT and display number of words containing at least three consonants
(count ignoring case)
 Exit from the menu and quit the program

8. Write a menu driven program to do the following:


 to read and display the text file 100TEST.TXT on the screen. At end display number of lines present in
the text file
 to read the text file 100TEST.TXT and display number of lines not starting with vowel (count ignoring
case)
 to read the text file 100TEST.TXT and display number of words present in every line
 to read the text file 100TEST.TXT and display number of alphabets present in every line
 to read the text file 100TEST.TXT and display number of digits and number of special characters
present in every line
 Exit from the menu and quit the program

9. A CSV file TEACHER.CSV contain teacher's data and every record has following fields:
CODE,NAME,SUBJECT,DESIG,NOP
Write an interactive menu driven to do the following (using CSV module):
 Append following records (lines / rows) in the file TEACHER.CSV by taking input from the keyboard
during the run-time:
1019,NUPUR CHACKO,MATH,PRT,30
1020,MANAS KHER,PHYS,PRT,30
 to read and display the CSV file; at the end display number of records present in the file
 to input teacher CODE; search for the teacher CODE in the CSV file TEACHER.CSV; if the teacher
CODE is found in the CSV file, then display teacher's details, otherwise display an appropriate message
 to read the CSV file TEACHER.CSV and display the records where SUBJECT is either PHYS or
CHEM; at the end display number of such records found in the CSV file
 Exit from the menu and quit the program

Class XII Page 2 / 5 Subject: Computer Science (083)


Python Programs and SQL Questions for the Practical Record File for 2024-25
10. A CSV file TEACHER.CSV contain teacher's data and every record has following fields:
CODE,NAME,SUBJECT,DESIG,NOP
Write an interactive menu driven to do the following (using CSV module):
 to read the CSV file TEACHER.CSV and display details of teachers where DESIG is either TGT or
PGT; if no record is found then display an appropriate message
 to read the CSV file TEACHER.CSV and display details of teachers where SUBJECT is MATH and
NOP>24; at the end display number of such records found in the file
 to update the CSV file TEACHER.CSV by increasing NOP of every PRT by 3 (without using temporary
file); display an appropriate message after updating
 Input teacher's CODE, if the inputted CODE is found then delete the record from the CSV file
TEACHER.CSV (without using temporary file); display an appropriate message after deletion
 Exit from the menu and quit the program

11. A CSV file TEACHER.CSV contain teacher's data and every record has following fields:
CODE,NAME,SUBJECT,DESIG,NOP
Write an interactive menu driven to do the following (using CSV module):
 to input teacher NAME; search for the teacher NAME in the CSV file TEACHER.CSV; if the teacher
NAME is found in the CSV file, then display teacher's details, otherwise display an appropriate message
 to read the CSV file TEACHER.CSV and display details where SUBJECT is MATH and DESIG is
TGT; at the end display number of such records found in the file
 to update the CSV file TEACHER.CSV by increasing NOP of every TGT by 2 (use a temporary file to
update the CSV file); display an appropriate message after updating
 Delete all the record from the CSV file TEACHER.CSV where DESIG is HOD by using a temporary
file; display an appropriate message after deletion
 Exit from the menu and quit the program

12. A Binary data file MARKS.DAT contains student's record as a list: [ROLL,NAME,THEO,PRAC,TOTAL]
where ROLL is int, NAME is str, THEO is float, PRAC is float and TOTAL is float
Write an interactive menu driven program using pickle module to do the following:
 to append following records in the binary data file MARKS.DAT by taking input from the keyboard
during the run-time:
29,SIDDHARTH DAS,51.0,27.0,78.0
30,SUDHIR SIGH,64.0,30.0,94.0
 to read and display the binary data file MARKS.DAT; at the end display number of records present in
the file
 to search for a student's details from the binary data file MARKS.DAT by inputting ROLL; if the
inputted ROLL is found in the file then display student's details, otherwise display an appropriate
message
 to read and display the binary data file MARKS.DAT; at the end display number of records where
THEO>60;
 Exit from the menu and quit the program

13. A Binary data file MARKS.DAT contains student's record as a list: [ROLL,NAME,THEO,PRAC,TOTAL]
where ROLL is int, NAME is str, THEO is float, PRAC is float and TOTAL is float
Write an interactive menu driven program using pickle module to do the following:
 to read the binary data file MARKS.DAT; display the records where TOTAL>=81 and TOTAL<=90; at
the end display number of such records found
 to read the binary data file MARKS.DAT; display the records where PRAC<25, otherwise display an
appropriate message if no such record is found
 to input a ROLL to edit a record in the binary data file MARKS.DAT by inputting new THEO, inputting
new PRAC & calculating TOTAL (use a list to update the binary file); display an appropriate message
after updating
 Input student's ROLL, if the inputted ROLL is found then delete the record from the binary data file
MARKS.DAT (delete the record by using a list); display an appropriate message after deletion
Class XII Page 3 / 5 Subject: Computer Science (083)
Python Programs and SQL Questions for the Practical Record File for 2024-25
 Exit from the menu and quit the program
14. A Binary data file MARKS.DAT contains student's record as a list: [ROLL,NAME,THEO,PRAC,TOTAL]
where ROLL is int, NAME is str, THEO is float, PRAC is float and TOTAL is float
Write an interactive menu driven program using pickle module to do the following:
 to search for a student's details from the binary data file MARKS.DAT by inputting NAME; if the
inputted NAME is found in the file then display student's details, otherwise display an appropriate
message
 to read the binary data file MARKS.DAT; display the records where THEO<50; if no such record is
found then display an appropriate message
 to update binary data file MARKS.DAT by increasing PRAC by 2 where PRAC is less than 24 (also
recalculate TOTAL) (use a temporary file for updating); display an appropriate message after updating
 to delete all the records from the binary data file MARKS.DAT where TOTAL<70 (use a temporary file
for deletion); display an appropriate message after deletion
 Exit from the menu and quit the program

15. Write an interactive menu driven program to implement a stack using a nested list. Stack contains billing
data: Mobile (8-digit integer), Name (string), Gamt (Gross Amount - float) and Discount calculated as
(stack must contain 5 items):
Gross Amount Discount
<=2000 0
>2000 and <=5000 5% of Gross Amount
>5000 and <=10000 10% of Gross Amount
>10000 15% of Gross Amount
The billing data also contains Namt (Net Amount - float) calculated as Gamt-Discount
The menu should contain following options:
 to insert a billing data in the stack
 to delete a billing data from the stack
 to display the content of stack
 Exit from the menu and quit the program

Class XII Page 4 / 5 Subject: Computer Science (083)


Python Programs and SQL Questions for the Practical Record File for 2024-25
SQL Questions
Table: Employee
ENO NAME SEX DEPT BRANCH DOJ BSAL MOB
1034 ADITI F PERSONNEL FAHAHEEL 2010-02-26 79000 62561240
1019 ARUN M FINANCE SALMIYA 2012-04-23 81000 98123478
1023 BADSHA M SALES SHIRQ 2014-06-17 63000 53902146
1055 CHETAN M PERSONNEL HAWALLY 2016-08-06 77000 66004572
1041 DEEPA F ADMIN SHIRQ 2011-11-02 51000 55987423
1063 ERIKA F SALES SALMIYA 2013-09-13 63000 96873484
1078 GAURAV M FINANCE SALMIYA 2015-07-20 84000 54116295
1070 JEEVAN M SALES HAWALLY 2017-05-22 61000 69335876
1013 KUNAL M PERSONNEL SALMIYA 2010-03-26 72000 97702040
1029 RUPA F ADMIN SHIRQ 2011-11-02 55000 69569316
1046 MANOJ M SALES HAWALLY 2014-06-17 67000 51312171
1066 NAMITA F FINANCE SHIRQ 2012-04-23 85000 92837456
1037 PRATAP M SALES FAHAHEEL 2014-11-23 66000 68458705
1048 GUARI F PERSONNEL SALMIYA 2016-08-24 74000 55873429
1057 HITESH M SALES HAWALLY 2012-09-14 68000 98123461
1015 ARUN M PERSONNEL FAHAHEEL 2013-09-13 77000 56123490
1022 ERIKA F FINANCE SALMIYA 2016-05-24 84000 95652310
1031 DILIP M SALES SHIRQ 2015-10-12 68000 69674234
1059 NUPUR F ADMIN SALMIYA 2014-01-30 55000 94233277
1065 MANOJ M PERSONNEL SALMIYA 2013-11-15 76000 67349830
1075 RAKESH M FINANCE SHIRQ 2015-03-28 86000 55983420
1. Insert following rows in the EMPLOYEE table:
1016,'SURESH','M','FINANCE','FAHAHEEL','2011-05-25',86000,64547281
1024,'SUNITA','F','ADMIN','SHIRQ','2013-07-13',54000,94010245
1036,'PRATAP','M','PERSONNEL','SALMIYA','2013-09-13',77000,54628090
1047,'SUNITA','F','SALES','HAWALLY','2016-03-19',65000,65789340
2. Display the EMPLOYEE table on the screen.
3. Display ENO, NAME, DEPT, BRANCH and BSAL for every employee.
4. Display NAME, DEPT, DOJ and 80% of BSAL as BONUS.
5. Display details of female employees.
6. Display details of employees of FINANCE department.
7. Display details of employees whose BSAL is greater than 75000.
8. Display details of employees working in either FAHAHEEL or in SALMIYA using OR operator.
9. Display details of employees working in either HAWALLY or in SHIRQ using IN operator.
10. Display details of employees whose BSAL>=55000 and BSAL<=70000 using AND operator.
11. Display details of employees who joined in the year 2015 using BETWEEN operator.
12. Display EMPLOYEE table sorted on ENO in ascending order.
13. Display EMPLOYEE table sorted on BSAL in descending order.
14. Display details of employees of PERSONNEL department sorted on NAME.
15. Display EMPLOYEE table sorted on DEPT and within DEPT, sorted on ENO.
16. Display number of male and female employees in the table.
17. Display number of employees branch wise.
18. Display number of employee department wise.
19. Increase BSAL by 5000 of every employee working SALES department and display the table.
20. Display minimum BSAL and maximum BSAL of EMPLOYEE table.
21. Add a column HRA FLOAT in the EMPLOYEE table and display the table.
22. Update the columns HRA as 20% of BSAL. Display the table after updating the rows.

Class XII Page 5 / 5 Subject: Computer Science (083)

You might also like