cs file

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

RAJHANS VIDYALAYA

STD. XII (COMPUTER SCIENCE PYTHON)


LIST OF PROGRAMS FOR THE BOARD
PRACTICAL EXAM 2024-2025

Q1.Write a program that reads a line and prints its statistics like:
Number of uppercase letters:
Number of lowercase letters:
Number of alphabets:
Number of digits:
Q2. Write a program to find the second largest number of a list of
numbers.
Q3.Write a program to count frequency of a given element in a list of
numbers.
Eg List=[1,2,1,3,2,4,5,1,2,2]
Enter element:2 2 has frequency as 4 in the list
Q4. Write a python function second largest (T) which takes as input a
tuple T and returns the second largest element in the tuple. You can
use any of the standard python functions to obtain your result.
Q5. Write a program to define a function that accepts a sentence and
calculate the number of letters , digits, upper case letters and lower
case letters.
Q6 Write a program using function called my_buzz that takes a
number. If the number is divisible by 3, it should return “Fizz”.
If it is divisible by 5, it should return “Buzz”.
If it is divisible by both 3 and 5, it should return “FizzBuzz”.
Otherwise, same no.

Q7. Write a function LShift(Arr,n) in Python, which accepts a list Arr of


numbers and n is a numeric value by which all elements of the list are
shifted to the left.
eg Arr=[10,20,30,40,12,11], n=2
Output: Arr=[30,40,12,11,10,20]
Q8. Create a text file emp.txt with 5 employees Number, Name and
Salary. Display all the records of emp.txt along with line/record
number.
Q9. Write a program that reads a text file and creates another file that
is identical except that space is replaced with hyphen symbol.
Q10. Create a binary file “employee” that stores the records of
employees and display them one by one. (b) Display the records of all
those employees who are getting salaries between 25000 to 30000.
Q11. A binary file “STU.DAT” has structure
(admission_number,Name,Percentage). Write a function countrec() in
Python that would read contents of the file “STU.DAT” and display the
details of those students whose percentage is above 75. Also display
number of students scoring above 75%.
Q12. Write a binary file program to increase the salary by Rs. 2000 of
the employee having empno as 1251 in the file empl.dat.
Q13. What is the advantage of using a CSV file for permanent storage ?
Write a Program in Python that defines and calls the following user
defined functions:
a) ADD() To accept and add data of an employee to a CSV file
‘record.csv’. Each record consists of a list with field elements as
empid,name and mobile to store employee id,name and salary
respectively.
b) COUNTR() To count the number of records present in the CSV file
named ‘record.csv’.
Q14. Write a program to search the record of a particular employee
from CSV file on the basis of inputted name.
Q15. Write a program to implement a stack for these book
details(bookno,booname). That is, now each item node of the stack
contains two types of information- a bookno and its name. Write
complete program to implement PUSH and Display operations.

Q16. A)Create the table CLUB with the following records:-


COACH_ID COACHNAME AGE SPORTS DATEOFAPP PAY SEX
1 KUKREJA 35 KARATE 27/3/1996 1000 M
2 RAVINA 34 SQUASH 19/2/1998 1200 F
3 ZUBIN 36 SWIMMING 12/1/1998 750 M
4 SHAILYA 41 BASKETBALL 19/2/1998 1700 M

i) Display all information about the swimming coaches in the club or


female coaches.
ii) Display names of all coaches with their date of appointment in
descending order only if pay is more than 1000.
iii) Increase the pay of coaches by 2000.
iv) Display the names of substring “YA” or age is more than 30.
v) Display a report showing coachname, pay, age and bonus(15% of
pay) for all the coaches.

B)Create the table GRADUATE with the following records:-


S.NO. NAME STIPEND SUBJECT AVERAGE RANK
1 DIVYA 400 PHYSICS 68 1
2 DIVAKAR 450 COMPUTER SC. 90 1
3 VIKAS 350 MATHS 95 2
4 SABINA 500 CHEMISTRY 57 1

i) Display the names of those who have obtained rank 1 sorted by


NAME.
ii) Display the names with substring “NA” or average is more than
70.
iii) Increase the stipend by 500.
iv) Display all the records whose SUBJECT is PHYSICS and RANK is 1.
v) Display a report showing name, subject, average and bonus(15%
of stipend) for all the graduates.

FOR Q’S 17-20 use user as “root” and password as “123456”


INTERFACE PYTHON WITH MYSQL
Create database namely NEW and add 5 records to the CUSTOMER
table.
1 Amar 6887787 MUMBAI 8000
2 Sandeep 6878787 DELHI 9000
3 Rinky 9089809 MUMBAI 3000
4 Reena 798799 KOLKATA 6000
5 John 878797 DELHI 7000
Q17. Write code to connect to MySQL database namely NEW and
display all the records of CUSTOMER table and only those records
where customer name starts with “R”.
Q18. Write code to connect to MySQL database namely NEW and
increase the amount by 2000 for all the records.
Q19. Write code to connect to MySQL database namely NEW and
search those customers whose salary is between 5000 to 9000.
Q20. Write code to connect to MySQL database namely NEW and
delete the customer whose CNO is 5.
Important Instructions:
1. PRACTICAL FILE
● The practical file should include an Index of all the above
programs in proper order. You may add more programs, but
include them at the end of the Index.
● All the programs should include the program listing(code)
and the OUTPUT arranged according to the index.
● The file should include a Certificate to be signed by the
teacher.
Programs should be user friendly, indent properly, comments
wherever necessary.

RAJHANS VIDYALAYA
ANDHERI-WEST
MUMBAI

CERTIFICATE

This is to certify that this computer practical file has been completed by
____________________of class________ and board roll number____________, in
partial fulfillment of the curriculum of the CENTRAL BOARD OF SECONDARY
EDUCATION leading to the award of All India Senior School Certificate for the
year 2024-2025.

____________________ ______________________
External Examiner Internal Examiner
Date: Date:

____________________ ______________________
SCHOOL SEAL PRINCIPAL
Date:

You might also like