0% found this document useful (0 votes)
40 views10 pages

QP - Info - Gr.12 - June MT - 2022 - QP

The document discusses an exam for the subject of Informatics Practices for grade 12. It contains two sections - multiple choice questions and descriptive questions. Section A contains 10 multiple choice questions worth 1 mark each. Section B contains descriptive questions worth between 2 to 4 marks each. The exam is worth a total of 70 marks and is to be completed in 3 hours.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views10 pages

QP - Info - Gr.12 - June MT - 2022 - QP

The document discusses an exam for the subject of Informatics Practices for grade 12. It contains two sections - multiple choice questions and descriptive questions. Section A contains 10 multiple choice questions worth 1 mark each. Section B contains descriptive questions worth between 2 to 4 marks each. The exam is worth a total of 70 marks and is to be completed in 3 hours.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

M

I
D
T
ERM EXAMINATION, JUNE 2022
SUBJECT: INFORMATICS PRACTICES (065)
Grade : 12 Time: 3 Hours
Date: 17/6/2022 Max. Marks : 70

General Instructions:
1. The question paper is divided into 2 Sections – A and B.
2. Section A consists of 10 MCQ Questions
Questions (1-10) - 1 mark each question
3. Section B consists of 21 Descriptive Questions
Questions (11-19) - 2 marks each question
Questions (20-25) - 3 marks each question
Questions (26-31) - 4 marks each question
4. All questions are compulsory.
Section A
Multiple Choice Questions(1-10) – 1 mark each
1 Write the Python code to create a Series S that would print the scalar value 100, 1
five times with index values 1,2,3,4,5.

a) S=pd.series(100, [1, 2, 3, 4,5])


b) S=pd.Series(100, [1, 2, 3, 4,5])
c) S=pd.Series(100, [1, 2, 3, 4])
d) S=pd.series(100, index=[1, 2, 3, 4,5])

2 Choose the correct attribute which is used to assign a name to the index of the 1
series.

a) name
b) series.name
c) index.name
d) values

3 Which of the following options is correct? 1

Statement 1: A Dataframe is a 1- dimensional labeled data structure.


Statement 2: The two common ways of accessing the elements of a Dataframe are
Indexing and Slicing.

a) Statement 1 is False & Statement 2 is True


b) Statement 1 is False & Statement 2 is False
c) Statement 1 is True & Statement 2 is True
d) Statement 1 is True & Statement 2 is False

1
4 ______________ is used to print the number of values in Series S. 1

a) S.count
b) S.ndim
c) S.values
d) S.size

5 Series can be indexed by position(integers) using ___________ function. 1

a) loc()
b) iloc()
c) insert()
d) del()

6 What will be the output of the following code? 1

Output 1 Output 2

Player1 Player2 Player1 Player2


Match1 45 67 Match1 45 67
Match2 77 87 Match3 45 77
Match3 45 77

Output 3 Output 4

Player1 Player2 Player1 Player2


Match2 77 87 Match1 45 67
Match3 45 77 Match2 77 87

a) Output 4
b) Output 1
c) Output 2
d) Output 3

7 Consider the following Series object Samt. 1


.

Write the command which will display the name of the furniture having rent>250,

2
based on the output given below.

Output:

a) print(Samt[Samt>250])
b) print(Samt(Samt>250))
c) print(Samt[Samt>=250])
d) print(Samt[Samt<250])

8 What will be the output of the following code? 1

import pandas as pd
p=pd.Series([ 'a','b','c','d','e'])
p=p.drop([0,2,4])
print(p)

a) 1 b
2 c
b) 1 b
3 d
c) 3 d
1 b
d) 2 c
1 b

9 What would be the outcome of the following statement where DF is a dataframe 1


and v is a list of 3 values ? DF already has columns Eno, Ename, Sale2, Sale3 as
follows.
Eno Ename Sale2 Sale3
1 Rajini 2000 3000
2 Malini 3000 2500
3 Kamali 4000 1000

DF.insert(loc=2, column= ' Sale1 ', value=v)

a) add a column called Sale1 after column Sale3.


b) add a column called Sale1 1 before column Sale3.
c) insert a column called Sale1 after column Sale2.
d) insert a column called Sale1 before column Sale2.

10 Given the following code and the Output, Fill in the blanks (blank1 & blank2) with 1
attributes.

3
Output:
2
(3, 3)
A. blank1 is index and blank2 is size
B. blank1 is size and blank2 is dim
C. blank1 is dim and blank2 is shape
D. blank1 is ndim and blank2 is shape

SECTION B

Questions(11-19) – 2 marks each


Questions(20-25) – 3 marks each
Questions(26-31) – 4 marks each

11 Write the code that would generate a ndarray called Arr with values [ 1 3 5 7 ] 2
using arange() function and display the ndarray.

12 Write the code to create the DataFrame given below (using Dictionary): 2

13 Identify the errors and re-write the code given below which would display the first 2
4 employee numbers & last 5 employee numbers.

#display the first 4 employee numbers & last 5 employee numbers


import pandas as pd
empno=[101,102,103,104,105,106,107]
p=pd.Series(empno)
print(p.head())
print(p.tail[])

14 What would be the output of the following code? 2

4
15 Identify the errors and re-write the code given below: 2

16 Write the code to create the Series given below (using List): 2

17 What would be the output of the following code? 2

import pandas as pd
Dic={'empno':[101,102,103,104],'name':['anil','beny','cyril','dravid'],
'salary':[3000,5000,8000,9000]}
df=pd.DataFrame(Dic,index=['A1','A2','A3','A4'])
print(df.loc['A2':'A3'])
print(df.loc[['A1','A3'], :])

18 What would be the output of the following code? 2

import pandas as pd
emp={ 'Name':['Sachin','Vinod','Rajesh','Sharma'],
'Salary':[2000,5000,4000,7000] }
df=pd.DataFrame(emp)
df1=df.drop([0,2],axis=0)
print(df1)

19 What would be the output of the following code? 2


import pandas as pd
dic={'roll':[1,2],'name':['ann','bob'],'marks':[24,53]}
df=pd.DataFrame(dic)
print(df)
df.loc[:,'marks']=[80,90]
print(df[['roll','marks']])

5
20 Write the Output for the following code: 3

21 What would be the output of the following? 3

import pandas as pd
c=['red','green','blue','pink','black','white']
p=pd.Series(c,index=['r','g','b','p','k','w'])
print(p[:4]) #output 1
print(p[: : 3]) #output 2
print(p[-1:-5:-1]) #output 3

22 Consider two objects x and y. x is a list whereas y is a Series. Both have values 20, 3
40, 90, 110. What will be the output of the following two statements considering
that the above objects have been already created.

(i) print (x*2)


(ii) print(y*2)
(iii) Justify your answer

23 Write the code to create the following Dataframe "Product" using Nested lists (List 3
of lists) and display the DataFrame.

24 i) Write the Output of the following code: 3

import pandas as pd
import numpy as np
arr1=np.array([10,20,30])
arr2=np.array([-10,-20,-30,-40])
arr3=np.array([100,200])
df=pd.DataFrame([arr1,arr2,arr3],columns=['A','B','C','D'])
print(df)

6
25 What would be the output of the following? 3

import pandas as pd
list1=[100,200,300,400,500]
list2=[200,400,600,800]
P1=pd.Series(list1,index=['A','B','C','D','E'])
P2=pd.Series(list2,index=['E','F','C','D'])
print(P1+P2)

26 i) Ritesh wants to display the last 4 rows of the dataframe df and has written the 1
following code :
df.tail()
But last 5 rows are being displayed. Identify the error and rewrite the correct code
so that the last 4 rows get displayed.

ii) Write the output of the following code: 3

import pandas as pd
empdata={'empid':[101,102,103,104,105,106],
'Doj':['12-1-12','15-1-12','5-9-10','17-1-12','5-9-17','16-1-12']}
df=pd.DataFrame(empdata)
print(df.tail(2)['Doj']) #output1
print(df.head(7)['empid']) #output2
print(df.tail()['empid']) #output3

27 i) Ramesh is trying to create the following Dataframe df from list of Dictionaries 2


and has written the code given below. He is getting errors while running the code.
Help him to debug the code removing all errors and rewrite the correct code.

Dataframe df:

Code:

# creation of dictionaries from list of dictionaries


import pandas as pd
listDict = [{'M1':10, 'M2':20},{'M1':5,'M2':10, 'M3':20}
df= pd.DataFrame(listDict,index=[t1,t2])
print(df)

ii) Write the appropriate code(s) that would modify the dataframe df given in (i) 2

7
and display the new Dataframe as follows:

28 Write a program in Python Pandas to create the following DataFrame batsman 4


from a Dictionary:

Perform the following operations on the DataFrame :


i) Add both the scores of each batsman and assign the total score to a new column
"Total ".
ii) Display the highest score in Score2 of the DataFrame.
iii) Display the DataFrame

29 i) Given the code that creates Series from ndarray and the Output, Fill in the blanks 2
(blank1 & blank2).

Code:

Output:

ii) Write a code to create the following Series EMP 2


from dictionary.

8
30 i) Consider the following DataFrame df. 2

Write commands to:


a) add a new row with values ( 5, Shruti, 8.2, Arts )
b) delete the first and third rows(s1 & s3) using drop( ) function.

ii) Given the following code that creates Dataframe from Series and the final 2
Output, fill in the blanks (blank1 & blank2).

Final Output:

31 i) Complete the given program by writing the code (in the blank lines) that would 2
set the columns as 'name' and 'marks' for the DataFrame df that is given in the
program and display the DataFrame df. (Output of the final program is also given
below)

Program:

import pandas as pd
lst=[[ 'Sonu',95],[ 'Binu',97],[ 'Renu',88],[ 'Tanu',72]]
df=pd.DataFrame(lst,index=[ 'stud1', 'stud2','stud3','stud4'])

--------------------------------------

9
--------------------------------------

Output of the Final Program:

name marks
stud1 Sonu 95
stud2 Binu 97
stud3 Renu 88
stud4 Tanu 72

ii) What would be the output of the following code? 2


import pandas as pd
d={'Prod':['Apple','Pear','Banana','Grapes'],
'Qty':[100,150,200,250],
'Cost':[1000,1500,1200,900] }
df=pd.DataFrame(d)
print(df[df['Qty']>200])
print(df['Cost'].sum())

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

10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy