IMPORTANT QUESTIONS FOR PRACTICALS
Q1 Program using CSV: 8 Marks
Sangeeta is a python programmer working in a computer hardware company. She has to
maintain the records of the peripheral devices. She created a csv file, [Link], to store
details. The structure of [Link] is [p_id,p_name,price], whre p_id is peripheral device
id(integer), p_name is peripheral device name(string) and price is peripheral device
price(integer).
Sangeeta wants to write the following user defined functions:
Add_device() : To accept a record from user and add it to csv file.
Count_device(): To count and display the number of peripheral devices whose price is
less than 1000
Q2. MySQL Queries : 4 marks
Consider the table RESULT2023 given below and answer the following questions(any 4)
RollNo Name Class Gender City Marks
1 Naman XII M Bhopal 453
2 Nandini X F Jaipur 551
3 Nakshatra X F Delhi 553
4 Shailesh XI M Chandigarh 458
5 Trisha XII F Delhi 430
6 Manisha XII F Jaipur 530
(a) To display the details of class XII students in descending order of their marks.
(b) Display the sum of the marks of students who have scored more than 500.
(c) Find the maximum marks of the student for each class.
(d) Count the students class wise and display only those number which is more than 2.
(e) Display unique cities from the table.
Q1 Program using File Handling 8 marks
A binary file “[Link]” has structure [rollno, name, marks].
i. Write a user defined function insertRec() to input data for a student and add to
[Link].
ii. Write a function searchRollNo( r ) in Python which accepts the student’s rollno as
parameter and searches the record in the file “[Link]” and shows the details of student
i.e. rollno, name and marks (if found) otherwise shows the message as ‘No record found’.
Q2. MySQL Queries : 4 marks
Consider the table RESULT2023 given below and answer the following questions:(any 4)
RollNo Name Class Gender City Marks (a) Display
1 Naman XII M Bhopal 453 All the
boys
2 Nandini X F Jaipur 551
whose city
3 Nakshatra X F Delhi 553 is Bhopal.
4 Shailesh XI M Chandigarh 458
5 Trisha XII F Delhi 430
6 Manisha XII F Jaipur 530
(b) To display the details of class XII students in descending order of their marks.
(c) Display the Average of the marks of students who have scored more than 500.
(d) Find the maximum marks of the student for each class.
(e) Display All the student name starting with Letter “N”.
Q1 Program using Stack 8 marks
A list contains the following record of a customer:
[customer_name,phone_number,city]
Write the following user defined functions to perform given operations on the stack named ‘status’
1) Push_element() : To push to the stack an object containing name and phone number of
customer who live in Khandwa.
2) Pop_element() : To pop the objects from the stack and display them. Also, display ‘Stack
Empty’ When there is no elements in the stack.
Q2. MySQL Queries : 4 marks
Consider the table RESULT2023 given below and answer the following questions:
( Any 4)
RollNo Name Class Gender City Marks
1 Naman XII M Bhopal 453
2 Nandini X F Jaipur 551
3 Nakshatra X F Delhi 553
4 Shailesh XI M Chandigarh 458
5 Trisha XII F Delhi 430
6 Manisha XII F Jaipur 530
(a) To display city wise total marks.
(b) To display the details of class XII students whose city is “Delhi”.
(c) Display the sum of the marks of students who have scored less than 500.
(d) Find the average marks of the student for each class.
(e) Display unique cities from the table.