19. What is a web server? How is it different from web browser?
Ans: Web Server is a computer or software that stores website files and delivers web pages to users when requested. Web Browser is a software application used to access and view websites on the Internet.
Difference between Web Server and Web Browser:
| Web Server | Web Browser |
|---|
| It stores and provides website data. | It displays website content to users. |
| It receives and responds to requests. | It sends requests to web servers. |
| Example: Apache, Nginx. | Example: Google Chrome, Mozilla Firefox. |
OR
What do you understand by the term cookies? Give any two benefits of cookies.
Ans: Cookies are small text files stored on a user's computer by websites to remember information about the user and their activities.
Two benefits of Cookies:
(i) Remember Login Details: Cookies help websites remember users' login information, so they do not need to log in every time.
(ii) Save User Preferences: Cookies remember user preferences, such as language, theme and shopping cart items, to provide a better browsing experience.
20. Keshav has written the following query to find out the sum of bonus earned by the employees of WEST zone:
SELECT zone, TOTAL (bonus) FROM employee HAVING zone = 'WEST';
But he got an error. Identify the errors and rewrite the query by underlining the correction(s) done.
Ans: SELECT zone, SUM(bonus) FROM employee WHERE zone = "WEST" GROUP BY zone;
21. Differentiate between COUNT() and COUNT(*) functions in MYSQL. Give suitable examples to support your answer.
Ans: COUNT(): It counts only the non-NULL values in a specified column.
COUNT(*): It counts all rows in a table, including rows containing NULL values.
Example:
Suppose an Employee table has 5 records, out of which 1 employee has NULL salary.
SELECT COUNT(salary) FROM employee; → Returns 4.
SELECT COUNT(*) FROM employee; → Returns 5.
22. Write a Python program to create a series object, country using a list that stores the capital of each country.
Note: Assume four countries to be used as index of the series object are India, UK, Denmark, and Thailand having their capitals as New Delhi, London, Copenhagen, and Bangkok respectively.
Ans:
import pandas as pd
country = pd.Series(
['New Delhi', 'London', 'Copenhagen', 'Bangkok'],
index=['India', 'UK', 'Denmark', 'Thailand']
)
print(country)
23. Explain plagiarism with an example.
Ans: Plagiarism means copying someone else's work, ideas or content and presenting it as your own without giving proper credit.
Example: Copying an article from the Internet and submitting it as your own school assignment without mentioning the original source is called plagiarism.
OR
Nowadays all of us frequently use social media to connect with our friends. Give any two netiquettes that we should follow while communicating on social media.
Ans: Two Netiquettes to follow while communicating on social media:
(i) Be Respectful: Always use polite language and respect others' opinions. Do not use abusive or offensive words.
(ii) Protect Privacy: Do not share anyone's personal information, photos or messages without their permission.
24. What will be the output of the following code?
import pandas as pd
s1 = pd.Series(data=2*(3,10))
print(s1)
Ans:
25. Carefully observe the following code:
import pandas as pddic = {'pid': [101, 102, 103, 104, 105],'pname': ['Shyam', 'Roushan', 'Archit', 'Medha', 'Lalit'],'sports': ['Cricket', 'Tennis', 'Football', 'Cricket', 'Cricket'],'points': [45000, 20000, 15000, 53000, 60000]}
player = pd.DataFrame(dic)
print(player)
Write Python statements for the following:
(i) In the dataframe player created above, set the row labels as 'Player1', 'Player2', 'Player3', 'Player4', 'Player5'.
Ans: player.index = ['Player1', 'Player2', 'Player3', 'Player4', 'Player5']
(ii) Rename the column 'points' to 'netpoint' in the DataFrame player.
Ans: player.rename(columns={'points': 'netpoint'}, inplace=True)
-SECTION C-
26. Consider the table Patient given below and write SQL commands.
Table: Patient
| Patientid | Name | City | Phone | Dateofadm | Department |
|---|
| 1000001 | Ritvik Garg | Delhi | 68476213 | 2021-12-10 | Surgery |
| 1000002 | Rahil Arora | Mumbai | 36546321 | 2022-01-08 | Medicine |
| 1000003 | Mehak Bhatt | Delhi | 68421879 | 2022-02-02 | Cardiology |
| 1000004 | Soumik Rao | Delhi | 26543266 | 2022-01-11 | Medicine |
| 1000005 | Suresh Sood | Bangalore | 65432442 | 2021-03-09 | Surgery |
I. Display the details of all patients who were admitted in January.
Ans: SELECT * FROM Patient WHERE MONTH(Dateofadm) = 1;
II. Count the total number of patients from Delhi.
Ans: SELECT COUNT(*) FROM Patient WHERE City = 'Delhi';
III. Display the last 2 digits of the Patientid of all patients from Surgery Department.
Ans: SELECT RIGHT(Patientid, 2) FROM Patient WHERE Department = 'Surgery';
27. Kavyanjali, a chemical analyst, needs to arrange data of few elements in the form of two series containing symbols and their atomic numbers respectively. Thereafter, the data of these two series has to be arranged and displayed in the form of Data Frame as shown below:
| | Symbol | Atomic Number |
|---|
| Hydrogen | H | 1 |
| Helium | He | 2 |
| Lithium | Li | 3 |
| Berylium | Be | 4 |
Help her in writing suitable Python code to complete the task.
Ans:
import pandas as pd
s1 = pd.Series(['H', 'He', 'Li', 'Be'],
index=['Hydrogen', 'Helium', 'Lithium', 'Berylium'])
s2 = pd.Series([1, 2, 3, 4],
index=['Hydrogen', 'Helium', 'Lithium', 'Berylium'])
df = pd.DataFrame({'Symbol': s1, 'Atomic Number': s2})
print(df)
28. Consider the given DataFrame 'health'.
Table:
| | Diseasename | Agent |
|---|
| 0 | Common cold | Virus |
| 1 | Chickenpox | Virus |
| 2 | Cholera | Bacteria |
| 3 | Tuberculosis | Bacteria |
Write suitable Python statements for the following:(i) Remove the row containing details of disease named Tuberculosis.
Ans: health.drop(3, inplace=True)
(ii) Add a new disease named 'Malaria' caused by 'Protozoa'.
Ans: health.loc[4] = ['Malaria', 'Protozoa']
(iii) Display the last 2 rows.
Ans: print(health.tail(2))
29. Manohar received an email from a company, named Makemoney Pvt. Ltd., claiming that Manohar has won 20 lakhs in a survey done online. In order to claim the prize money, he was required to answer few security questions such as his Name, Account number, PAN card details, Phone number and OTP for verification purposes. For this, he had to click on the link provided in the email.
Answer the following questions:
(i) Should Manohar give the required details to the company?
Ans: No, Manohar should not share his personal details, bank account number, PAN card details or OTP with the company.
(ii) What is the activity depicted above?
Ans: This activity is called Phishing. It is an online fraud in which fake emails or links are used to steal personal and financial information.
(iii) What should he do with this email?
Ans: He should delete the email or report it as spam/phishing and should not click on the given link.
OR
What do you understand by the term Hacking? Write any two measures that one should take to avoid being the victim of hacking.
Ans: Hacking is the process of gaining unauthorized access to a computer, network or data to steal, modify or misuse information.
Two measures to avoid hacking:
(i) Use Strong Passwords: Always use strong and unique passwords for your accounts.
(ii) Install Antivirus Software: Use updated antivirus software to protect your computer from viruses and hackers.
30. Write the output (i-iii) for the following SQL commands.
Table: Fashion
| ID | Product | Price | Qty |
|---|
| F01 | Kajal | 970 | 10 |
| F02 | Foundation | 2100 | 15 |
| F03 | Night Cream | 1700 | 20 |
| F04 | Day Cream | 1400 | 10 |
| F05 | Shampoo | 1200 | 25 |
| F06 | Lipstick | 850 | 32 |
(i) SELECT COUNT(Product) FROM FASHION;
Ans: 6
(ii) SELECT SUM(Price*Qty) FROM FASHION WHERE Product="Night Cream";
Ans: 34000
(iii) SELECT LEFT(Product, 4) FROM FASHION WHERE Price>1500;
Ans:
Foun
Nigh
OR
Find the output of the following SQL queries:
(i) SELECT SUBSTR("CLIMATE CHANGE", 4, 4);
Ans: MATE
(ii) SELECT UCASE(RIGHT("Pollution", 3));
Ans: ION
(iii) SELECT LENGTH("HAPPY")+3;
Ans: 8
-SECTION D-
31. Write the SQL queries which will perform the following operations:
(i) To display the year from your Date of Admission which is '2023-05-15'.
Ans: SELECT YEAR('2023-05-15');
(ii) To convert your email id 'ABC@XYZ.com' to lowercase.
Ans: SELECT LOWER('ABC@XYZ.com');
(iii) To remove leading spaces from a string 'my country '.
Ans: SELECT LTRIM('my country ');
(iv) To display current date.
Ans: SELECT CURDATE();
(v) To display the value of \(10^6\).
Ans: SELECT POWER(10,6);
OR
Consider a table PRODUCT with the following data:
Table: PRODUCT
| SNO | Itemname | Company | Stockdate | 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) Display the first 3 characters of all Itemnames.
Ans: SELECT LEFT(Itemname, 3) FROM PRODUCT;
(ii) Display the names of all items whose Stockday is "Monday".
Ans: SELECT Itemname FROM PRODUCT WHERE DAYNAME(Stockdate) = 'Monday';
(iii) Display the total price of all the products.
Ans: SELECT SUM(Price) FROM PRODUCT;
(iv) Display the maximum Price.
Ans: SELECT MAX(Price) FROM PRODUCT;
(v) Display the average Price of all the products by the company named 'Logitech'.
Ans: SELECT AVG(Price) FROM PRODUCT WHERE Company = 'Logitech';
32. XEED Private Ltd., Delhi is a company that deals with educational toys. They have different divisions HR (A1), Sales (A2), Production (A3) and Marketing (A4).
The layout of the Delhi branch is:

The company also has a branch in Bangalore. The management wants to connect all the divisions as well as all the computers of each division (A1, A2, A3, A4).
Distance between the wings are as follows:
| A3 | A1 | 25 m |
|---|
| A1 | A2 | 40 m |
| A2 | A4 | 25 m |
| A4 | A3 | 20 m |
| A3 | A2 | 30 m |
| A1 | A4 | 170 m |
| Delhi Head Office | Bangalore Office | 2154 km |
Number of computers in each of the wing:
Based on the above specifications, answer the following questions:
(i) Suggest the topology and draw the most suitable cable layout for connecting all the divisions of Delhi branch.
Ans: Star Topology or Bus Topology
(ii) Suggest the kind of network required (out of LAN, MAN, WAN) for connecting Production (A3) with the Bangalore branch.
Ans: WAN
(iii) Which device can be used to connect the network of Delhi Branch to the Internet? This device should be able to receive data, analyse it and then transmit it to the network.
Ans: Router
(iv) Suggest the placement of switch/hub with justification.
Ans: Switch/Hub should be placed in A3 (Production) because it has the maximum number of computers (110). This will reduce the cable length and cost.
(v) Many employees were finding it difficult to cope up with work pressure and hence were showing stress related symptoms. In order to improve the mental health of its employees, HR planned to conduct an online session with a mental health expert from Mumbai.
Out of the options given below, suggest the protocol that will help to send the voice signals over internet to conduct the session successfully.
a) FTP
b) SMTP
c) VOIP
d) POP
33. Consider the following graph. Write the Python code to plot it. Also add the Title, label for X and Y axis.
Use the following data for plotting the graph:
smarks = [10, 40, 30, 60, 55]sname = ["Sahil", "Deepak", "Anil", "Ravi", "Riti"]
Ans:
import matplotlib.pyplot as plt
smarks = [10, 40, 30, 60, 55]
sname = ["Sahil", "Deepak", "Anil", "Ravi", "Riti"]
plt.plot(sname, smarks)
plt.title("Marks secured by students in Term - 1")
plt.xlabel("Student Name")
plt.ylabel("Marks Scored")
plt.show()
OR
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.
Use the following data for plotting the graph:
sales = [450, 300, 500, 650]qtr = ["QTR1", "QTR2", "QTR3", "QTR4"]
Ans:
import matplotlib.pyplot as plt
sales = [450, 300, 500, 650]
qtr = ["QTR1", "QTR2", "QTR3", "QTR4"]
plt.bar(qtr, sales)
plt.title("Sales each quarter")
plt.xlabel("Quarter")
plt.ylabel("Sales")
plt.show()
-SECTION E-
34. Consider the following table Schooldata:
Table: Schooldata
| Admno | Name | Grade | Club | Marks | Gender |
|---|
| 20150001 | Sargam Singh | 12 | STEM | 86 | Male |
| 20140212 | Alok Kumar | 10 | SPACE | 75 | Male |
| 20090234 | Mohit Gaur | 11 | SPACE | 84 | Male |
| 20130216 | Romil Malik | 10 | READER | 91 | Male |
| 20190227 | Tanvi Batra | 11 | STEM | 70 | Female |
| 20120200 | Nomita Ranjan | 12 | STEM | 64 | Female |
Write SQL queries for the following:
(i) Display the average Marks secured by each Gender.
Ans: SELECT Gender, AVG(Marks) FROM Schooldata GROUP BY Gender;
(ii) Display the minimum Marks secured by the students of Grade 10.
Ans: SELECT MIN(Marks) FROM Schooldata WHERE Grade = 10;
(iii) Display the total number of students in each Club where number of students are more than 1.
Ans: SELECT Club, COUNT(*) FROM Schooldata GROUP BY Club HAVING COUNT(*) > 1;
OR
(iii) Display the maximum and minimum marks secured by each gender.
Ans: SELECT Gender, MAX(Marks), MIN(Marks) FROM Schooldata GROUP BY Gender;
35. Consider the following DataFrame 'mdf'.
| Rollno | Name | English | Hindi | Makrs |
|---|
| 0 | 1 | Aditya | 23 | 20 | 28 |
| 2 | 2 | Balwant | 18 | 1 | 25 |
| 3 | 3 | Chirag | 27 | 23 | 30 |
| 4 | 4 | Deepak | 11 | 3 | 7 |
| 5 | 5 | Eva | 17 | 21 | 24 |
(A) Write Python statements for the DataFrame 'mdf':
(i) To display the records of the students having roll numbers 2 and 3.
Ans: print(mdf[mdf['Rollno'].isin([2, 3])])
(ii) To increase the marks of subject Math by 4, for all students.
Ans: mdf['Makrs'] = mdf['Makrs'] + 4
(B) Write Python statement to display the Rollno and Name of all students who secured less than 10 marks in Maths.
Ans: print(mdf.loc[mdf['Makrs'] < 10, ['Rollno', 'Name']])
OR
(Option for Part B only)
Write Python statement to display the total marks i.e., sum of marks secured in English, Hindi and Maths for all students.
Ans: mdf['Total'] = mdf['English'] + mdf['Hindi'] + mdf['Makrs']
print(mdf)