Practical Exam(CompSc-XII)-2024-25
Practical Exam(CompSc-XII)-2024-25
1. Write any one program in Python. (Attempt the question marked with () symbol.)
Marking Scheme [8 Marks]
(i) Logic: 60%
(ii) Documentation / Indentation: 20%
(iii) Code Quality: 20%
Q1. (i) A binary file “student.dat” has structure [Roll_number, Name, percentage]. Write a
program in python using function countrecthat would read contents of file
“student.dat” and display the details of those students whose percentage is above 75.
Also display number of students scoring above 75%.
(ii) A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price].
Write a program using user defined functions:
a) CreateFile() to input data for a record and add to Book.dat.
b) CountRec(Author) in Python which accepts the Author name as parameter and
count and return number of books by the given Author are stored in the binary file
“Book.dat.
(iii) Write a method DISPLAY( ) in Python to read lines from a text file
DIARY.TXT, and display those lines, which are starting with an alphabet ‘P’.
For example:
“Python is a high level programming language.
It is easy to learn.
Python language uses interpreter.
A language processor is also called a language translator.”
The output should be :
Python is a high level programming language.
Python language uses interpreter.
(iv) Write a program in Python that defines and calls the following user defined
functions:
(a) ADD() – To accept and add data of students to a CSV file “student.csv‟. Each
record consists of a list with field elements as Rollno, Name, Marks respectively.
(b) Display() – To read all content of “student.csv” and display records of only those
students who scored more than 80 marks. Records stored in students is in format :
Rollno, Name, Marks.
B. Report File :
Minimum 15 Python programs.
SQL Queries – Minimum 5 sets using one table / two tables.
Minimum 4 programs based on Python - SQL connectivity. 7 Marks