0% found this document useful (0 votes)
5 views5 pages

Practical QP

The document consists of multiple sets of programming and SQL exercises, including tasks for Python programming and SQL queries related to various tables such as Teacher, INTERIORS, HOSPITAL, Watches, and Customer. Each set contains specific problems that require writing code or SQL commands to manipulate and retrieve data. The exercises cover topics like file handling, data analysis, and database management.

Uploaded by

sarahabraham2708
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)
5 views5 pages

Practical QP

The document consists of multiple sets of programming and SQL exercises, including tasks for Python programming and SQL queries related to various tables such as Teacher, INTERIORS, HOSPITAL, Watches, and Customer. Each set contains specific problems that require writing code or SQL commands to manipulate and retrieve data. The exercises cover topics like file handling, data analysis, and database management.

Uploaded by

sarahabraham2708
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/ 5

SET-I

1. (a) Write a Python program to read a text file and display the number of vowels, consonants,
uppercase, lowercase characters in the file.(4M)

(b) Write a python Program to check if the entered number is Armstrong or not. (4M)

2. Given the following Teacher relation: Write SQL commands for question (a) to (d)
No. Name Department Dateofjoining Salary Sex
1. Raja Computer 21/05/98 80000 M
2. Sangita History 21/05/97 9000 F
3. Ritu Sociology 29/08/98 8000 F
4. Kumar Linguistics 13/06/96 10000 M
5. Venkatraman History 31/10/99 8000 M
6. Sidhu Computer 21/05/86 14000 M
7. Aishwarya Sociology 11/1/98 12000 F
(a) To select all the information of teacher in computer department.
(b) To list the name of the female teacher in History department.
(c) To insert a new record in the Teachers table with the following data:
8, “Mersa”, “Computer”, {1/1/2000}, 12000, “M”.
(d) To display Teacher’s name, Department, and Salary of female teachers.

3. Record (7M)
4. Project (8M)
5. Viva-Voice (3M)
SET-II
1. (a) Write a Python program to read a text file line by line and display each word separated
by a “--” (4M)

(b) Write a Program to enter the numbers in a list and to show the greatest element using
#loop in the entered list.(4M)
2. Given the following tables for a database INTERIORS: .(4M)
Note: Write SQL command for (a) to (d) INTERIORS and NEWONES. Table: INTERIORS
NO. ITEMNAME TYPE DATEOFSTOCK PRICE DISCOUNT
1 Red rose Double bed 23/02/02 32000 15
2 Soft touch Baby cot 20/01/02 9000 10
3 Jerry’s home Baby cot 19/02/02 8500 10
4 Rough wood Office Table 01/01/02 20000 20
5 Comfort zone Double bed 12/01/02 15000 20
6 Jerry look Baby cot 24/02/02 7000 19
7 Lion king Office Table 20/02/02 16000 20
8 Royal tiger Sofa 22/02/02 30000 25
9 Park sitting Sofa 13/12/01 9000 15
10 Dine Paradise Dining Table 19/02/02 11000 15
Table: NEWONES
NO. ITEMNAME TYPE DATEOFSTOCKS PRICE DISCOUNT
11 White wood Double bed 23/03/03 20000 20
12 James 007 Sofa 20/02/03 15000 15
13 Tom look Baby cot 21/02/13 7000 10

(a)To show all information about the sofas from the INTERIORS table.
(b) To list the ITEMNAME which are priced at more than 10,000 from the INTERIORS table.
(c) To list ITEMNAME and TYPE of those items, in which DATEOFSTOCK is before 22/01/02 from
the INTERIORS table in the descending order of ITEMNAME.
(d) To display ITEMNAME and DATEOFSTOCK of those items, in which the discount percentage is
more than 15 from INTERIORS table.

3. Record (7M)
4. Project (8M)
5. Viva-Voice (3M)
SET-III
1. (a) Write a Python program to read a text file line by line and display each word separated by a
“#” (4M)

(b) Write a Program to enter the number of terms and to print the Fibonacci Series.
(4M)

2. Write SQL commands for (a) to (f) and Write the outputs for (g) on the basis of table HOSPITAL
(4M)
Table: HOSPITAL
No. Name Age Department Dateofadm Charges Sex
1 Arpit 62 Surgery 21/01/98 300 M
2 Zarina 22 ENT 12/12/97 250 F
3 Kareem 32 Orthopedic 19/02/98 200 M
4 Arun 12 Surgery 11/01/98 300 M
5 Zubin 30 ENT 24/02/98 250 M
6 Ketaki 16 ENT 12/01/98 250 M
7 Ankita 29 Cardiology 20/02/98 800 F
8 Zareen 45 Gynecology 22/02/98 300 F
9 Kush 19 Cardiology 13/01/98 800 M
10 Shilpa 23 Nuclear Medicine 21/02/98 400 F

(a) To select all the information of patients of cardiology department.


(b) To list the names of female patients who are in ENT department.
(c) To list name of all patients with their date of admission in ascending order.
(d) To display Patient’s Name, Charges, Age for only female patients.

3. Record (7M)
4. Project (8M)
5. Viva-Voice (3M)
SET-IV
1. (a) To read a text file and print all the lines those are starting with ‘T’ on the
screen (4M)

(b) Given an Integer n, find the reverse of its digits.


Input: n = 12345 Output: 54321. (4M)

2. Consider the tables given below


Watches
Id Wname Price Type Qty
W01 High Time 1200 Common 75
W02 Life line 1600 Gents 150
W03 Wave 780 Common 240
W04 Timer 950 Gents 460
W05 Golden era 1760 Ladies 250
WSale
Wid QSold Qtr
W01 25 1
W02 23 1
W03 2 1
W04 10 2
W05 12 2
W03 22 3
W04 22 3
W02 23 3
“Note: Consider the table contains the above records.”
A) Write the queries for the following:
i) To display the total quantity sold (qsold) of wsale for qtr number 3.
ii) To display the details of watches in descending order of qty.
iii) To display the total quantity of watches.
iv) To display the wname and maximum qsold from the table watches and wsale sold
in qtr=1

3. Record (7M)
4. Project (8M)
5. Viva-Voice (3M)
SET-V
1.
(a) Counting the number of occurrences of ‘is’ and ‘and ‘ in a text file (4M)
(b) Write a Program to print the following Pattern (4M)
1
22
333
4444
55555
2. Observe the following tables customers and orders and write queries given below:
Table - Customer 4
CustomerID CustomerName City MobileNo
C111 Abhishek Ahmedabad 9999999999
C132 Bhavik Anand 7799779977
C135 Chandani Baroda 8856895485
C145 Dhara Ahmedabad 7456879652
C121 Divya Anand 9015123569
Table - Order
OrderID OrderDate OrderAmt CustomerID
O111 2022-04-15 1500 C111
O112 2022-05-20 1800 C121
O113 2022-05-31 1000 C199
O131 2022-06-12 1400 C135
(i) Display CustomerID, CustomerName and bill amount for customers belongs to Ahmedabad.
(ii) Display the order details in descending order of amount.
(iii) Display OrderId, Orderdate , customername and mobileno of customers whose name ends
with ‘k’ and name contains letter ‘h’.
(iv) Display the sum of order amount for each city.
3. Record (7M)
4. Project (8M)
5. Viva-Voice (3M)

You might also like