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

CFE

The document contains programming tasks involving Python and SQL, including creating bar graphs, dataframes, and executing SQL queries on various tables. It requires writing code for visualizing student marks, sales data, and customer bills, as well as manipulating data in SQL tables for orders, games, and employee records. The tasks are structured in a question and answer format, focusing on data analysis and visualization using Pandas and Matplotlib.

Uploaded by

Deep Malaviya
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)
28 views5 pages

CFE

The document contains programming tasks involving Python and SQL, including creating bar graphs, dataframes, and executing SQL queries on various tables. It requires writing code for visualizing student marks, sales data, and customer bills, as well as manipulating data in SQL tables for orders, games, and employee records. The tasks are structured in a question and answer format, focusing on data analysis and visualization using Pandas and Matplotlib.

Uploaded by

Deep Malaviya
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

Q.1 (A)Write a python code to draw a simple Bar graph using name and marks of 5 students.

Set Xlabel as “Names” and Ylables as “Marks” and Title as Result (4)

Name Marks
Hemant 78
Kesha 85
Sonia 55
Navya 47
Shesha 69
(B)Write a program to create dataframe from a list containing dictionary of sales (1)
Performance of four sales men each salesman as dictionary that have target and
Sales. Define the index values as sales men name.
(i)Add new column name city with values are [Bhopal,Delhi,Baroda,Noida] (1)
(ii) Display records of saleman whose sale more than 25500 (1)
(iii) Add new row in dataframe data like (“Siya”,90) (1)

Q.2 Solve following query in Mysql (7)


Table Order
Ono. Quantity Total Amt ODate Remark Product City
1001 25 268000 15/05/1996 Paid Asus M.B Surat
1002 20 338500 19/05/1996 Paid Mouse Pune
1003 08 148000 30/10/2010 No Asus M.B Mumbai
1004 15 220900 01/07/1999 Paid Keyboard Mumbai
1005 13 265800 15/08/2001 No Pen Drive Delhi
1006 07 150000 08/08/2002 Paid Mouse Surat

(1) Display the details of order whose total amount between 2 lack to 3 lack
(2)Display the total no. of quantity sale in each city.
(3)Remove the detail of order those not paid amount.
(4)Increase 5% on total price of Asus M.B
(5)Display detail of order that made after 15/8/2001
(6)Display the order details of mouse
(7)Display Order date and product based on total amount made
Q.1 (A)Write a python code to draw a simple Line graph of school result.
Set Xlabel as “Years” and Ylables as “Percentage” and Title as “School Result ” (4)

Years Percentage (%)


2015 98.5
2016 96.2
2017 95.8
2018 97.5
2019 99.5
(B)Write a python code to create a dataframe object by dictionary has given below. (1)
index Physics Chemistry English
Nayan 95 87 91
Shikha 84 86 86
Sunita 87 95 88
Kiya 86 93 94
Khushi 92 84 85

(ii)Write a code to create new column name “Total” as Total marks will display in the column. (1)
(iii) Insert new row in the dataframe data like (punit, 95, 88, 96) (1)
(iv) Display the Sunita’s record (1)
Q.2 Write a queries for the Table name: Game (7)
Student No Class Name Game Grade SUPW Grade1
10 7 Sameer Cricket B Photography A
11 8 Sujit Tennis A Gardening C
12 7 Kamal Swimming B Photography B
13 7 Veena Tennis C Cooking A
14 9 Archana Basketball A Literature A
15 10 Arpit Cricket A Gardening NULL

(1) Display the name of students getting grade ‘A’ in Cricket.


(2) Display the different games offered in the school.
(3) Display the SUPW taken up by the students, whose name starts with ‘A’.
(4) Display the students name whose no. between 12 to 15
(5) Display the class and students name whose grade1 not assign.
(6) Delete the records of all the students whose class is 7.
(7) Display the different total no. of games.
Q-1 Problem solving using PANDAS & MATPLOTLIB.
Write the code to create a DataFrame ‘df’ and answer the questions followed. (1)
Maths Science SST
Amit 100 100 60
Mohan 95 50 57.48
Sudha 85 90.0 53.58
Write a command to add one column Total=Maths+Sci+SST (1)
Write a command to add one row with alues 75.6,98.6,56.0 (1)
Write a command to record of student whose maths marks more than 90 (1)
Write a Python program to display the given Result table using a BarChart. (4)
Set the title of graph is “Result Analysyis”
Save graph with name score.jpg
Display the lale to x axix to “Name” and y axis SST SCORE.

Q-2 Write SQL command to create the following table named FASHION (7)
Inst_id Institute_name City Director_Name Fees NoofStudent Dofadmtest
A123 NIFT Delhi Naveen Singh 34000 234 2020-01-23
A345 NIFT Lucknow BabitaKumari 30000 125 2020-02-12
B321 NIS Bareily Mitrunjay 15600 405 2020-03-23
B567 NIS Chandigarh Sahil Sharma 16000 240 2020-01-15
C433 AMITY Lucknow Karan Kapoor 42000 120 2020-02-20
C532 AMITY Delhi Nishtha Roy 44000 230 2020-03-13
Write QUERIES FOR FOLLWING:
a) Show the institute id , institute name of those institute which are having test in March month.
b) Show the name of the director of institute which are situated in Delhi;
c) Show the average of the fees for each institute where average is greater than 30000.
d) Show the name of the institute which are situated in Lucknow but students are less than
orequal to 120.
e) Show the number of characters/length of Director’s name
f) Arrange the record descending order of fees.
g) Display director_Name whose second latter is ‘a’ in their name.
Q.1 Programming using Pandas and Matplotlib:
Write a program in Python Pandas to create the following DataFrame “CUSTOMER” (1)

Cname City Billamt Tran_date

1001 Shruti Ahmedabad 9500 2021-10-01

1002 Tushar Varodara 5300 2021-01-04

1003 Jay Surat 4550 2019-03-01

1004 Sameer Ahmedabad 4000 2019-04-01

1005 Mayank Surat 8500 2018-08-05

1006 Meena Varodara 4300 2018-08-06

1007 Dhairya Ahmedabad 3000 2019-10-10


Perform the following operations on the DataFrame :
a) Add a new column named discount which is 10% of their bill amount. (1)
b) Add a row with row index 1008 as Rohan, Bharuch, 6000, 2011-04-01. (1)
c) Display the details of Customer whose Billamount more than 7000. (1)
d) Now plot a bar chart depicting the customer’s name on x-axis and their corresponding bill amount on (4)
y-axis, with appropriate Graph title, x-axis title, y-axis title, gridlines and color etc.
Q.2 Create a Following table Employee and perform the queries
(7)

EmpID EmpFname EmpLname Department Project Address DOB Gender

1 Sanjay Mehra HR P1 Hyderabad(HYD) 1976/12/01 M


2 Ananya Mishra Admin P2 Delhi(DEL) 1968/05/02 F
3 Rohan Diwan Account P3 Mumbai(BOM) 1980/02/01 M
4 Sonia Kulkarni HR P1 Hyderabad(HYD) 1992/05/02 F
5 Ankit Kapoor Admin P2 Delhi(DEL) 1994/07/03 M
Write QUERIES FOR
1. Write a query to fetch the EmpFname from the Employee table in the upper case .
2. Write a query to fetch the number of employees working in the department ‘HR’.
3. Write a query to retrieve the first four characters of EmpLname from the Employee table.
4. Write a query to fetch only the detail of females whose address is Hyederabad.
5. Write a query to sort the table according to DOB highest to lowest.
6. Write an SQL query to print details of the Workers who have born in May ’1992.
7. Write and sql query to fetch empname Lastname ends with ‘a’.
Q.1.(A)Consider the following DataFrame saleDF & Write a code to create for it. (1)

Target Sales
zoneA 56000 5800
zoneB 70000 6800
zoneC 75000 7800
zoneD 60000 6100

I) Add new rows in the dataframe . (zoneE , 5200, 8500) (1)


II) Add a column namely Orders having values 6000, 6700, 6200, and 6000 respectively for the zones A,
B, C and D (1)
III) Display zones having sales greater than 7000 (1)

(B) Write Python code to draw the following bar graph representing the total sales in each
quarter. Add the Title, Label for X-axis and Y-axis. (4)

Q.2 Consider a table PRODUCT with the following data: (7)


Table : PRODUCT

S. No Item name Company Stock-date Price Discount


1 Monitor HP 2021-12-20 15499.739 15
2 Webcam Logitech 2020-02-03 4890.90 5
3 Keyboard Logitech 2022-08-19 1878-985 30
4 Mouse HCL 2021-05-16 1200.00 7
5 Speakers iBall 2021-10-19 NULL 25

Write SQL queries using SQL functions to perform the following operations:
(i) Create Table Product using appropriate datatypes.
(ii) Display the first 3 characters of all Item names.
(iii) Display the names of all items whose Stock day is "Monday".
(iv) Display the total price of all the products.
(v) Display the maximum Price.
(vi) Display the average Price of all the products by the company named 'Logitech'.

(vii) Add column GST with datatype float(12,2)

You might also like