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

A12 Answer

The document contains a series of programming and database-related exercises, including tasks involving Python's pandas library, SQL queries, and data visualization using matplotlib. It covers topics such as digital footprints, aggregate functions, and database creation. Each section includes specific tasks with marks allocated for correct answers and outputs.
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)
20 views5 pages

A12 Answer

The document contains a series of programming and database-related exercises, including tasks involving Python's pandas library, SQL queries, and data visualization using matplotlib. It covers topics such as digital footprints, aggregate functions, and database creation. Each section includes specific tasks with marks allocated for correct answers and outputs.
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

20.

import pandas as pd 2
df ={"Technology":["Programming","Robotics","3D
Printing"],"Time(in months)":[4,4,3]}
df= pd.DataFrame(df)
print(df)
(1/2 mark for each correction)

21. i. SELECT INSTR("12#All the Best!","the"); 2


ii. SELECT RIGHT("12#All the Best!",5);
(1 mark for each correct query)

22. 0 -10 2
1 -20
2 -30
3 -10
4 -20
5 -30
(2 marks for correct output)

23. Active Digital Footprints: Active digital footprints include data that we 2
intentionally submit online. This would include emails we write, or responses or
posts we make on different websites or mobile Apps, etc.
Passive Digital Footprints: The digital data trail we leave online
unintentionally is called passive digital footprints. This includes the data
generated when we visit a website, use a mobile App, browse Internet, etc.
(2 marks for correct differentiation)

24. import pandas as pd 2


di = {'Corbett': 'Uttarakhand', 'Sariska':'Rajasthan', 'Kanha': 'Madhya
Pradesh','Gir':'Gujarat'}
NP = pd.Series( di)
print(NP[ 'Sariska'])
(1/2 mark for each correct fill-up)

25. Aggregate functions: These are also called multiple row functions. These 2
functions work on a set of records as a whole, and return a single value for each
column of the records on which the function is applied.

Max(), Min(), Avg(), Sum(), Count() and Count(*) are few examples of multiple
row functions.
(1 mark for correct explanation)
(½ mark each for two correct names)
SECTION C
26. i. SELECT FUEL, AVG(QT1) FROM CAR_SALES GROUP BY FUEL; 3
ii. SELECT SEGMENT, MAX(QT2) FROM CAR_SALES GROUP BY
SEGMENT;
iii. SELECT * FROM CAR_SALES ORDER BY QT2 DESC;
(1 mark for each correct query)
OR
i.
+-----------------+
| LEFT(SEGMENT,2) |
+-----------------+
| Co |
| MU |
| SU |
| Se |
+-----------------+
ii.
+------------+
| AVG SALE |
+------------+
| 13500.0000 |
| 6000.0000 |
+------------+
iii.
+----------+
| TOT SALE |
+----------+
| 67000 |
+----------+
(1 mark each correct output)

27. import pandas as pd #Statement 1 3


df=[["Divya","HR",95000],["Mamta","Marketing",97000
],["Payal","IT",980000], ["Deepak","Sales",79000]]
#Statement 2
df=pd.DataFrame(df,columns=["Name","Department",
"Salary"])#Statement 3
print(df) #Statement 4
(#Statement 1 & 4 – ½ mark each)
(#Statement 2 & 3 – 1 mark each)
28. i. CREATE DATABASE FOOD; 3
(1 mark for correct answer)
ii. CREATE TABLE NUTRIENTS(NAME VARCHAR(20) PRIMARY
KEY,CALORIES INTEGER);

(½ mark for CREATE TABLE NUTRIENTS


½ mark each for correctly specifying each column
½ mark for correctly specifying primary key)

29. i. She is a victim of Cyber Bullying. 3


ii. Information Technology Act, 2000 (also known as IT Act).
iii. a. Need to be careful while befriending unknown people on the
internet.
b. Never share personal credentials like username and password with
others.
(1 mark for each correct answer)
OR
Simran needs to be made aware of the following consequences:
i) Eye strain ii) Painful muscles and joints iii) Poor memory
iv) Lack of sleep v) Back pain and neck pain
(1 mark each for writing any 3 correct health hazards)

30. i. Genre["Num_Copies"]=[300,290,450,760] 3
ii. Genre.loc[4]=["Folk Tale","FT",600]
iii.Genre=Genre.rename({"Code":"Book_Code"},
axis=1)
OR
Genre=Genre.rename({"Code":"Book_Code"},
axis="columns")
(1 mark for each correct statement)

SECTION D

31. i. SELECT YEAR(MIN(TRANSACTION_DATE)) FROM 4


BLOCKCHAIN;
ii. SELECT MONTH(MAX(TRANSACTION_DATE)) FROM
BLOCKCHAIN;
iii. SELECT * FROM BLOCKCHAIN WHERE MONTHNAME
(TRANSACTION_DATE)='MAY';
iv. SELECT COUNT(ID) FROM BLOCKCHAIN WHERE
YEAR(TRANSACTION_DATE)=2022;
(1 mark for each correct query)
32. i. a. 15 4
b. Store Qtr1 Qtr2 Qtr3 Qtr4
1 Store2 350 340 403 210
2 Store3 250 180 145 160
( ½ mark for each correct output/statement)
ii. df=df.drop(2)
OR
df.drop(2,axis=0)
(1 mark for correct statement)
iii.
df["total"]=df["Qtr1"]+df["Qtr2"]+df["Qtr3"]+df["Qtr
4"]
OR
df.to_csv(“D:\data.csv”)
(2 mark for correct statement)

SECTION E

33. i. SELECT POWER(3,4); 5


ii. SELECT NOW();
iii.SELECT ROUND(-34.4567,2);
iv. SELECT TRIM(USERID) FROM USER;
v. SELECT LENGTH("FIFA World Cup");
(1 mark for each correct query)
OR
Ans:
i. INSERT INTO EXAM VALUES(6,'Khushi','CS',85);
ii. UPDATE EXAM SET subject= "Informatics
Practices" where subject = "IP";
iii. DELETE FROM EXAM WHERE marks<30;
iv. ALTER TABLE EXAM ADD COLUMN grade varchar(2);
v. Select * from exam where subject="Informatics
Practices";
(1 mark for each correct query)

34. i. Z2 as it has maximum number of computers. 5


ii. For very fast and efficient connections between various blocks within
the campus suitable topology: Star Topology
iii. Repeater: To be placed between Block Z2 to Z4 as distance between
them is more than 100 metres.
Hub/Switch: To be placed in each block as each block has many
computers that needs to be included to form a network.
iv. Voice Over Internet Protocol
v. WAN as distance between Delhi and Mumbai is more than 40kms.
(1 mark for each correct answer)

35. import matplotlib.pyplot as plt #Statement 1 5


Height_cms=[145,141,142,142,143,143,141,140,143,144]
#Statement 2
plt.hist(Height_cms) #Statement 3
plt.title("Height Chart") #Statement 4
plt.xlabel("Height in cms") #Statement 5
plt.ylabel("Number of people") #Statement 6
plt.show() #Statement 7
(½ mark each for each correct statement 1,2,4,5,6,7)
(1 mark for correct statement 3)

plt.savefig("heights.jpg")

(1 mark for the correct statement)


OR
import matplotlib.pyplot as plt #Statement 1
hobby = ('Dance', 'Music', 'Painting', 'Playing
Sports') #Statement 2
users = [300,400,100,500] #Statement 3
plt.bar(hobby, users) #Statement 4
plt.title("Favourite Hobby") #Statement 5
plt.ylabel("Number of people") #Statement 6
plt.xlabel("Hobbies") #Statement 7
plt.show() #Statement 8
(½ mark for each correct statement)
plt.savefig("hobbies.jpg")
(1 mark for the correct statement)

You might also like