Sample Paper 3_MS
Sample Paper 3_MS
10. In case of MCO, text of the correct answer should also be written.
SECTION A [21x1=21]
SECTION B [7x2=14]
22. What is the purpose of the tail() function in Pandas? Provide an example.
Answer:
The tail() function returns the last n rows from a DataFrame or Series. By default, it returns the last 5
rows.
Example:
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3, 4, 5]})
print(df.tail(3)) # Outputs the last 3 rows
OR
import pandas as pd
df = pd.DataFrame({'A': [1, 2, 3, 4, 5]})
print(df.head(3)) # Outputs the first 3 rows
II. Display the position of the first occurrence of "Relationship" in the given string.
25. Aman, a freelance website developer, has been assigned a task to design web pages for a book shop.
Help Aman in deciding which type of web page should be designed.
Answer:
o Static Web Pages: These are fixed web pages with content that doesn’t change unless manually
updated. Suitable for displaying content that remains the same.
o Dynamic Web Pages: These are web pages that interact with the user and can change based on inputs
or other conditions. These are more suitable for an e-commerce website like a book shop, where the
content (products, prices) may change frequently.
Conclusion: Aman should design dynamic web pages for the book shop.
OR
BY: AMJAD KHAN Page 5 of 12
Website: https://www.learnpython4cbse.com/ YouTube: https://www.youtube.com/@learnpython4cbse
About Us Website: https://www.learnpython4cbse.com/ Feedback 8076665624
o Website: A collection of multiple related web pages that are linked together and can be accessed via a
common domain.
o Web Page: A single document or page that is part of a website and can contain text, images, and links.
26. Write any two differences between Insert and Update commands of SQL.
Answer:
o Insert Command: Adds new records into a table. It is used when inserting new data.
o Update Command: Modifies existing records in a table. It is used when modifying data in existing
records.
27. What is the importance of Net Etiquettes?
Answer:
Net Etiquette refers to proper online behavior, which is essential for maintaining respectful and productive
communication in digital spaces. It includes respecting others’ privacy, avoiding cyberbullying, and
following acceptable behavior in online forums and social media.
28. Correct the given Python code:
import pandas as pd
data = {'Name': ['Riya', 'Preeti', 'Neeta'], 'Age': [25, 30, 22]}
df = pd.DataFrame(data)
df.to_csv('output.csv')
OR
import pandas as pd
df = pd.DataFrame({'name': ['Riya', 'Preeti', 'Neeta'], 'age': [25, 30, 22],
'score': [85, 78, 92]})
selected_rows = df[(df['score'] > 80) & (df['age'] < 30)]
print(selected_rows)
SECTION C [3x4=12]
29. Saharsh is a student of Class IXth and he is a very frequent user of Internet applications. One day he
got an unpleasant message on his instant messenger.
o Saharsh should immediately report the message to the relevant authorities (administrator, parent, etc.),
avoid responding to the sender, and block the sender if possible.
(ii) Exhibiting proper manners and etiquettes while being online is called as?
o The Information Technology Act, 2000 addresses issues related to cybercrime and online harassment
in India.
30. Ritika is a new learner for Python Pandas and she is aware of some concepts of Python but is unable
to create the DataFrame. Help her by writing proper statement.
Answer:
import pandas as pd
data = {'Name': ['Manpreet', 'Kavil', 'Manu', 'Ria'], 'Phy': [70, 60, 76, 89],
'Chem': [30, 70, 50, 65]}
df = pd.DataFrame(data)
print(df)
OR
import pandas as pd
data = {'Bridge': ['Dhola Sadiya Bridge', 'Dibang River Bridge', 'Mahatma
Gandhi Setu', 'Munger Ganga Bridge'],
'State': ['Assam', 'Arunachal Pradesh', 'Bihar', 'Uttar Pradesh']}
df = pd.Series(data)
print(df)
);
32. Consider the following tables and write SQL queries for the following:
(ii) List all customers who have placed orders in descending order of their total order amount.
(iii) Display customer names along with the order date and order amount for each order.
OR
(ii) List all courses in the decreasing order of the number of students enrolled.
GROUP BY COURSE_ID
ORDER BY NumStudents DESC;
(iii) Display the names of students along with their grades in course ID 102.
SECTION D [2x4=8]
33. Help the student complete the Python code for generating a bar chart.
Answer:
Answer:
(ii) Display Name and Desig of those workers, whose Plevel is either P001 or P002.
(iii) Display the details of all workers, whose DOB is between '19-JAN-1984' and '18-JAN-1987'.
OR
(iv) Display Itemname and Dateofstock of those items whose Type is "Sofa."
SECTION E [3x5=15]
import pandas as pd
stock = pd.DataFrame({
'Name': ['Item1', 'Item2', 'Item3', 'Item4'],
'Price': [150, 180, 225, 500]})
# (i) Add a column 'Special_Price'
stock['Special_Price'] = [135, 150, 200, 440]
Answer: