0% found this document useful (0 votes)
43 views

CBSE Computer Science Practical Practice SET 4

1. The document describes a Python function to shift all elements of a list to the left by a given number. It provides sample input and output. 2. It also describes creating a CSV file with person details from user input and displaying details of persons living in Jaipur by calling appropriate functions. 3. The document then describes SQL queries on book and issue tables - to list book names of a type, order books by price, increase price of some books, display details for certain publishers, find maximum price per publisher, and sum issued quantities per book type.

Uploaded by

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

CBSE Computer Science Practical Practice SET 4

1. The document describes a Python function to shift all elements of a list to the left by a given number. It provides sample input and output. 2. It also describes creating a CSV file with person details from user input and displaying details of persons living in Jaipur by calling appropriate functions. 3. The document then describes SQL queries on book and issue tables - to list book names of a type, order books by price, increase price of some books, display details for certain publishers, find maximum price per publisher, and sum issued quantities per book type.

Uploaded by

larishaupadhyaya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy