Page 36 - ipp11
P. 36
(b) (i) CREATE DATABASE SUPERMARKET;
(ii) USE SUPERMARKET;
(iii) DESCRIBE PRODUCTS;
31. Consider the following table. (3)
Table: HOTEL_BOOKING
Room_No Guest_Name Room_Type Price Check_In
1001 Rakesh Malhotra Deluxe 5000 2025-03-10
1002 Aisha Khan Standard 3000 2025-03-12
1003 Vineet Singh Suite 10000 2025-03-15
1004 Shikha Sharma Deluxe 5000 2025-03-18
1005 Mohan Chawla Standard 3000 2025-03-20
(a) Write a query to display guest names and their respective room types whose price is more than 4500.
(b) Write a query to display the details of guests staying in Deluxe rooms.
(c) Write a query to display guest names who checked in after March 15, 2025.
Ans. (a) SELECT GUEST_NAME, ROOM_TYPE FROM HOTEL_BOOKING WHERE PRICE>4500;
(b) SELECT * FROM HOTEL_BOOKING WHERE ROOM_TYPE = 'DELUXE';
(c) SELECT GUEST_NAME FROM HOTEL_BOOKING WHERE CHECK_IN < '2025-03-15';
SECTION D (4 × 4 = 16 Marks)
32. (a) Write a Python program to check whether a number given by the user is a palindrome or not. (4)
OR
(b) Write a menu-driven Python program to calculate the volume of different shapes, take required inputs,
display results and use looping and conditional statements until the user selects Exit.
The menu should display the following:
(i) Volume of a Cube
(ii) Volume of a Sphere
(iii) Volume of a Cylinder
(iv) Volume of a Cone
(v) Exit
Ans. (a) num = int(input("Enter a number: "))
n = num
rev = 0
while num > 0:
digit = num % 10
rev = rev * 10 + digit
num = num // 10
if n == rev:
print(n, "is a Palindrome.")
else:
print(n, "is not a Palindrome.")
OR
(b) while True:
print("\nMenu:")
print("1. Volume of a Cube")
print("2. Volume of a Sphere")
print("3. Volume of a Cylinder")
print("4. Volume of a Cone")
print("5. Exit")
choice = int(input("Enter your choice (1-5): "))
pi = 3.1416
M.6