End semester Answer key format-fods
End semester Answer key format-fods
P Code: 100114
JAI SHRIRAM ENGINEERING COLLEGE
An Autonomous Institution
B.E / B.Tech Degree Examinations Nov/ Dec – 2024
Answer key
Part – A
10 x 2 = 20
1. Question: Identify the importance of project charter.
Answer:
A project charter authorizes a project, defines objectives, scope, and stakeholder roles,
ensuring alignment and clarity. It acts as a reference document throughout the project
lifecycle.
Scheme of Evaluation
Part – B
5 X 13 = 65
15. b) .
Part – C
1 X 15 = 15
16. a) You have been provided with a CSV file named "sales_data.csv" that contains
sales data for acompany. The file has the following columns: "Date", "Product",
"Quantity", and" Revenue". Your task is to load the data into a pandas Data Frame
and perform the following analysis.
Each 3 marks
i. Calculate the total revenue generated by the company.
ii. Find the product that generated the highest revenue.
iii. Calculate the average quantity sold per day.
iv. Group the data by month and calculate the total revenue for each month.
v. Plot a line graph showing the monthly revenue over time.
Answer
Python program
import pandas as pd
import matplotlib.pyplot as plt
# iv. Group the data by month and calculate the total revenue for each month
df['Month'] = df['Date'].dt.to_period('M') # Group by month
monthly_revenue = df.groupby('Month')['Revenue'].sum()
OR
b) Develop an example for contour plot,histogram,3D plotting and line plot for
Matplotlib.
Answer
# 1. Contour Plot
ax1 = fig.add_subplot(2, 2, 1)
contour = ax1.contour(X, Y, Z, levels=10, cmap='viridis')
fig.colorbar(contour, ax=ax1)
ax1.set_title('Contour Plot')
ax1.set_xlabel('X-axis')
ax1.set_ylabel('Y-axis')
# 2. Histogram
ax2 = fig.add_subplot(2, 2, 2)
ax2.hist(data, bins=30, color='blue', alpha=0.7, edgecolor='black')
ax2.set_title('Histogram')
ax2.set_xlabel('Data')
ax2.set_ylabel('Frequency')
# 3. 3D Plot
ax3 = fig.add_subplot(2, 2, 3, projection='3d')
ax3.plot_surface(X, Y, Z, cmap='viridis', edgecolor='none')
ax3.set_title('3D Surface Plot')
ax3.set_xlabel('X-axis')
ax3.set_ylabel('Y-axis')
ax3.set_zlabel('Z-axis')
# 4. Line Plot
ax4 = fig.add_subplot(2, 2, 4)
ax4.plot(x_line, y_line, label='sin(x)', color='red', linewidth=2)
ax4.set_title('Line Plot')
ax4.set_xlabel('X-axis')
ax4.set_ylabel('Y-axis')
ax4.legend()
ax4.grid(True)