SET-1_IP_MS_PB2
SET-1_IP_MS_PB2
SECTION A
Q M
1 State whether the following statement is True or False 1
Series is one dimensional array
True
2 In the sales table, with attributes sale_id, salesperson_id, sales_amount, and 1
product_price.
Which SQL query correctly retrieves the total sales made by each salesperson for
products priced higher than 100 Rs, while excluding salespeople who have made
fewer than 5 sales?
Ans.
import pandas as pd
dt = [134, 67, 56]
sr = pd.Series([1, 2, 3],dt)
print(sr.head(2))
The corrected version uses `pd` as an alias for `pandas` while creating a Pandas
Series.The output will be the first two elements of the Series:
134 1
67 2
dtype: int64
23 What are browser add ons? Provide the name of two web browsers that support add 2
ons.
Ans. Browser add-ons, also known as extensions or plugins, are small software
programs that enhance the functionality of web browsers. They allow users to
customise and add features to their browsing experience.
All modern and specifically desktop web browsers supports add-ons like Mozilla
Firefox,Google Chrome, MS Edge,Opera,Safari etc.
OR
Differentiate between a Static and Dynamic Website.
Ans.
Aspect Static Website Dynamic Website
Harder to customize
Easier to customize content
Customization content without editing
using templates/data.
code.
Ans.
A. SELECT YEAR(‘2020-09-13’);
B. SELECT MONTHNAME(‘2020-09-13’);
27 What is the difference between copyright and Patent? 2
Ans.
(1+1 mark for each correct difference.)
28 Ans: 2
i) The index labels of df will include amit, kajal, ramesh, lalta, prakash
# 1 Mark
ii) pt1 pt2
kajal 27.0 34.0 # ½ mark
ramesh 37.0 NaN # ½ mark
OR
Ans:
import pandas as pd
ser3 = pd.Series(50, index=range(1, 9, 2))
print(ser3)
SECTION C
29 Ans. 3
1. Cyberbullying and harassment.
2. Document evidence, report to authorities, seek platform assistance.
3. Yes, under the Information Technology (IT) Act, 2000 (amended in 2008).
OR
1. Reduced physical activity: Excessive social media use can lead to a sedentary
lifestyle, contributing to obesity and related health issues.
2. Sleep disturbances: Constant engagement with social platforms can disrupt sleep
patterns, leading to insomnia or poor sleep quality.
3. Increased stress and anxiety: Exposure to unrealistic standards and negative
content on social media can exacerbate stress and anxiety levels.
4. Social isolation: Paradoxically, excessive online connectivity may lead to feelings
of isolation and detachment from real-life social interactions.
5. Comparison and self-esteem issues: Constant comparison with curated online
personas can negatively impact self-esteem and body image, leading to feelings of
inadequacy or dissatisfaction.
30 import pandas as pd 3
file_path = '/home/user/Music/J-Pop/j-pop-20.csv'
df_jpop = pd.read_csv(file_path, header=0)
print(df_jpop.head(3))
31 Write MySQL statements to create the table Artist_Info with following specifications: 3
Ans.
CREATE TABLE Artist_Info (
ArtistID INT PRIMARY KEY,
ArtistName VARCHAR(100),
Nationality VARCHAR(50) NOT NULL
);
Degree:03 Cardinality: 07
Page 6 of 12
32 Ans. 3
1.
SELECT Genre, COUNT(*) AS NumberOfBooks
FROM Books_of_India
GROUP BY Genre;
(Without AS also acceptable)
2.
SELECT Genre, MAX(Copis_sold_in_lacs) AS TotalCopiesSold
FROM Books_of_India
GROUP BY Genre
HAVING COUNT(*) > 1;
(Without AS also acceptable)
3.
SELECT *
FROM Books_of_India
ORDER BY ID;
OR
Ans.
1.
INSTR(Title,"The")
2.
Title copies_sold_in_th
3.
TOTAL
55
SECTION D
33 (i) import 4
(ii) bar
(iii) plt.ylabel(‘PERCENTAGE’)
(iv) plt.savefig(‘Result.png’)
OR
import matplotlib.pyplot as plt
Year = [2017,2018,2019,2022,2021]
Gross =[17,15.5,11.4,12.1,14.9]
plt.plot(Year,Gross)
plt.show()
(1 mark for each correct statement)
Page 7 of 12
34 Ans: 4
a) SELECT MIN(MARKS), MAX(MARKS) FROM RESULT WHERE GENDER=’F’; ( 1
mark)
b) SELECT DISTINCT(CITY) FROM RESULT; ( 1 mark)
c) SELECT CITY, AVG(MARKS) FROM RESULT GROUP BY CITY; (1 mark)
d) SELECT CLASS, SUM(MARKS) FROM RESULT GROUP BY CLASS;( 1 mark)
OR
Ans.
1. SELECT YEAR(AdmissionDate)-YEAR(BirthDate) AS Age
FROM PATIENT_REC;
2. SELECT SUM(HospitalCost)
FROM PATIENT_REC
WHERE TreatmentDuration > 10;`
3. SELECT MIN(TreatmentDuration), MAX(TreatmentDuration)
FROM PATIENT_REC
WHERE YEAR(BirthDate) = 2005;