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

CBSE Computer Science Practical Practice SET 4

Q.1. a. Consider the following definition of dictionary MULTIPLEX


MULTIPLEX={‘MNO’:______,’MNAME’:____,’MTYPE’:_____}
Where MNO represents movie number , MNAME represent.Mmoviename,
MTYPE represents movie type.
a. Write method writeMultiplexCinema() that takes MULTIPLEX dictionary object from
user and write into a binary file CINEMA.dat.
b. Write method updateMultiplex to update MULTIPLEX object MTYPE from ‘Drama’ to
‘DRAMA’ .4 marks
OR ( No internal choice will be given in paper)
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 left.
(4)
Sample Input Data of the list :Arr= [ 10,20,30,40,12,11], n = 2
Output :Arr = [30,40,12,11,10,20]
Q.1.b Write function createPersonCsv() to create csv file named ‘ Person.csv’ containing details
of person name, age, weight, city from the user till the user wants to enter the records.
Write function displayPersoninJaipur() to display the details of Person who lives in ‘Jaipur’ city.

Call the functions appropriately. 4 marks

The sample output is given below


Q.2. Consider the following tables BOOKS and ISSUED. Write SQL commands for the
statements (i) to (iv) 4 marks

BOOKS
Book_Id Book_Name Author_Name Publishers Price Type Quantity
C01 Fast Cook Lata Kapoor EPB 355 Cooker 5
y
F01 The Tears William First 650 Fiction 20
Hopkins
T01 My C++ Brain & Brooke FPB 350 Text 10
T02 C++ Brain A.W.Rossaine TDH 350 Text 15
F02 Thuderbolts Anna Roberts First 750 Fiction 50
ISSUED
Book_Id Quantity_Issued
T01 4
C01 5
F01 2
C01 6
T02 3

1. To list the names from books of Text type.


SELECT Book_NAME FROM BOOKS WHERE Type=’Text’;
2. To display the names and price from books in ascending order of their price.
SELECT Book_Name, Price FROM BOOKS ORDER BY Price ASC;
3. To increase the price of all books of EPB publishers by 50.
UPDATE BOOKS SET Price =Price+50 WHERE Publishers=’EPB’;

4. To display the Book Name, Quantity_Issued and Price for all books of EPB publishers.
SELECT Book_Name, Quantitiy_Issued, Price
FROM BOOKS B, ISSUED I
WHERE B.Book_Id=I.Book_Id and Publishers=’EPB’;
5. To Find the maximum price for each publisher.
SELECT MAX(Price) FROM BOOKS GROUP BY Publisher;
6. To display the sum of quantities for each type of book.
SELECT SUM(Quantity) FROM BOOKS GROUP BY Type;
7. Write SQL query to find the sum of Quantity_Issued for each type of Book.
SELECT SUM(Quantity_Issued)
FROM BOOKS B, ISSUED I
WHERE B.Book_Id=I.Book_Id
GROUP BY Type;

You might also like