Comp Rec Qs
Comp Rec Qs
A menu driven program in Python that accepts a number and displays the
following
options:
(a) Pass number as argument and check if it is an Armstrong number or not.
(b) Pass number as argument and check if it is Perfect number or not.
'''
'''3. A Python program implementing user defined function to find the duplicate
elements in
a list given by the user.
'''
'''4. A Python program implementing user defined function that accepts a list as
argument and
display all the prime numbers in the list.
'''
'''5. Python program that accepts ‘n’ integers to a tuple and returns all the even
numbers
divisible by 7.
'''
'''7. Python program to read a text file ‘story.txt’ and display the number of
vowels,
consonants, digits, lower-case, upper-case characters.
'''
'''8. Python program to read a text file ‘Details.txt’ and display the longest word
in the file.
Also display the words ending with lowercase vowels in the file.
'''
'''9. Python program to copy the lines that starts with ‘The’ from a text file into
another text
file ‘Copy.txt’. The name of the text file should be entered by the user at run
time.
'''
'''10. A binary file ‘company.dat’ stores following information about the employees
of a
company [EMPID, ENAME, BASIC, HRA, PF, NETPAY]. HRA is calculates as 5% of
BASIC, PF is 20% of BASIC, NETPAY is calculated as BASIC + HRA – PF.
Write a Python program implementing function Del_details() that deletes the details
of
the Employee whose name is entered by the user.
'''
'''11. Write a Python program to store the festivals of various states to a binary
file
‘Festivals.dat’ in the following format:
Festival ={State_name: [festival_name, tourist_destination]}
Use a menu driven program to:
• Store the festivals, tourist_destination of 5 states.
• Display the name of the festival, tourist_destination if the state_name is
entered.
• Add festivals, tourist_destination of 3 more states.
• Display all the records.
'''
'''12. Create a python program to add and update/modify records in binary file
‘OPTION.DAT’
having the following structure {Name: [Game, SUPW]}
(i) Add ‘n’ records to the table
(ii) Modify the Game if the name of a student is entered
'''
'''13. Write a Python program to store the details of flights in a binary file
‘Flight.dat’ in the
following format:
Flight_Record ={Flight_no: [From, Destination, Arrival, Departure]}
Use a menu driven program to:
• Display the details of the flight if the Flight_No is entered.
• Update the flight’s arrival time or departure time
• Delete the details of the Flight if the Flight_No is entered
• Display all the details of Flights ‘From’ Delhi.
'''
'''14. Creating a python program that defines and calls the following user defined
functions:
(i) Add_Book() : Takes the details of the books and adds them to CSV FILE
‘Book.csv’. Each record consists of a list with fields Book_id, BName,
Publisher.
(ii) Search() : Takes Publisher name as argument and counts and displays number
of books published by them.
'''
'''19. Write a Python program to do the following using the table STORE:
(a) Change the quantity of given item, if the Item_No and new quantity is entered
by the
user.
(b) Display all the records in descending order of item_no.
'''
'''20. Write a Python program to delete the record whose Scode is 21 and display
the remaining
records in the table STORE.
Also, display the total number of records in the table.
Item_no ItemName Scode Quantity
101 Sharpener Classic 23 60
103 Ball Pen 0.25 22 50
102 Gel Pen Premium 21 150
104 Gel Pen Classic 21 250
'''
'''21. Write SQL commands and their outputs based on the given tables:
Table: MOVIE_DETAILS
MOVIEID TITLE LANGUAGE RATING PLATFORM
M001 Minari Korean 5 Netflix
M004 Spiderman, No way Home English 4 Hotstar
M010 Kaagaz Hindi 3 Zee5
M011 Harry Potter and the Chamber of Secrets English 4 Prime Video
M015 2018 Malayalam 5 Hotstar
M020 Avengers: Endgame English 4 Hotstar
M019 The Magician' Elephant English 3 Disney
Table: SCHEDULE
SLOTID MOVIEID TIMESLOT
S001 M010 10 AM
S002 M020 2 PM
S003 M010 6 PM
S004 M011 9 PM
S005 M019 NULL
1. Create the Table MOVIE_DETAILS with the following specifications
MOVIEID char(5) set as Primary key,
TITLE varchar(25) set as not null,
LANGUAGE varchar(10)
RATING integer
PLATFORM varchar(10)
2. Add a record ‘M011’, ‘Harry Potter and the Chamber of Secrets’, English, 4,
Prime Video to
the table MOVIE_DETAILS.
3. Display the structure of the table MOVIE_DETAILS.
4. Display the number of languages without redundancy.
5. Display the MovieID, MovieNames, Language of movies with rating 4
6. Display the names of the platforms without redundancy.
7. Display the names of the Platform with the letter ‘s’ in it.
8. Display the names of the movies in descending order of rating.
9. Display the minimum & maximum rating of movies.
10. Display the movieid, moviename, timeslot of movies in the platform ‘Hotstar’.
11. Count the total number of movies under each rating.
12. Display the Slotid,movieid, moviename of movies that is scheduled in the
afternoon
13. Change the Platform of M004 to “Prime Video”.
14. Display the details of MovieID, SlotID whose Timeslot is not NULL.
15. Add a column Moviedt of date type to the table SCHEDULE.
16. Delete the movie from the Korean Language.
17. Set the Column SLOTID in the table SCHEDULE as Primary Key.
18. Make MOVIEID in SCHEDULE table as the foreign key with reference to
MOVIE_DETAILS
table.
19. Delete the table SCHEDULE.
20. Delete the database.
'''