Revision Worksheet (2024-2025)
Revision Worksheet (2024-2025)
1) The following code creates a dataframe named ‘D1’ with _______________ columns.
import pandas as pd
D1 = pd.DataFrame([1,2,3] )
(A) 1 (B) 2 (C) 3 (D) 4
print(S1)
S1 = pd.Series([31,28,31], index=["Jan","Feb","Mar"])
print(S1)
import pandas as pd
print(S1)
(A)
a 31
e 25
i 19
o 13
u 7
dtype: int64
(B)
a 31
e 25
i 19
o 13
dtype: int64
(C) Error
import pandas as pd
print(S1)
(A) SyntaxError
(B) IndexError
(C) ValueError
2
(D) None of the above
6) Which Matplotlib plot is best suited to represent changes in data over time?
(B) Histogram
7) Which type of network covers a small geographical area like a single office, building, or school
campus?
8) In which of the network topologies do all devices connect to a central point, such as a switch
or hub?
9) In a Pandas DataFrame, if the tail() function is used without specifying the optional argument
indicating the number of rows to display, what is the default number of rows displayed,
considering the DataFrame has 10 entries?
10)Which of the following Python statements is used to import data from a CSV file into a Pandas
DataFrame (Note: pd is an alias for pandas)?
(A) pd.open_csv('filename.csv')
(B)pd.read_csv('filename.csv')
(C) pd.load_csv('filename.csv')
(D) pd.import_csv('filename.csv')
11) Which of the following Python statements can be used to select a column column_name
from a DataFrame df?
(A) df.getcolumn('column_name')
(B) df['column_name']
(C) df.select('column_name')
(D) df(column_name)
3
12) Identify the networking device responsible for routing data packets based on their destination
addresses.
14) Assertion (A): You need to install the pandas library using the pip install command
a. Both Assertion (A) and Reason (B) are correct and Reason (R) is the correct explanation of
Assertion (A)
b. Both are correct but Reason(R) is not the correct explanation of Assertion (A)
15) Assertion (A) : In the pandas series, the index property is used to fetch the values using
index labels.
Reason (R) : The series can have the only numeric index to working with series.
a. Both Assertion (A) and Reason (B) are correct and Reason (R) is the correct explanation
of Assertion (A)
b. Both are correct but Reason(R) is not the correct explanation of Assertion (A)
16) Sneha is writing a Python program to create a DataFrame using a list of dictionaries.
However, her code contains some mistakes. Identify the errors, rewrite the correct code, and
underline the corrections made.
import Pandas as pd
df = pd.Dataframe(data)
print(df)
17) Write a Python code to create a DataFrame with appropriate column headings from the list
given below:
[[110,'Gurman',98],[111,'Rajveer',95],[112,'Samar' ,96],[1113,'Yuvraj',88]]
18) Write a program in Python Pandas to create the following DataFrame toppers from a
Dictionary.
1 Pavan 90 80
2 Sugandha 85 75
3 Pulkita 70 72
4 Sahil 69 71
ii) Add both the marks from PB1 and PB2 of a student and assign to column “Final”.
19) Given here is a Dataframe of Sales data of four months stored with name sales_df.
(i) Write a Python code to find sales amount greater than 75 in July month.
(ii) Write a Python code to add the sales of August month with [70,94,80,93] data.
import pandas as pd
S1=pd.Series([5,6,7,8,10],index=['v','w',' x','y','z'])
S2=pd.Series([2,6,1,4,6],index=['z','y','a','w','v'])
print(S1-S2)
import pandas as pd
data= {'Name':['Sachin','Dhoni','Virat','Rohit','Shikhar'],
'Age':[26,27,25,24,22],'Score':[87,89,89,55,47]}
df=pd.DataFrame(data,index=['a','b','c','d','e'])
print(df[df['Score']>=87])
import pandas as pd
print(df)
24) Write a Python code to create a DataFrame df using dictionary of dictionaries from the
data given:
6
Write Python statements for the DataFrame df to:
IV. Display the data of the 'Title' column from indexes 2 to 4 (both included)
26) Mr. Som, a data analyst has designed the DataFrame df that contains data about Computer
Olympiad with ‘CO1’, ‘CO2’, ‘CO3’, ‘CO4’, ‘CO5’ as indexes shown below. Answer the following
questions:
i) df.size
ii) df[2:4]
B. Write Python statement to display the data of Topper column of indexes CO2 to CO4.
C. Write Python statement to compute and display the difference of data of Tot_students
27) ABC Pvt. Ltd., a multinational technology company, is looking to establish its Indian Head
Office in Bengaluru, and a regional office branch in Lucknow. The Bengaluru head office will
be organized into four departments: HR, FINANCE, TECHNICAL, AND SUPPORT. As a
network engineer, you have to propose solutions for various queries listed from i) to v).
7
(i)Suggest the most suitable department in the Bengaluru Office Setup, to install the server. Also,
give a reason to justify your suggested location.
(ii) Draw a suitable cable layout of wired network connectivity between the departments in the
Bengaluru Office.
(iii) Which networking device would you suggest the company to purchase to interconnect all
the computers within a department in Bengaluru Office?
(iv) The company is considering establishing a network connection between its Bengaluru Head
Office and Lucknow regional office. Which type of network—LAN, MAN, or WAN—will be
created? Justify your answer.
(v) The company plans to develop an interactive website that will enable its employees to monitor
their performance after login. Would you recommend a static or dynamic website, and why?
8
28) Write Python code to plot a bar chart for Mobiles sales for quarters.
Also give suitable python statement to save this chart and assign file name ‘Mybar’.
29) Write the code to develop the histogram for the following data
runs: 70,120,180,240,300
********************************