0% found this document useful (0 votes)
142 views13 pages

QUESTIONs For COMPUTER SCIENCE PRACTICALS

Uploaded by

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

QUESTIONs For COMPUTER SCIENCE PRACTICALS

Uploaded by

mailmemaxredeem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

SET A

1. Write a python program to read a text file line by line and display each word
separated by '#'. (8)
2. Write SQL queries to do the following: Table:Student (4)

(a) Display name of female students in Hindi department


(b) Display name of the students whose ages are between 18 to 20.
(c) Display the name of the students whose name is starting with 'a'
(d) Display name of those students whose name have second alphabet 'n' in their
names.
SET B
1. Creating a python program to read a text file and display the number of vowels/
consonants/lower case/ upper case characters. (8)
2. Write SQL Queries for the following Queries: Table: Employee (4)
EmpNo EmpName Dept Salary Designation
150 Arnav Marketing 45000 Executive
134 Bharathi Sales 35000 Executive
167 Chandru Marketing 38500 Asst. Manager
195 Dithya Null 37000 Manager
208 Feroz Sales 60000 Manager

a) Display the details of Employees in ascending order of EmpNo.


b) Display all the department names without repetition.
c) Display the name of the employee whose salary between 30000 and 45000 in
the table.
d) Display the name of the employee for whom Department is not assigned.
SET C
1. Write a python program to display short words (less than 4 ) from a text file. (8)
2. Write SQL Queries for the following Queries: Table: Employee (4)
PROD_ID PROD_NAME PRICE COMPANY TYPE
P001 Mouse 200 LOGITECH INPUT
P002 Laser Printer 4000 CANON OUTPUT
P003 Keyboard 500 LOGITECH INPUT
P004 Joystick 1000 IBALL INPUT
P005 Speaker 1200 CREATIVE OUTPUT

a) Display the details of Maximum and Minimum price of products.


b) Display the product details price in the range of 400 to 1200
c) Display the total price of the product each company wise.
d) Display the product details in descending order of Price
SET D
1. Write a python program to display lines that starts with ‘A’ from a text file. (8)
2. Write sql queries for the following table. Table: Student (4)
ROLLNO NAME CLASS DOB GENDE CITY MARKS
R
1 Nanda X 1995-06-06 M Agra 551
2 Saurabh XII 1993-05-07 M Mumbai 462
3 Sonal XI 1994-05-06 F Delhi 400
4 Trisla XII 1995-08-08 F Mumbai 450
5 Hari XII 1995-10-08 M Chennai 500
6 Neha X 1995-12-08 F Bangalore 377
7 Nishanth XI 1995-06-12 M Delhi 489
i) To display name, class who have scored more than 450 marks, class wise
ii) To increase the marks of student by 5 whose city is Delhi
iii) To Delete the record of students whose mark is less than 400
iv) To display the name, class, marks of students whose name starting with N
SET E
1. Creating a python program to read a text file and display the number of vowels/
consonants/lower case/ upper case characters. (8)

2. Write sql queries for the following table. TABLE : HOSIPTAL (4)
NO NAME AGE DEPARTMENT DOA CHARGES SEX
1 SANDEEP 65 SURGERY 23/02/98 300 M
2 RAVINA 24 ORTHOPEDIC 20/01/98 200 F
3 KARAN 45 ORTHOPEDIC 19/02/98 200 M
4 TARUN 12 SURGERY 01/04/98 300 M
5 ZUBIN 36 ENT 12/02/98 250 M
6 KETAKI 16 ENT 24/02/98 300 F
7 ANKITA 29 CARDIOLOGY 20/02/98 800 F

i) To List all the information of patients of ENT department.


ii) To list the names of all patients with date of admission in descending order
iii) To display the total number of patients gender wise
iv) To add new column named contact number of integer data type
SET F
1. Write a program in python that defines and calls the following user defined
functions: (8)
The structure of peripheral.csv is: [p_id, p_name, price]
Add_device( ) : to accept a record from the user and add it to a csv file,
peripheral.csv
Count_device( ) : to count and display number of peripheral devices whose price is
less than 1000.
2. Consider the table INTERIORS given below. Write commands in MySQL for (i) to (iv).
(4)

INTERIORS
No ItemName Type DateofStock Price
1 Red Rose Double Bed 23/02/2009 16000
2 Soft Touch Baby cot 25/09/2010 11000
3 Lion King Office Table 30/03/2010 5000
4 Royal Tiger Office Table 15/09/2010 7000
5 Park Sitting Sofa 15/10/2011 8000
6 Dine Paradise Dining Table 19/03/2011 9000
i. To list the ItemName whose Type is Office Table.
ii. To display a report listing ItemName, Type and Price in descending
order of Price.
iii. To count the number of ItemName.
iv. To insert a new row in the table INTERIORS.
7, ‘Comfort Zone’,’Double Bed’,’23/03/2011′, 15000
SET G
1. Write a python program to create a binary file with roll number and name.
Search for a given roll number and display the name, if not found display
appropriate message. (8)
2. Consider the table PRODUCT given below. Write commands in MySQL for (a) to
(d) . (4)

PRODUCT
No Product_Name Brand_Name Qty Price
1 Mixer Grinder Maharaja 5 1250
2 Washing Machine Whirlpool 10 8500
3 Microwave Oven Philips 6 8700
4 Vacuum Cleaner Eureka Forbs 2 7400
5 Dish Washer Maharaja 5 12500

a. To list the ProductName where BrandName is Maharaja.


b. To display a report ProductName and BrandName and
Price in descending order of price.
c. To count the number of ProductName.
d. To insert a new row in the table
PRODUCT. 6, ‘Gas Stove’,’Maharaja’,7,
6150
SET H
1. Write a program in Python that defines and calls the following user defined
functions: The structure of 'courier.csv' is: cid, s_name, Source, destination
(i) COURIER_ADD() : It takes the values from the user and adds the
details to a csv file 'courier.csv'.
(ii) COURIER_SEARCH() : Takes the destination as the input and displays
all the courier records going to that destination. (8)
2 Consider the table STUDENT given below. Write commands in MySQL for (1) to (4). (4)

STUDENT
No Name Class Stream Aggmarks Grade
1 Anubhav Gupta XII Science 84 A2
2 Prateek Jaiswal XII Commerce 92 A1
3 Amit Agarwal XI Commerce 76 B1
4 Mayank Agarwal XII Humanities 85 A2
5 Shaileb Khandelwal XI Commerce 89 A2
6 Junius Pereira XII Science 84 A2

1. To list the StudentName of Science Stream.


2. To display a report listing StudentName, Class and Stream in
ascending order of StudentName.
3. To count the number of students to Science Stream.
4. To insert a new row in the table STUDENT.
7, ‘Simran Kaur’,’X!l’, ‘Commerce’, 86, ‘A2’
SET I
1. Write a python program to get student data (rollno, name, marks) from user
and write onto a binary file. The program should be able to get data from the
user and write onto the file as long as the user wants. (8)
2. Consider the following table FITNESS with details about fitness (4)
products being sold in the store. Write command of SQL for (i) to
(iv).
FITNESS
PCODE PNAME PRICE MANUFACTURE
P1 TreadMill 21000 Coscore
P2 Bike 20000 Aone
P3 Cross Trainer 14000 Reliable
P4 Multi Gym 34000 Coscore
P5 Massage Chair 5500 Regrosene
P6 Belly Vibrator 6500 Ambaway
Belt
a. To display the names of all the products with price more than 20000.
b. To display the names of all products by the manufacturer ‘Aone’.
c. To change the price data of all the products by applying
25% discount reduction.
d. To add a new row for product with the details: ‘P7’, ‘Vibro
Exerciser’, 28000, ‘Aone’.
SET J
1. Write a Python Program that has a list containing 10 Integers. You create a
program with separate user defined Functions to perform the following
operations based on this list.
Traverse the content of the list and push the ODD numbers into
a Stack.
Pop and display the content of the stack.
(8)
2.Write SQL queries to do the following: Table:Student (4)

(a) Display name of female students in History department


(b) Display name of the students whose ages are between 22 to 32.
(c) Display the name of the students whose name is starting with 'D'
(d) Display name of those students whose name have second alphabet 'a' in their
names.
SET K
1. Write the following user defined functions to perform given operations On the
stack named “Hotel”.
(i) Push_Cust()-To push customer’s names of those customers who are
staying in “Delux” Room type.
(ii) Pop_Cust()-To pop the names of customers from the stack and display
them. Also, display “underflow” when there are no customers in the stack.
(8)
2. Write SQL Queries for the following Queries: Table: Employee (4)
EmpNo EmpName Dept Salary Designation
150 Arnav Marketing 45000 Executive
134 Bharathi Sales 35000 Executive
167 Chandru Marketing 38500 Asst. Manager
195 Dithya Null 37000 Manager
208 Feroz Sales 60000 Manager

a) Display the details of Employees in ascending order of EmpName.


b) Display all the Designation without repetition.
c) Display the name of the employee whose salary between 40000 and 60000
in the table.
d) Display the name of the employee for whom Department is not assigned.
SET L
1. Write a code in Python to display all the details of the passengers from the table flight
in MySQL database Travel. The table contains the following attibutes: (8)
F_Code-Flight code (String)
F_Name-Name of the
Flight(String)
Source-Departure City of Flight
(String) Destination-Destination City
of Flight (String)
Consider the following to establish connectivity between Python
and MySQL.
Username:root,Password:airplane,Host:localhost Table: FLIGHT
(4)
FLIGHT
F_CODE F_NAME SOURCE DESTINATION
F101 Indigo Delhi Chennai
F102 Etihad Delhi Bengaluru
F103 Qatar Airways Mumbai Chennai
F104 Kingfisher Delhi Mumbai
F105 Emirates Mumbai Bengaluru
2. Consider the above table FLIGHT.
Write Commands in MYSQL for i to iv.
(i) Display all the records based on the column source which are having
exactly 5 characters in their name.
(ii)Define new column Fare with the type
integer.
(iii)Update Fare column for all the records.
(iv)Display the least Fare value from the table
Flight.

You might also like