33. Write suitable SQL queries for the following:
i. To calculate the exponent for 3 raised to the power of 4.
Ans: SELECT POWER(3,4);
ii. To display current date and time.
Ans: SELECT NOW();
iii. To round off the value -34.4567 to 2 decimal place.
Ans: SELECT ROUND(-34.4567,2);
iv. To remove all the probable leading and trailing spaces from the column userid of the table named user.
Ans: SELECT TRIM(USERID) FROM USER;
v. To display the length of the string ‘FIFA World Cup’.
Ans: SELECT LENGTH("FIFA World Cup");
OR
Kabir has created following table named exam:
| RegNo |
Name |
Subject |
Marks |
| 1 |
Sanya |
Computer Science |
98 |
| 2 |
Sanchay |
IP |
100 |
| 3 |
Vinesh |
CS |
90 |
| 4 |
Sneha |
IP |
99 |
| 5 |
Akshita |
IP |
100 |
Help him in writing SQL queries to the perform the following task:
i. Insert a new record in the table having following values:
[6,'Khushi','CS',85]
Ans: INSERT INTO EXAM VALUES(6,'Khushi','CS',85);
ii. To change the value “IP” to “Informatics Practices” in subject column.
Ans: UPDATE EXAM SET subject= "Informatics Practices" where subject = "IP";
iii. To remove the records of those students whose marks are less than 30.
Ans: DELETE FROM EXAM WHERE marks<30;
iv. To add a new column Grade of suitable datatype.
Ans: ALTER TABLE EXAM ADD COLUMN grade varchar(2);
v. To display records of “Informatics Practices” subject.
Ans: SELECT * FROM EXAM WHERE subject="Informatics Practices";
34. XYZ Media house campus is in Delhi and has 4 blocks named Z1, Z2, Z3 and Z4. The tables given below show the distance between different blocks and the number of computers in each block.
Block Z1 to Block Z2 - 80 m
Block Z1 to Block Z3 - 65 m
Block Z1 to Block Z4 - 90 m
Block Z2 to Block Z3 - 45 m
Block Z2 to Block Z4 - 120 m
Block Z3 to Block Z4 - 60 m
| Block |
Number of computers |
| Z1 |
135 |
| Z2 |
290 |
| Z3 |
180 |
| Z4 |
195 |
The company is planning to form a network by joining these blocks.
i. Out of the four blocks on campus, suggest the location of the server that will provide the best connectivity. Explain your response.
Ans: Z2 as it has maximum number of computers.
ii. For very fast and efficient connections between various blocks within the campus, suggest a suitable topology and draw the same.
Ans: For very fast and efficient connections between various blocks within the campus suitable topology: Star Topology

iii. Suggest the placement of the following devices with justification
(a) Repeater (b) Hub/Switch
Ans: 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. VoIP technology is to be used which allows one to make voice calls using a broadband internet connection. Expand the term VoIP.
Ans: Voice Over Internet Protocol
v. The XYZ Media House intends to link its Mumbai and Delhi centers. Out of LAN, MAN, or WAN, what kind of network will be created? Justify your answer.
Ans: WAN as distance between Delhi and Mumbai is more than 40kms.
35. The heights of 10 students of eighth grade are given below:
Height_cms=[145,141,142,142,143,144,141,140,143,144]
Write suitable Python code to generate a histogram based on the given data, along with an appropriate chart title and both axis labels. Also give suitable python statement to save this chart.
Ans:
import matplotlib.pyplot as plt #Statement 1
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.savefig("heights.jpg")
plt.show() #Statement 7
OR
Write suitable Python code to create 'Favourite Hobby' Bar Chart as shown below:

Also give suitable python statement to save this chart.