0% found this document useful (0 votes)
31 views9 pages

Revision Worksheet (2024-2025)

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)
31 views9 pages

Revision Worksheet (2024-2025)

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/ 9

REVISION WORKSHEET (2024-2025)

Subject: Informatics Practices Grade: XII

Date of issue: 15.09.2024 Date of submission:26.09.2024

Name of the Student: ………………………… Division:

I) Multiple Choice Questions:

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

2) D1[ : ] = 77 , will set __________ values of a Data Frame ‘D1’ to 77

(A) Only First Row


(B) Only First Column
(C) All
(D) None of the above

3) Which of the following code will generate the following output?


Jan 31
Feb 28
Mar 31
dtype: int64
(A) import pandas as pd

S1 = pd.Series(data = [31,28,31], index=["Jan","Feb","Mar"])

print(S1)

(B) import pandas as pd

S1 = pd.Series([31,28,31], index=["Jan","Feb","Mar"])

print(S1)

(C) Both of the above


1
(D) None of the above

4) Write the output of the following:

import pandas as pd

S1 = pd.Series(data = range(31, 2, -6), index = [x for x in "aeiou" ])

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

(D) None of the above

5) What type of error is returned by following code?

import pandas as pd

S1 = pd.Series(data = (31, 2, -6), index = [7, 9, 3, 2])

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?

(A) Bar plot

(B) Histogram

(C) Line plot

(D) Histogram & Bar plot

7) Which type of network covers a small geographical area like a single office, building, or school
campus?

(A) PAN (B) MAN (C) LAN (D) WAN

8) In which of the network topologies do all devices connect to a central point, such as a switch
or hub?

(A) Star (B) Bus (C) Tree (D) Mesh

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?

(A) 0 (B) 1 (C) 4 (D) 5

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.

(A) Modem (B) Hub (C) Repeater (D) Router

13) State whether the following statement is True or False:

Slicing can be used to extract a specific portion from a Pandas Series.

14) Assertion (A): You need to install the pandas library using the pip install command

Reason (R): You can also access pandas without installation

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)

c. Assertion (A) is true but Reason (R) is false

d. Assertion (A) is not correct but Reason (R) is correct

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)

c. Assertion (A) is true but Reason (R) is false

d. Assertion (A) is not correct but Reason (R) is correct

II) Answer the following:

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

D1 = {'Name': 'Rakshit', 'Age': 25}

D2 = {'Name': 'Paul', 'Age': 30}

D3 = {'Name': 'Ayesha", 'Age': 28}


4
data = [D1,D2,D3)

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.

T_NO Name PB1 PB2

1 Pavan 90 80

2 Sugandha 85 75

3 Pulkita 70 72

4 Sahil 69 71

Perform the following operations on the DataFrame:

i) Create the dataframe.

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.

20) What will be the output of the following code:


import pandas as pd
x={'A':[50,10],'B':[80,20],'C':[12,30],'D':[18,40]}
df=pd.DataFrame(x)
5
print(df)

21) Write the output of the given program:

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)

22) What will be the output of the following code:

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])

23) Carefully observe the following code:

import pandas as pd

x={'a':100, 'b':200} y={'a':5,'c':20} z={'b':50,'d':40}

df=pd. DataFrame({100:x,200: y})

print(df)

Answer the following:

(i) Display the dataframe

(ii) what will be the output of df.shape?

24) Write a Python code to create a DataFrame df using dictionary of dictionaries from the

data given:

25) Consider the DataFrame df shown below.

6
Write Python statements for the DataFrame df to:

I. Print the first two rows of the DataFrame df.

II. Display titles of all the movies.

III. Remove the column rating.

IV. Display the data of the 'Title' column from indexes 2 to 4 (both included)

V. Rename the column name 'Title' to 'Name'.

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:

A. Predict the output of the following python statement:

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

column and First_Runnerup column of the above given DataFrame.

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

********************************

You might also like