300+ Important Informatics Practices Class XII MCQs

Term 1 MCQs Informatics Practices Class XII

On this page, you will get important Informatics Practices Class XII MCQs. Let’s start it!

Informatics Practices Class XII MCQs

As per sample papers of CBSE there will be 18 MCQs will be asked in board paper. In this article, I will discuss MCQs.

Assessment Structure for Informatics Practices Class XII MCQs

As per the new assessment structure for 2021-22, the assessment structure will be as follows:

Cognitive DomainAssessment ObjectiveThinking ProcessWeightage
KnowledgeKnowledge and understanding based questions based on facts, ideas, techniques, laws, and proceduresRecall, Recognize, Describe, Examples, Identifies, List or sequences50%:
E – 30%
M – 10%
D – 10%
ApplicationsApply knowledge and understanding to the classroom and real-world situationsCompare/Contrast/Classify, Relates, Use models, Interpret Information, explain30%:
E – 10%
M – 10%
D – 10%
ReasoningAnalyze and Evaluate to interpret patterns and relationships and make judgments to draw conclusionsAnalyze, Synthesize, Formulate Questions, Hypothesize, Predict, Design Investigations, Draw Conclusions, Generalize20%:
M – 10%
D – 10%

Types / Formats of Informatics Practices Class XII MCQs

The Informatics Practices Class XII MCQs contains the following:

  1. 4 Options of each question
  2. No negative marking
  3. Options/Choice will be provided but with sections
  4. Evaluation of the first attempted number of questions

The following types of questions would be asked in Informatics Practices Class XII MCQs:

  1. Simple MCQs
  2. Complex MCQs
  3. Assertion-Reasoning

Now let’s have a look at chapter-wise MCQ questions.

Chapter 1 Python Pandas I Informatics Practices Class XII MCQs

Se let’s begin the Informatics Practices Class XII MCQs. Here we go!

  1. Pandas mainly used for
    • Data Recovery
    • Data Backup
    • Data Visualizations
    • Data Analysis
  2. The Pandas word has derived from
    • Panel Data System
    • Panel Data Structure
    • Python Data Structure
    • Python Data System
  3. Pandas has become a popular choice for data analysis because
    • It has tools for big data evaluations
    • It has tools to discover useful information
    • It provides support for decision making
    • All of these
  4. Who is the main author of Pandas?
    • Guido Van Rossum
    • Wes McKinney
    • Dan Bader
    • Zed Shaw
  5. Which of the following is not Pandas data structure?
    • Series
    • Data Frame
    • Queue
    • Panel
  6. Which of the following statement is not correct for Pandas?
    • Pandas is open source built in library
    • Pandas offers high-performance, easy to use data structures
    • Pandas provides tools for backup and recovery
    • Pandas provides tools for data analysis
  7. Which of the following is one of the feature of data structure?
    • Specialized way of storing data
    • Specilized way to read or wirte data
    • Reshape data into different forms
    • Support data visualizations
  8. Which of the following term or word is not associated with pandas?
    • Index
    • Data
    • NaN
    • Record
  9. Pandas series is a combination of
    • Records arranged in row and column
    • Collection of 1 dimensional data and associated index
    • Collection of 2 dimensional data
    • Collection of 3 dimensional data
  10. Which of the following correct statement for creating empty series? (Assume that pandas library is already imported as pd)
    • ser = pd.Series(NaN)
    • ser = pd.Series(None)
    • ser = pd.Series()
    • ser = pd.Series
  11. The empty series object has which of the data type?
    • int64
    • int32
    • float32
    • float64
  12. You can create a Python pandas series using?
    • sequence
    • ndarray
    • tuple
    • all of the above
  13. While importing pandas and numpy, you must use identifier name as pd and np only. Choose the correct answer
    • No, its not necessary
    • Yes, Always otherwise it will produce error
    • pd and np are keywords used for pandas and numpy
    • pd and np are ideintifiers used in the respecive module
  14. Which one of the following is correct statement to create series 35,38,41,44 using a python sequence?
    • s = pd.Series(range(35,44,3))
    • s = pd.Series(range(35,45,3))
    • s = pd.Series(range(35 to 45,3))
    • s = pd.Series(range(35-45,3))
  15. Which of the following is correct statement to create a series of multiple table of 3?
    • s = pd.Series(range(3,31,3))
    • s = pd.Series(range(3,3*11))
    • s = pd.Series(range(3,3,3))
    • All of these
  16. Which of the following is correct statement to create a series of multiple repated values 44,55 for three times?
    • s = pd.Series([44,55],3)
    • s = pd.Series(np.tile[44,55],3)
    • s = pd.Series(44,55,3)
    • s = pd.Series(range(44 and 55, 3))
  17. Which of the folloiwng statement is correct to create a series of 5 elements between 55 to 95?
    • s = pd.Series([55,95,5])
    • s = pd.Series(range(55,95,5))
    • s = pd.Series(np.linspace(55,95,5))
    • s = pd.Series((55,95,5))
  18. While createing a series in which of the following way you must need to specifies the index?
    • Using a sequence
    • Using dictionary
    • Using tuple
    • With a scalar value
  19. Which of the following is correct statement for creating a series to assign None to all series elements of 5 elements?
    • s = pd.Series()
    • s = pd.Series(None,index=[1,2,3,4,5])
    • s = pd.Series(none,5)
    • s = pd.Series(none*5)
  20. Which of the following condition raise a ValueError while creating a series?
    • Values are provides without indexes
    • Indexes are not similar to number of values
    • Values are not similar to number of indexes
    • All of the above
  21. Which of the following are ways to access series elements?
    • Using for loop
    • Indexing
    • Slicing
    • All of these
  22. Pandas supports which of the following types of indexes?
    • Positional and Labelled Indexing
    • Numbered and Valued Indexing
    • Row and Column Indexing
    • Loop Indexing
  23. The by default indexing is
    • Positional Index
    • Valued Index
    • Labelled Index
    • Sliced Index
  24. ________ index is takes user defined label as index.
    • Positional Index
    • Valued Index
    • Labelled Index
    • Sliced Index
  25. Mr. Anuj is trying to access 3rd element from series named s using positional index. Suggest him the correct statements from given statements:
    • s(2)
    • s{2}
    • s[2]
    • s[II]
  26. Which of the following is correct way of assinging a labelled index to series?
    • s=pd.Series(index=range(5,10),[22,33,44,56,78])
    • s=pd.Series(index=range(5,10),dt=[22,33,44,56,78])
    • s=pd.Series({22,33,44,56,78},index=range(5,10))
    • s=pd.Series([22,33,44,56,78],index=range(5,10))
  27. Which of the following is the correct statement to access index 3rd and 5th values using positional index for series s?
    • s[3,5]
    • s[[3,5]]
    • s[(3,5)]
    • s([3,5])
  28. Which of the following statement is fales with respect to accessing series elements through slicing?
    • It can be used as same as numpy or list slicing
    • It requires slicing start and end parameters
    • The values of last positional index is included
    • The series must be created with a sequence to access using slicing
  29. Select the correct option to get the index preview in reverse order
    • s[-1::1]
    • s[-1:1:1]
    • s[::-1]
    • s[::]
  30. What will be the output of following code:
import pandas as pd
s=pd.Series([11,12,13,14,15,16])
s[1:4] = 20
s=list(s)
print(l)
  • Select the correct output:
    • [11, 20, 20, 20, 15, 16]
    • [20, 20, 20, 20, 15, 16]
    • [20, 12, 13, 20, 15, 16]
    • [11, 20, 13, 20, 15, 16]

Watch this video for more understanding:

31. Series attributes are also known as series ____________

  • Methods
  • Events
  • Properties
  • Characterstics

32. Select the correct statement to assign a new name MySeries to a series object named s

  • s.Name(‘MySeries’)
  • s.name=’MySeries’
  • s(‘MySeries’)
  • s.Name=’MySeries’

33. Mr. Asutosh has created a series with object s1 and assigned a name the index as ‘states’. Which of the following statement should he use to print the index of series by assigned name?

  • s1.Index.Name
  • s1.index.name
  • s1.Name
  • s1.index

34. Which of the following attribute gives the following output – (4,) for following data frame?

023
125
228
430
  • s.shape()
  • s.index
  • s.shape
  • s.size

35. Ms. Anita wants to print only a list of values from the series. She should use which of the following attribute?

  • s.value
  • s.values
  • s.val
  • s.eval

36. Which of the following attribute is used to returns the total number of rows?

  • countAll
  • size
  • shape
  • ndim

37. Ms. Hetvee wants to check whether the series is empty or not. But she is confused about how to do the same, help her to select the correct method out of the following?

  • s.empty()
  • s.empty
  • s.isempty
  • s.None

38. Which of the following attribute is used to check whether a series contains a NaN value or not?

  • s.NaN
  • s.None
  • s.hasnans
  • s.nan

39. Which of the following function of series is used to return first ‘n’ elements from series?

  • s.head()
  • s.tail()
  • s.top()
  • s.on()

40. The head function returns how many elements by default from the series?

  • 2
  • 3
  • 4
  • 5

In the next section, you will get some case study based questions for Informatics Practices Class XII MCQs.

41. Ms. Priya is a python developer and she created a series using the following code, but she missed some of the lines given as blank. Fill that blanks and help her to complete the code:

import pandas as pd
import ________ as np
s1=pd.Series([3,4,_____,44,67])
print(s1)

Output:
0  3
1  4
2  NaN
3  44
4  67

a) numPy, no.None

b) numpy,np.nan

c) numpy,np.NaN

d)NumPy,np.NaN

42. Mr. Sidhhart wants to define the index explicitely for a series named s. Which of the following statement(s) is/are correct?

Statement 1: s.index=[‘1st’,’2nd’,’3rd’,’4th’]

Statement 2: s.index(‘1st’,’2nd’,’3rd’,’4th’)

a) Only Statement 1 is Correct

b) Only Statement 2 is Correct

c) Both statements are correct

d) None of these statements are correct

43. What will be the output of following code?

import pandas as pd
s=pd.Series([10,20,30,40,50],index={'a','b'','c','d','e'})
s['d']

a) d

b) 30

c) 40

d) 4

44. Mrs. Payal Mishra wanted to access multiple index values from series s. Which of the following statement is correct for her?

a) s.index=[0,1,2,3,4]

b) s.index(0,1,2,3,4)

c) s[0,1,2,3,4]

d) s[[0,1,2,3,4]]

45. Observe the code and choose the correct output:

import pandas as pd
s=pd.Series(11,22,33,44,55)
print(s[-3:])

a)

4 33
3 44
2 55
dtype: int64

b)

2 33
3 44
4 55
dtype: int64

c)

0 11
1 22
2 33
dtype: int64

d)

3 44
4 55
dtype: int64

46. Which of the following code is helpful to access the first 3 index values?

a) s[:3]
b) s[::3]
c) s[3:]
d) s[:3:]

47. Which of the following statement is correct with respect to loc and iloc?

a) both are used to access values based on index labels
b) iloc does not include the last element of the range
c) loc does not include the last element of the series
d) All of the above are correct

48. What will be the output for the following code:

import pandas as pd
s=pd.Series([66,22,11,44,55])
for i in range(s.size):
    if s[i]>20:
        print(s[i],end=",")

a) 66,22,44,55

b) 22,44,55,66

c) 66,22,44,66

d) Error

49. Ms. Advika wants to apply the name for the index in series named sal for month wise salary of her employees. Choose the correct statement for her:

a) s.index=’Month’

b) s.index.name=’Month’

c) s.index(‘Month’)

d) s.index.name[‘Month’]

50. Tushar is a new learner for the python pandas series. He learned some of the concepts of python in class 11 with NumPy module. He wants to create a series of values multiplied by 7 between 20 to 30 with the following code. The index should be between 20 to 30 and every value be multiply by 7. Help him to create series by following code:

import pandas as pd
import numpy as np
s=np.arange(20,30)

a) sm7= pd.Series(s,s*7)

b) sm7=pd.Series(s*7,s)

c) sm7=pd.Series([s*7],index=s)

d) All of these

Watch the bellow given video for more understanding:

51. What will be the output of the following code:

import pandas as pd
s1=pd.Series([4,5,7,8,9],index=['a','b','c','d','e'])
s2=pd.Series([1,3,6,4,2],index=['a','p','c','d','e'])
print(s1-s2)

a)

a 3.0
b 0
c 1.0
d 4.0
e 7.0
p 0
dtype: float64

b)

a 3.0
b NaN
c 1.0
d 4.0
e 7.0
p NaN
dtype: float64

c)

a 3.0
c 1.0
d 4.0
e 7.0
dtype: float64

d)

a 3.0
b –
c 1.0
d 4.0
e 7.0
p –
dtype: float64

53. What will the output of the following code:



import pandas as pd
s1=pd.Series([4,5,7,8,9],index=['a','b','c','d','e'])
s2=pd.Series([1,3,6,4,2],index=['a','p','c','d','e'])
print(s1==s2)

a)

a True
b False
c True
d False
e True
dtype: bool

b)

a False
b False
c False
d False
e False
dtype: bool

c)

a True
b True
c True
d True
e True
dtype: bool

d)

a False
b True
c False
d False
e True
dtype: bool

54. Which of the following is not a correct statement to delete the element stored at the 3rd position?

a) del s[3]

b) s.pop(3)

c) s.drop(3)

d) s.delete(3)

55. Mr. Tript is working IT company. His boss assigns him some work to be done with series on which he needs to do some tasks and perform some operations. The code is as following suggest him the best options for his work:

import pandas as pd
s1=pd.Series([97,94,95,88,87,77],index=['Radhika','Maitree','Ritika','Rajul,'Shivani','Mridul'])

Based on the given code, answer the following questions:

  1. He wants to print Name and Values for Ritika and Mridul, which of the following command is correct:
    • s1.loc[‘Ritika’,’Mridul’]
    • s1.loc[‘Ritika’:’Mridul’:3]
    • s1.loc[‘Ritika’:’Mridul’]
    • s1.loc[‘Ritika’-‘Mridul’]
  2. Help to reset all values with 0 which ends with 7. Which of the following code is correct:
    • s1[s1/10==7]=0
    • s1[s1%10==7]=0
    • s1[s1//10==7]=0
    • s1[s1**7]=0
  3. What will be output of: print(s1.shape)
    • (6,)
    • 6
    • [6]
    • {6}
  4. He wants to check the availability of NaN values in index. Which of the following is correct statement for him?
    • s1.none
    • s1.nan
    • s1.hasnans
    • s1.hasNan
  5. He wants to return total number elements from the series. Which of these statment is correct?
    • s1.index
    • s1.length
    • s1.itemsize
    • s1.size
  6. He wants to check whether series is empty or not?
    • s1.empty
    • s1.none
    • s1.blank
    • s1.zero

Pandas Series – Assertion and reason-based Informatics Practices Class XII MCQs

In the next session of Informatics Practices Class XII MCQs, you will see assertion and reason-based pandas series questions:

Options for the answer:

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

[1]

Assertion (A) : You can create pandas series from NDArray using NumPy library after import the NumPy module and creating Array using arrange() function.

Reason(R): NumPy is an open-source library that provides functions and properties for multidimensional array and matrix data structure.

Ans.: Option (a)

[2]

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

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

Ans. : Option (c)

[3]

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.

Ans. : Option (c)

[4]

Assertion (A): The selection() method is used to access and select data from series.

Reason (R) : tail() function returns the last n rows from the series and helps to quickly verify data.

Ans. : Option (d)

[5]

Assertion (A): The shape attribute of the series will return a tuple of the values from the series.

Reason (R): The series contains a tuple of a number of rows in one dimensional associated with a specified index.

Ans.: Option (d)

[6]

Assertion (A): The pop() method can be used to delete values from the top index from the series.

Reason (R): The pop() and drop() methods can be used to delete values from the series but the pop() only deletes the value from top and drop() will delete the specified indexed value.

Ans. Option (a)

[7]

Assertion (A): The mathematical operations can be performed in series and returns NaN if the index does not match.

Reason (R): The series required the same index for both series.

Ans. Option (a)

[8]

Assertion (A): While accessing values using slices, the values at the start and end index can be also included.

Reason (R) : In slicing, labelled index display all the values from starting to ending indexes.

Ans. Option (a)

[9]

Assertion (A) : Slicing can be also used to modify the series elements.

Reason (R): Series elements can be modified with a list of values respectively.

Ans. Option (c)

[10]

Assertion (A): The relation operator with multiple series display results in either True or False for each element.

Reason (R): Any vector operation can be used on every single element.

Ans. Option (a)

Watch this video for more understanding:

If you are looking for more questions follow the below-given link:

QnA Pandas Series

Informatics Practices Class XII MCQs – Pandas Dataframe

In the next section of Informatics Practices Class XII MCQs let’s see some of the questions from DataFrame.

[1] Which of the following is not a feature of Pandas DataFrame?

a) Store 2D heterogeneous data

b) Have labelled axes

c) Indexes may constitute numbers, strings or letters

d) Size of the data frame is immutable

[2] Dataframe is _______________ type of data structure of pandas

a) 1D

b) 2D

c) 3D

4) ND

[3] Which of the following statement is correct for Pandas DataFrame?

a) Pandas DataFrames are size mutable and values immutable

b) Pandas DataFrames are size and value mutable

c) Pandas dataframes are size mutable and value immutable

d) Pandas dataframes are size immutable and value mutable

[4] Which of the following statement is incorrect for dataframe indexes?

a) Dataframe index can have only numbers

b) DataFrame index can have numbers, characters or string

c) DataFrame index cannot be defined explicitly

d) DataFrame indexes are of two type : row indexes and column indexes

[5] Riya wants to create an empty dataframe in pandas. Which of the following statement she should write to create an empty dataframe?

a) df=pd.Dataframe()

b) df=pd.dataframe()

c) df=pd.DataFrame([None])

d) df=pd.DataFrame()

[6] In Pandas, you cannot create a dataframe without any column labels?

a) Yes

b) No

c) May Be

d) Not Sure

[7] Chirag is a data scientist in a firm. He wants to create a dataframe using ndarray with column labels as months and row lable as names of salesmen. Which of the following statement os correct for him? The code is given as following:

import pandas as pd
import numpy as np
a=np.array([111,222,333])
b=np.array([20,40,60])
c=np.array(['January','February','March'])
d=['Nitin','Manoj']

a) df=pd.DataFrame([a,b],columns=c,index=d)

b) df=pd.DataFrame(a,b,columns=c,index=d)

c) df=pd.DataFrame({a:b},column=c,index=d)

d) df=pd.DataFrame([a,b],index=’d,’columns=’c’)

[8] Herry wants to create a dataframe using dictionary but he is confused that the keys of dictionary can be taken as which of the following? Select appropriate option for him?

a) rows

b) data

c) columns

d) None of these

[9] Observe this code and select the answer for how many rows and columns will be generated using this code:

import pandas as pd
ld = [{'x':50, 'y':70}, {'x':35,'y':55, 'z':75}]
dfld = pd.DataFrame(ld)
print(dfld)

a) 3,2

b) 2,3

c) 1,3

d) Error

[10] In Pandas DataFrame, ___________ is automatically inserted when corresponding value for a column is missing.

a) Row

b) Column

c) Index

d) NaN

[11] What will be the output of the following code:

import pandas as pd
iplw = [{2018:'CSK', 2019:'MI', 2020:'MI'}, {2018:8,2019:8,2020:8,2021:8}]
dfipl = pd.DataFrame(iplw,index=['Winner','TeamsPlayed'])
print(dfipl)

a)

             2018 2019 2020  2021
Winner       CSK   MI   MI   NaN
TeamsPlayed    8    8    8   8.0

b)

          Winner       TeamsPlayed
2018       CSK               8
2019        MI               8
2020        MI               8
2021        NaN              8

c)



    2018 2019 2020  2021
0   CSK   MI   MI   NaN
1    8    8    8   8.0

d) KeyError

[12] What will be the output of the following code:

import pandas as pd
l =[1,1.5,2,2.5]
df = pd.DataFrame(l)
print(df)

a)

  0
0 1.0
1 1.5
2 2.0
3 2.5

b)

  0  1    2  3   
0 1  1.5  2  2.5

c)



  0
0 1
1 1.5
2 2
3 2.5

d) Error

[13] The column indexes are not provided when you create a data frame using

a) List

b) ndarray

c) scaler value

d) dictionary

[14] Observe the following code and select the correct statement for the same:



import pandas as pd
l=[['Ansh',71,63,75],['Moksh',61,62,63],['Shail',85,89,87]]
df=pd.DataFrame(l)
print(df)

a) it will create a dataframe with column index with given names

b) dataframe cannot be created

c) dataframe will be created with default row indexes and column indexes

d) dataframe will be created without any indexes

[15] Observe the following code and select the correct code to create a dataframe and specify column name for the dataframe:



import pandas as pd
l=[['Ansh',71,63,75],['Moksh',61,62,63],['Shail',85,89,87]]

a) df=pd.DataFrame(l,cols=(‘Name’,’Eng’,’Acc’,’BS’))

b) df=pd.DataFrame(l,cols=(‘Name’,’Eng’,’Acc’,’BS’))

c) df=pd.Dataframe(l,columns=[‘Name’,’Eng’,’Acc’,’BS’])

d) df=pd.DataFrame(l,columns=[‘Name’,’Eng’,’Acc’,’BS’])

[16] What will the output of the following code be:

import pandas as pd
player_matches = pd.Series({'V.Kohli':200,'K.Rahul':74,'R.Sharma':156,'H.Padya':80})
player_runs=pd.Series({'V.Kohli':9578,'K.Rahul':3612,'R.Sharma':7863,'H.Padya':2530})
df = pd.DataFrame({'Matches':player_matches,'Runs':player_runs})

a)

     0        Matches  Runs
 0 V.Kohli       200   9578
 1 K.Rahul        74   3612
 2 R.Sharma      156   7863
 3 H.Padya        80   2530

b)

           Matches  Runs
V.Kohli       200   9578
K.Rahul        74   3612
R.Sharma      156   7863
H.Padya        80   2530

c)

            V.Kohli     K.Rahul      R.Sharma     H.Pandya
Matches       200         74            156           80      
Runs          9578       3612          7863          2530

d) Error

[17] Which of the following statement is correct for creating dataframe using a list of dictionaries?

a)

xii_d=[{'Milan':32,'Veer':41,'Bhumin':35,'Purab':36},{'Milan':31,'Bhumin':32,'Purab':33},{'Milan':30,'Veer':40,'Bhumin':30,'Purab':32}]
df = pd.DataFrame(xii_d)

b)



xii_d={['Milan':32,'Veer':41,'Bhumin':35,'Purab':36],['Milan':31,'Bhumin':32,'Purab':33],['Milan':30,'Veer':40,'Bhumin':30,'Purab':32]}
df = pd.DataFrame(xii_d)

c)



xii_d={{'Milan':32,'Veer':41,'Bhumin':35,'Purab':36},{'Milan':31,'Bhumin':32,'Purab':33},{'Milan':30,'Veer':40,'Bhumin':30,'Purab':32}}
df = pd.DataFrame(xii_d)

d)



xii_d=({'Milan':32,'Veer':41,'Bhumin':35,'Purab':36},{'Milan':31,'Bhumin':32,'Purab':33},{'Milan':30,'Veer':40,'Bhumin':30,'Purab':32})
df = pd.DataFrame(xii_d)

[18] Vatsal is creating a project on cricket match analysis. Suggest the correct code to create a dataframe using following cases:

  1. He has data of 3 matches.
  2. The bastman are: Virat Kohli, K L Rahul, Rohit Sharma, Rishabh Pant
  3. In first match top 4 batsmans played and scored runs 34,56,78,32 respectively
  4. In second match only 3 batsman played and scored 22,34,45 runs respectively, Rsihabh Pant did not bat
  5. In last match 3 batsman played and scored 33,19, and 55 runs repectively, K L Rahul was injured and did not bat
  6. Assign row label as Match 1, Match 2 and Match 3

a)

import pandas as pd
players=[{'Virat Kohli':34,'K L Rahul':56,'Rohit Sharma':78,'Rishabh Pant':32},
{'Virat Kohli':22,'Rohit Sharma':34,'K L Rahul':45},{'Virat Kohli':33,'Rohit Sharma':19,'Rishabh Pant':55}]
df = pd.DataFrame(players)

b)



import pandas as pd
players=[{'Virat Kohli':34,'K L Rahul':56,'Rohit Sharma':78,'Rishabh Pant':32},
{'Virat Kohli':22,'Rohit Sharma':34,'K L Rahul':45},{'Virat Kohli':33,'Rohit Sharma':19,'Rishabh Pant':55}]
df = pd.DataFrame(index=['Match 1','Match 2','Match 3'],players)

c)

import pandas as pd
players=[{'Virat Kohli':34,'K L Rahul':56,'Rohit Sharma':78,'Rishabh Pant':32},
{'Virat Kohli':22,'Rohit Sharma':34,'K L Rahul':45},{'Virat Kohli':33,'Rohit Sharma':19,'Rishabh Pant':55}]
df = pd.DataFrame(players,index=['Match 1','Match 2','Match 3'])

d)



import pandas as pd
players=[{'Virat Kohli':34,'K L Rahul':56,'Rohit Sharma':78,'Rishabh Pant':32},
{'Virat Kohli':22,'Rohit Sharma':34,'K L Rahul':45,NaN},{'Virat Kohli':33,NaN,'Rohit Sharma':19,'Rishabh Pant':55}]
df = pd.DataFrame(players,index=['Match 1','Match 2','Match 3'])

[19] What will be the output of the following code?

import pandas as pd
data={'Marketing':{2018:550,2019:205},
       'Sales':{2018:305,2019:440}}
df=pd.DataFrame(date)
print(df)

a)

            Marketing      Sales
2018        550            305
2019        205            440

b)

Year     Marketing  Sales
2018        550    305
2019        205    440

c)

            2018  2029
Marketing   550    205
Sales       305    440

d)

          Marketing  Sales
           2018      2019
            550      305
2019        205    440

[20] Select correct code for the following data frame:

Class 10Class 12
Term 16555
Term 26050

a)

import pandas as pd
x={'Term1':65,'Term2':55}
xii={'Term1':60,'Term2':50}
c={'Class 10':x,'Class 12':xii}
df=pd.DataFrame(c)
print(df)

b)

import pandas as pd
10={'Term1':200,'Term2':189}
10={'Term1':350,'Term2':250}
c={'Class 10':10,'Class 12':12}
df=pd.DataFrame(c)
print(df)

c)

import pandas as pd
x=['Term1', 200,'Term2', 189]
xii=['Term1',350,'Term2',250]
c={'Class 10':x,'Class 12':xii}
df=pd.DataFrame(c)
print(df)

d)

import pandas as pd
x=('Term1', 200,'Term2', 189)
xii=('Term1',350,'Term2',250)
c={'Class 10':x,'Class 12':xii}
df=pd.DataFrame(c)
print(df)

Watch the following video for more understanding:

In the next section of Term 1 MCQs Informatics Practices Class XII, I am going to provide you with the questions from data frame properties. Here we go!

MCQs Dataframe Properties Class 12 IP

[1] Ritika wants to access certain properties of the dataframe. But she is confused about how to use that for data frame df. Select the correct syntax to help her:

a) df[properties]

b) df(properties)

c) df.properties

d) df.properties()

[2] The properties are also known as

a) methods

b) functions

c) indexes

d) attributes

[3]Observe the following dataframe and output. Select the correct code to get it from below given options:

               2019             2020           2021
Virat Kohli    1856             1920            915
Rohit Sharma   1705             1350           1123

Output:
Index(['Virat Kohli',Rohit Sharma],dtype='object')

a) df.name

b) df.index

c) df.Index

d) df.Index()

[4] The properties df.index only display the row indexes of the dataframe.

a) True

b) False

c) Not sure

d) Can’t say anything

[5] Milan wants to access the rows labels of the dataframe. Which of the folloiwng attribute can be used to do the same?

a) df.row

b) df.index

c) df.rowlabel

d) df.r

[6] The output of df.index contains

a) a list of row labels with datatype

b) a list row labels only

c) a tuple of the list of row labels with datatype

d) a tuple of row labels only

[7] Read the statements and choose the correct answer:

Statement A: The index attribute of dataframe can only access the default indexes like 0,1,2,3 and so on.

Statement B: The index attribute of dataffame access any indexes from the dataframe.

a) Only Statement A is correct

b) Only Statement B is correct

c) Both are correct

d) Both are incorrect

[8] What will be the output of the following code:

import pandas as pd
d={2019:[44,62],2020:[32,37]}
df=pd.DataFrame(d,index=['Class 10','Class 12'])
print(df.columns)

a) Index([‘Class 10′,’Class 12′],dtype=’Object’)

b) Index([2019,2020],dtype=int64)

c) Index=[‘Class 10′,’Class 12’]

d) Int64Index([2019, 2020], dtype=’int64′)

[9] By considering the above dataframe Shalini wants to access the first two columns of dataframe. Select the best suitable option for her:

a) df.columns[0,1]

b) df.columns[[0,1]]

c) df.columns(df.head(2))

d) df.columns=[0,1]

[10] What will be the output of the following code?

import pandas as pd
d={'AY2019':[44,62,32],'AY2020':[32,37,48]}
df=pd.DataFrame(d,index=['Class 9','Class 10','Class 12'])
print(df.columns[-1:])

a) Index([‘AY2020′],dtype=’object’)

b) Index(‘AY2020′,dtype=’int64’)

c) Index([‘AY2020′,dtype=’int64’])

d) Index ([‘AY2019′,’AY2020′],dtype=’object’)

[11] Simran is working on the dataframe. She wants to access row labels and column labels by writing the properties of datarame. Suggest the property to her to do the task:

a) df.rows,columns

b) df.index,columns

c) df.axes

d) df.r&c

[12] What will be the output of the following code:

import pandas as pd
d={'AY2019':[44,62,32],'AY2020':[32,37,48]}
df=pd.DataFrame(d,index=['Class 9','Class 10','Class 12'])
print(df.axes)

a) Index([‘Class 9’, ‘Class 10’, ‘Class 12′]),dtype=’object’), Index([‘AY2019′,’AY2020′], dtype=’object’)

b) Index([‘AY2019′,’AY2020′], dtype=’object’), Index([‘Class 9’, ‘Class 10’, ‘Class 12′]), dtype=’object’)

c) Index([‘AY2019′,’AY2020′], dtype=’object’)

d) Index([‘Class 9′,’Class 10’, ‘Class 12′], dtype=’object’)

[13] Which of the following dataframe attribute is used to fetch the datatype of values used in the dataframe?

a) df.datatypes

b) df.dt

c) df.data_types

d) df.dtypes

[14] What will be the output of the following code:

import pandas as pd
d={'AY2019':[44,62],'AY2020':[37,48]}
df=pd.DataFrame(d,index=['Class 9','Class 10'])
print(df.dtypes)

a)

AY2019 int64
AY2020 int64
dtype: object

b)

Class 9 object
Class 10 object
dtype: object

c) Error

d) No output

[15] The size attribute of datafraame returns

a) the sum of no. of rows and columns

b) the difference of no. of rows and columns

c) the factors of no. of rows and columns

d) the product of no. of rows and columns

[16] The shape attribute is returns

a) the list of no. of rows and columns

b) the tuples of no. of rows and columns

c) the set of no. of rows and columns

d) the product of no. of rows and columns

[17] Observe the given dataframe code and predict the size of the dataframe

import pandas as pd
d={'Customer Name':['Arzoo','Ankit','Biral'],'Company':['DELL','HP','DELL'],'RAM in GB':[8,6,4],'Prize':[38500,36700,34850]}
pd.DataFrame(d)

a) 16

b) 8

c) 12

d) 20

[18] Observe the given data from the dataframe:

       Customer Name Company      RAM in GB     Prize
0         Arzoo       DELL          8           38500
1         Ankit       HP            6           36700
2         Biral       DELL          4           34850

Which of the following statement will print the output (3,4)

a) df.shape

b) df.size

c) df.nbytes

d) df.ndim

[19] Which of the following code always print 2 as output for any dataframe?

a) df.shape

b) df.empty

c) df.size

d) df.ndim

[20] Deep wants to check the emptyness of the dataframe. Which of the following can be useful for him?

a) empty

b) isna()

c) both a and b

d) None of the above

[21] The count() method with parameter 0 will return

a) the count of rows

b) the count of columns

c) the count of total elements

d) the size in bytes

[22] The count() method by default returns

a) the count of rows

b) the count of columns

c) the count of total elements

d) the size in bytes

[23] Hitesh wants to display the count of items in each column. Which of the following code is helpful for him?

a) df.count()

b) df.count(0)

c) df.count(1)

d) df.count(axis=[1])

[24] Consider the above dataframe and select the code to print the following output:

                 0      1      2
Customer Name  Arzoo  Ankit  Biral
Company         DELL     HP   DELL
RAM in GB          8      6      4
Prize          38500  36700  34850

a) df.t

b) df.T

c) df.R

d) df.r

[25] Mahesh is learning python pandas as a beginner. He forget that the feature of the matrix which prints the rows to columns and columns to rows suggest the term he forgot?

a) reverse

b) wrong

c) transpose

d) shape

[26] Which of the following properties returns the nested list of elements from the dataframe row-wise?

a) T

b) hasnans

c) elements

d) values

[27] Observe the following code and select the code which returns Output only True:

import pandas as pd
df=pd.DataFrame()

a) df.hasnans

b) df.empty

c) df.fill(False)

d) df.values(False)

[28] Which of the following method is used to checks that a specific column has NaN element or not?

a) df[‘col’].isnull()

b) df[‘col’].hasnans()

c) df[‘col’].null=True

d) df[‘col’].NaN=True

[29] Akashat has created a datframe with 7 rows and 4 columns. He wanted to extract the top 6 rows from the dataframe. But he forgets to pass 6 as an argument in the df.head() function. How many rows are displayed by default in the output?

a) 3

b) 2

c) 0

d) 5

[30] Devarsh is a class teacher of class XII D. She has created a dataframe in python where she stored the average temperature of students. Now the academic supervisor asked her for the 3 bottom averages of temperature from her. Suggest her the appropriate statement for the same.

a) df.tail(3)

b) df.bottom(3)

c) df.low(3)

d) df.under(3)

[31] The axis 0 always refers to _______ of the dataframe where as axis =1 always refers to _________ of the dataframe.

a) element, size

b) row, column

c) column, row

d) element, size

In the next section of Term 1 MCQs Informatics Practices Class XII, I will cover the questions from operations of rows and columns in dataframe for IP class 12.

MCQ questions based on Operations on rows and columns in Dataframe

[1] __________ results in display of retrieved records as per the range defined with the dataframe object.

a) fetching

b) slicing

c) query

d) command

[2] What will be the output of the following code:

import panadas as pd
d={'Name':['Raju','Mohini','Akshay','Ajay'],'City':['Bombay','Baroda','Bhuj','Surat'],'Score':[8,9,7.5,8.5]}
df=pd.DataFrame(d)
print(df[1:3])

a)

Name City Score
1 Mohini Baroda 9.0
2 Akshay Bhuj 7.5

b)

Name City Score
1 Mohini Baroda 9.0

c) Error

d) No output

[3] To retrieve a set of rows from dataframe, slicing can be used with ___________ label.

a) column

b) row

c) df

d) pdf

[4] The dataframe slicing using loc includes _________ values.

a) datatype

b) length

c) end

d) head

[5] By considering the above dataframe, what will be the output of df.loc[0:2,’city’]?

a) Error

b) No output as column label is given with row indices

c)

0 Bombay
1 Baroda
2 Bhuj
Name: City, dtype: object

d)

Name City
0 Raju Bombay
1 Mohini Baroda
2 Akshay Bhuj

[6] Sunita is class teacher of Class XII D and she has written the code for her dataframe to compute the result is resDF.loc[‘Maths/IP/PHE’:’Eng’,[‘Anand’,’Dhara’,’Dhwani’]]. The row indexes are as Eng, Acc, BS, Eco, Maths/IP/PHE What will be the impact of this line?

a) Error

b) No Error, No output

c) Display the result but empty dataframe

d) Display the result by showing Maths/IP/PHE on top than another subject in reverse order

[7] Priya wants to change the index column of the particular dataframe. which of the following statement is correct?

a) df.set_index(‘Name’)

b) df.set_index(‘Name’,inplace=True)

c) df.setindex(‘Name’,0)

d) Error

[8] Mandeep is trying to access row-wise data from dataframe. Which of the following function is very helpful to do the same?

a) iterrows()

b) iteritems()

c) rowwise()

d)row_date()

[9] To access column-wise data from dataframe which of the following function is used?

a) iterrows()

b) itercols()

c) iteritems()

d) itercolumns()

[10] Mukesh is working in a program of dataframe. Where he just added a row at last. Observe the following dataframe and select the statement which adds a row at the end of the dataframe:

Ouptut 5 Add single row into dataframe using append() method

a) df.add({‘Name’:’Firoz’,’Eng’:76,’Maths’:80,’IP:84′})

b) df.append( {‘Name’:’Firoz’,’Eng’:76,’Maths’:80,’IP:84′})

c) df.append({‘Name’:’Firoz’,’Eng’:76,’Maths’:80,’IP:84′},ignore_index=True)

d) df[{‘Name’:’Firoz’,’Eng’:76,’Maths’:80,’IP:84′}]

[11] Consider the above dataframe and select the correct statement to add row at specific index using loc:

a) df.loc[index]=[col1,col2,col3,..]

b) df.loc[:] =[col1,col2,col3,..

c) df.loc[index].append({key:val;key:val})

d) All of these

[12] Amit wants to add a row on top of the dataframe. The data is: Anu,76,72,73. Which of the following statement is correct to add row:

a) df.locP{0} = [‘Anu’, 76, 72, 73]

b) df.loc(0)= [‘Anu’,76,72,73]

c) df.loc<0>=[‘Anul’,76,72,73]

d) df.loc[0] = [‘Anu’,76,72,73]

[13] Which of the following is correct statement to add a column remarks with similar data “Good”?

a) df[‘Remarks’]=”Good”

b) df(remarks)=”Good”

c) df{‘Remarks’:’Good’}

d) df.addColumn(‘Remarks’:’Good’)

[14] Observe the following dataframe and choose the correct answer for the given question:

     Name    Eng  Maths IP
0    Abhay   66     85  95
1   Bharat   69     82  82
2   Chandu   75     84  63
3  Dharmik   74     80  84
4    Ervin   70     75  90

Add a column for Physics named Phy with values 89, 83,65,80 and 90 respectively.

a) df.’Phy’=[89,83,65,80,90]

b) df={‘Phy’:[89,83,65,80,90]}

c) df.append({‘Phy’:[89,83,65,80,90])

d) df[‘Phy’] = [89,83,65,80,90]

[15] Ruma wants to insert a column at a specified column index in the data frame. But she don’t know which function is used to do that. Select the appropriate function for the same.

a) append()

b) at()

c) insert()

d) iat()

[16] Consider the dataframe given in question 14 above and select the correct statement to insert a new column after Maths with data 81,75,73,65 and 69.

a) df.insert(‘Phy’,[81,75,73,65,69])

b) df.insert(3,’Phy’,[81,75,73,65,69])

c) df.insert(3,{‘Phy’:[81,75,73,65,69]})

d) df.insert(3,[81,75,73,65,69],’Phy’)

[17] If the column is already exists in the dataframe then assignment statement will

a) delete the existing column and add a new column to the last

b) keep the old column and add a new column at the last

c) replace the existing column at the beginning

d) update the values in the same column

[18] What will be the output of the following code:

import pandas as pd
df=pd.DataFrame({'Name':['Virat','Rohit','Shikhar'],'Runs':[1122,897,789]})
print(df.Runs)

a) Runs=[1122,897,789]

b)

           Runs
Virat      1122
Rohit       897
Shikhar     789
Name:Runs, dtype:int64

c)

0    1122
1     897
2     789
Name: Runs, dtype: int64

d)

           Runs
Virat      1122
Rohit       897
Shikhar     789
Name:Runs, dtype:int64

[19] Observe the following datafame:

         Arti Ramesh Smriti  Riya Mallika Preeti
Maths     0     0      0       0     0      0
Science   91   81     91      71     95    78
Hindi     97   96     88      67     99    76
English   95   86     95      80     95    99

Which of the following statement performed by the user to set all 0s ?

a) df.loc[0] = 0

b) df[1] = 0

c) df.iloc[‘Maths’] = 0

d) df.loc[‘Maths’] = 0

[20] If the user is trying to add a row with lesser values than number of columns in dataframe, it results into

a) add a row with NaN value in place of missing values

b) Raise an error – ValueError

c) add a row with 0 value in place of missing values

d) raise an error – KeyError

[21] Which of the following statement set all the values to 0 to the entire dataframe elements?

a) df = 0

b) df.all=0

c) df[:]=0

d) df[]=0

[22] Which of the following method is used to delete rows or columns from the dataframe?

a) delete

b) drop

c) remove

d) erase

[23] To delete a row from daraframe the parameter axis should be

a) 0

b) 1

c) True

d) False

[24] To delete a column from data frame the parameter axis should be

a) 0

b) 1

c) True

d) False

[25] Nilima wants to return the values from the first row of a pandas dataframe df. Which of the following code is correct for her?

a) df[0]

b) df.loc[1]

c) df.loc[0]

d) df.iloc[0]

[26] Dhruva wants to delete row 3 and 7 from the dataframe df. Which of the following command is correct?

a) df.drop([3,7],axis=1)

b) df.drop([3,7],axis=0)

c) df.drop([2,6],axis=0)

d) df.drop([2,6],axis=1)

[27] Ananta wants to delete a column named ‘remarks’ from the dataframe df. Which of the following option is correct?

a) df.drop(‘remarks’,axis=1)

b) df.drop(df[‘remarks’],axis=1)

c) df.drop((‘remarks’),axis=1)

d) df.drop([‘remarks’],axis=1)

[28] Which of the following is correct syntax for pop() method to delete a column named ‘AY2021’ fro dataframe df?

a) df.pop(‘AY2021’)

b) df.pop([‘AY2021’])

c) df.pop({‘AY2021’})

d) df.pop(AY2021)

[29] Consider the following dataframe and choose the correct output for the following command:

          PT 1                 PT 2
0           25                   22
1           20                   19
2           15                   17
3           10                   12



           PT 1                 PT 2
0           23                   24
1           29                   NaN
2           NaN                  14
3           13                   10


print(df.add())


a)

PT1 PT2
0 48.0 46.0
1 49.0 NaN
2 NaN 31.0
3 23.0 22.0

b)

PT1 PT2
0 48.0 46.0
1 49.0 0
2 0 31.0
3 23.0 22.0

c)

PT1 PT2
0 48.0 46.0
1 49.0 None
2 None 31.0
3 23.0 22.0

d)

PT1 PT2
0 48.0 46.0
1 49.0
2 31.0
3 23.0 22.0

[30] Consider the following code and predict the output:

import pandas as pd
df=pd.DataFrame([[2,3,4],[1,5,6]])
print(df+[10,20,30])

a) Error

b)

  0      1      2
0 12    23    34
1 11    25    36

c)

   0      1      2
0  2      3      4
1  4      5      6 

d)

0 1

0 12 11

1 23 35

2 34 36

[31] _____________ refers to have an index with True or False index values.

a) Boolean Reduction

b) Boolean Indexing

c) Boolean Dataframe

d) Boolean Iteration

[32] Which of the following is the correct syntax for assigning boolean indexing to dataframe df?

a) df=pd.DataFrame([[2,3,4],[5,6,7]],index=[0,1])

b) df=pd.DataFrame([[2,3,4],[5,6,7]],index=[T,F])

c) df=pd.DataFrame([[2,3,4],[5,6,7]],index=[True, False])

d) df=pd.DataFrame([[2,3,4],[5,6,7]],index=[‘true’,’false’])

[33] Consider the following datafrme and write the output of the below given statement:

import pandas as pd
df=pd.DataFrame([[2,3,4],[5,6,7]],index=[True,False])
print(df)
print(df.loc[0])

a)

0 2
1 3
2 4
Name: True, dtype: int64

b)

0 5
1 6
2 7
dtype: int64

c) No output

d) ValueError

[34] Which of the following statements prints the same output for the above data frame?

A) df.loc[True]

B) df.loc[1]

C) df.iloc[0]

a) All of the above

b) Only A and B

c) Only B and C

d) Only C and A

[35] Observe the following data frame and code, answer the below-given question based on the same:

        Active        Recovered
Guj     256             350
Mah     370             492
Pun     333             311

import pandas as pd
df=pd.DataFrame([[256,350],[370,492],[333,311]],
Index =__________)#statement 1
df. ______ =['Active','Recovered'] #statement 2
print(df)

[1] Select the correct code for statement 1:

a) {Active:Guj,Active:Mah,Active:Pun}

b) [‘Guj’,’Mah’,’Pun’]

c) (‘Guj’,’Mah’,’Pun’)

d) [Guj,Mah,Pun]

[2] Which of the following is correct for statement 2?

a) rows

b) columns

c) cols

d) axes

[3] Which of the command is correct to rename the active column to current?

a) df=df.rename(columns={‘Active’:’Current’})

b) df=df.rename(cols=[‘Active’,’Current’])

c) df=df.rename(column={‘Active’:’Current’})

d) df=df.rename(col={‘Active’:’Current’})

[36] A dictionary named clients contains the following data:

clients = {'Name':['Lavanya','Mansi','Manoj','Harish'],'Status':['Paid','Unpaid','Paid','Unpaid']}

Select the appropriate answer for the below given questions:

[1] Select the proper answer for creating a dataframe df:

a) df=pd.Dataframe(clients)

b) df=pd.dataframe(clients)

c) df=pd.DataFrame(clients)

d) df=pd.DataFrame(‘clients’)

[2] Add column remarks with following data: [‘Remarks’, None, ‘Pay Next Month’,None,’No Respnonse’]

a) clients.append(‘Remarks’,[None,’Pay Next Month’,None,’No response’],ignore_index=True)

b) clients[‘Remarks’] = [None,’Pay Next Month’,None, ‘No Response’]

c) clients.add({‘Remarks’:[Nonw,’Pay Next Month’,None,’No Response’]})

d) clients.loc[‘Remarks’]= [None,’Pay Next Month’,None, ‘No Response’]

[3] Select the correct statement to delete 2nd row:

a) del df[1]

b) df.drop[1]

c) df.drop([1])

d) df.remove(row1)

[4] What will be the output of the following code:(Consider initial data only)

df.shape()

a) (4,2)

b) (2,4)

c) [2,4]

d) [4,2]

[5] Lakhan wants to know what is a dataframe? Select the correct statement for him

a) homogeneous data in 1D structure

b) heterogeneous data in 2D structure

c) Both a) and b)

d) None of these

[6] Observe the following code and select the correct option for the output:

import pandas as pd
df=pd.DataFrame()
print(df.empty)

a) Empty

b) True

c) Null

d) None

[7] Divya wants to delete a column from a dataframe using drop() method. She doesn’t know the number of minimum parameters are required for the drop() function. Help her by selecting the correct option:

a) One

b) Two

c) Three

d) Four

[8] Which of the following is not a correct code to delete column named ‘city’ from dataframe df?

a) del df[‘city’]

b) df.pop(‘city’)

c) df=df.drop([‘City’],axis=1)

d) df=df.drop([‘City’],axis=0)

[9] Which statement is correct for pop() function ?

a) The pop() function is used to delete only single column from dataframe

b) The pop() function is used to delete only single row from dataframe

c) The pop() function only delete the top row

d) The pop() function only delete the first column

[10] The axis parameter in drop method while dropping a column is

a) Mandatory

b) Not mandatory

c) Mandatory when deleting the first column

d) Mandatory when deleting the last column

[12] Divya wanted to change the value of index 2 of series S to 13 select the correct code

a) S{2:13}

b) S(2) = 13

c) S[2]=13

d) S<2>=13

[13] Observe the following code to display all the values of series S, select the appropriate answer:

i) S[0:]

ii) S[:]

iii) S[:0]

iv) S[::0]

a) Only i

b) Only i and ii

c) Only i, ii and iii

d) All are true

[14] Observe the following code:

s=pd.Series([1,2,3,4],index=[-4,-3,-2,-1])

a) The statement will create a series successfully

b) The statement will raise an error

c) The negative indexes cannot be used and created

d) None of these

[15] Observe the following series S:

IndexValues
0Ahmedabad
1Baroda
2Surat
3Surendranagar
4Banaskantha

What will be the output of the following code:

for s in S:
  if s>6:
     print(s*2)

a) BarodaBaroda

b) BarodaBaroda

SuratSurat

c) AhmedabadAhmedabad

SurendranagarSurendraNagar

BanaskanthaBanaskantha

d) None of these

[16] Consider the following dataframe:

df=pd.DataFrame({'GRNO':range(1001,1010,2),'RollNo':range(1,10,2)})

What will be the output of the following code:

print(df.size)

a) 5

b) 10

c) 4

d) 8

[17] What will happen to dataframe df, when the statement is written df+2

a) It will update the dataframe by adding value to each element

b) Will only add +2 value in each value in every column

c) Will only add +2 value in each value in first column

d) None of these

[18] Observe the given series friends, which command is used to print (4,) as output :

Jayesh Bharuch

Vishal Ahmedabad

Vijay Ahmedabad

Bhargav Baroda

a) df.size

b) df.index

c) df.values

d) df.shape

[19] Read the statement and choose the answer:

Statement A: The size attributes returns the total number of elements from dataframe

Statement B: The index attributes returns only numeric indexes of dataframe

a) Only Statement A is wrong

b) Statement A and Statement B are wrong

c) Only statement B is wrong

d) All statements are correct

[20] The head() function requires _____ number of minimum parameters

a) No parameter

b) 1

c) 2

d) 3

[21] The user index can be created by using which of the following property?

a) Index

b) idx

c) indices

d) index

Now in the next section of Term 1 MCQs Informatics Practices Class XII I will provide you MCQ from data visualization topic.

[1] ___________ helps in better understanding of results of the analysis.

a) Data Abstraction

b) Data Handling

c) Data Visualization

d) Data Hiding

[2] Which of the following features represents data using a graph, chart?

a) Data Visualization

b) Data Mining

c) Data Handling

d) Data Pictorization

[3] Statement A: Data visualisation means graphical or pictorial representation of the data using graph, chart, etc.

Statement B: The purpose of plotting data is to visualise variation or show relationships between variables.

a) Statement A is correct

b) Statement B is correct

c) Both Statement A and Statement B is correct

d) Both Statement A and B are incorrect

[4] Which of the following is not an example of visualization?

a) Traffic Symbols

b) Ultrasound reports

c) Atlas book of maps

d) Data Structure

[5] Observe the following statement:

import matplotlib.pyplot as pp

Where matplotlib is ______________ and pyplot is ________________

a) module, library

b) library, module

c) package, library

d) library, package

[6] Which of the following command is the correct command to install matplotlib library?

a) install matplotlib

b) install pip matplotlib

c) pip install matplotlib

d) matplotlib install pip

[7] Observe the following line and identify the alias name from it

import matplotlib.pyplot as plt

a) import

b) matplotlib.pyplot

c) as

d) plt

[8] Statement A: It is mandatory to use alias name while importing matplotlib.pyplot library.

Statement B: Alias name should be plt only for matplotlib.pyplot.

a) Only Statement A is Wrong

b) Only Statement B is Wrong

c) Statement A and B are wrong

d) Statement A and B are Right

[8] Which of the following is a module of matplolib that contains a set of functions for data visualization?

a) plt

b) pandas

c) plot

d) pyplot

[9] Which of the following function of the pyplot module creates a figure?

a) plot()

b) savefig()

c) figure()

d) fig()

[11] Ms. Rama is confused about the window where the outputs of pyplot functions are plotted. Select the an appropriate answer to clear her confusion.

a) Plot

b) Figure

c) Window

d) All of these

[12] Which of the following is not a part of the figure?

a) legend

b) axis labels

c) chart area

d) ticks

[13] The plot function requires at least 2 parameters.

a) Yes

b) No

c) Maybe

d) Can’t say

[14] Statement A: It is always expected that the data presented through charts easily understood.

Statement B: While presenting data one should give a chart title, label of the axis and provide the legend.

a) Only Statement A is correct

b) Only Statement B is correct

c) Both statements A and B are correct

d) Both statements A and B are incorrect

[15] Which of the following function is used to display the figure created by the plot() function?

a) show()

b) savefig()

c) display()

d) show_plot()

[16] A figure can be saved by using _________ function.

a) save_figure()

b) savefig()

c) save_fig()

d) fig()

[17] The plot() of pyplot module will plots a ___________ chart by default.

a) bar

b) histogram

c) line

d) scatter

[18] The savefig() function requires

a) Filename with location

b) no parameter

c) Filename with location and file size

d) None of these

[19] Which of the following function is not used to customize the plot?

a) grid()

b) xlabel()

c) title()

d) chartformat()

[20] To display legends on the chart you must add

a) colours

b) labels

c) markers

d) linestyles

[21] The title() function is used to

a) give a suitable title for the chart

b) give a suitable title to x, y and chart

c) give a title for filename

d) give a title to data ranges

[22] To set the current tick location and label of x-axis which of the follow function is used

a) x_ticks()

b) xlabel()

c) x-ticks()

d) xticks()

[23] Observe the following output and select the correct option for the answer:

data visualization - Term 1 MCQs Informatics Practices Class XII

i) Select the correct code for plotting data

a) d=[“28/11″,”29/11″,”30/11”]
t=[24,22.5,26]
plt.plot(d, t)

b) d=[“28/11″,”29/11″,”30/11”]
t=[24,22.5,26]
plt.plot(t,d)

c) d={“28/11″:24,”29/11″:22.5,”30/11”:26}

plt.plot(d)

d) None of these

[24] A chart contains

a) A line with different colors

b) Bars without any colour

c) different bars with different colours

d) Bars with an outline only

[25] The pyplot module is part of

a) NumPy Library

b) matplotlib library

c) pandas library

d) CSV library

[26] Which of the following letter is used to apply black color to the line in line chart

a) c

b) b

c) k

d) l

[27] Which of the following statement is the correct statement to represents countries on the x-axis and label them “countries”

a) plt.title=”Countries”

b) plt.label=”Countries”

c) plt.caption=”Countries”

d) plt.xlabel=”Countries”

[28] Shiv wants to change the width of the bar on bar chart. Select the appropriate attribute for the same.

a) size

b) width

c) thickness

d) breadth

[29] Which of the following customization can be controlled on bar graph?

i) edgecolor

ii) bins

iii) linestyle

iv) linewidth

a) i, ii and iii

b) i, ii and iv

c) i, iii and iv

d) ii , iii and iv

[30] Select the correct code for the following bar graph:

300+ Important Informatics Practices Class XII MCQs

a)

import matplotlib.pyplot as plt
import numpy as np
cities=['Ahmedabad','Baroda','Bhuj','Surat','Anand']
population=[200000,180000,150000,170000,100000]
plt.barh(cities,population)
plt.show()

b)

import matplotlib.pyplot as plt
import numpy as np
cities=['Ahmedabad','Baroda','Bhuj','Surat','Anand']
population=[200000,180000,150000,170000,100000]
plt.bar(cities,population)
plt.show()

c)

import matplotlib.pyplot as plt
import numpy as np
cities=['Ahmedabad','Baroda','Bhuj','Surat','Anand']
population=[200000,180000,150000,170000,100000]
plt.barh(population,cities)
plt.show()

d)

import matplotlib.pyplot as plt
import numpy as np
cities=['Ahmedabad','Baroda','Bhuj','Surat','Anand']
population=[200000,180000,150000,170000,100000]
plt.bar(cities,population)
plt.show()

[31] Which of the following statement is correct for histograms?

a) Represents the categorical data with rectangular bars

b) Two-dimensional data visualization that uses dots to represent the values obtained for two different variables

c) Circular plot divided into slices to show numerical proportion

d) An accurate graphical representation of the probability distribution of numeric data

[32] The histogram was introduced by

a) John Smith

b) Karl Pearson

c) Kevin Peterson

d) John McCarthy

[33] The proportion of the data set falls into each category specified as non-overlapping intervals are called

a) bars

b) legend

c) bins

d) axis

[34] Statement A: To make a histogram, the data is sorted into bins and the number of data points in each bin is counted.

Statement B: The height of each column in the histogram is then proportional to the number of data points its bin contains.

a) Only Statement A is Correct

b) Only Statement B is Correct

c) Both statements are correct

d) Both statements are incorrect

[35] The bins are

i) Range of values into series of intervals

ii) specified as consecutive, non-overlapping intervals of a variable

iii) must be adjacent and often of equal size

a) i Only

b) i and ii

c) i, ii and iii

d) None of these

[36] Which of the following code is correct for bins parameter

i) df.plot(kind=’hist’, bins=20)

ii) df.plot(kind=’hist’, bins=[11,18,25,25,22])

iii) df.plot(kind=’hist’, bins=range(10,35))

iv) df.plot(kind=’hist’,bins={‘start’:1,’stop’:5,’step’:1})

a) i and ii only

b) All are correct

c) i, ii and iv

d) i, ii and iii

[37] Which of the following is component of histogram represents bins?

a) Height and width of bars

b) Title

c) Axis

d) Data

[38] By default histogram uses a bin value of

a) 0

b) 1

c) 10

d) 30

[39] The X-Axis is about ___________in histogram.

a) bin ranges

b) frequency

c) width

d) height

[40] The frequencies are represented on ____________ in histogram.

a) data labels

b) Y-axis

c) X-axis

d) Legeneds

[41] Vivek wants to display the bar colour on the histogram but he is confused about the parameter. Select the correct parameter:

a) edgecolor

b) barcolor

c) color

d) facecolor

[42] The colour of borders of bars can be applied using __________ parameter in the histogram.

a) bordercolor

b) edgecolor

c) outlinecolor

d) linecolor

[43] Statement 1: When the cumulative is provided True then bins are calculated where each bin gives the counts in that bin plus all bins for small values.

Statement 2: The last bins give the maximum possible value for data points.

a) Only Statement A is wrong

b) Only Statement B is wrong

c) Statement A and B are wrong

d) Statement A and B are right

[44] The default histtype is

a) bar

b) barstacked

c) step

d) stepfilled

[45] Bhavin Patel is working in the software development industry. He was preparing a chart to compare the demanding software on basis of their online rating.

300+ Important Informatics Practices Class XII MCQs

He has written the following code. Help him by filling the gaps given in the code to get their desired output.

import __________ as plt #Statement 1 - import library and module for data visualization
software=["ERP","SAP","JIRA","CRM","Trello"]
rating=[5.0,4.7,4.9,3.5,4.4]
plt.________________ #Statement 2 - Plot Software and rating
plt._______________ #Statement 3 - Horizontal Bar Label as Software
plt.___________#Statement 4 - Vertical Bar Label as rating
plt._________ #Statement 5 - Display the chart

i) Which of the following is correct for statement 1?

a) matplotlib.pyplot

b) matplotlib

c) pyplot

d) matplotlib.plt

ii) Select the appropriate code for statement 2:

a) plt.bar(rating,software)

b) plt.plot(software,rating)

c) plt.bar(software,rating)

d) plt.barv(software,rating)

iii) Which of the following code is correct for statement 3?

a) plt.xlabel(‘Software’)

b) plt.ylabel(‘Software’)

c) plt.xaxis(‘Software’)

d) plt.vaxis(‘Software’)

iv) Choose the correct code for statement 4

a) plt.xlabel(‘Rating’)

b) plt.ylabel(‘Rating’)

c) plt.xtitle(‘Rating’)

d) plt.ytitle(‘Rating’)

v) Choose the correct code for statement:

a) plt.display()

b) plt.open()

c) plt.plot()

d) plt.show()

[46] Raj has written code to create a bar graph for the following data:

StateXXII
Gujarat98.598.3
Punjab92.591.3
Kerala99.499.5
Bihar99.699.2
Rajasthan97.896.6
300+ Important Informatics Practices Class XII MCQs

Observe the following code and fill in the blanks with the appropriate option:

import matplotlib.pyplot as plt
states=['Gujarat','Punjab','Kerala','Bihar','Rajasthan']
per_x=[98.5,96.5,99.4,99.6,97.8]
per_xii=[98.3,95.3,99.5,99.2,96.6]
#plt.bar([0.5,1.5,2.5,3.5,4.5],_______,color='y',label="X",width=____)#Statement 1
#plt.bar([0,1,2,3,4],per_xii,______,width=.5,______) #Statement 2
pos=range(len(states))
#plt._______(______,states,fontsize=10)#Statement 3
plt.xlabel('States', fontsize=16)
plt.ylabel('Result', fontsize=16)
#plt._______ #Statement 4
plt.show()

i) Statement 1 to plot data of class 10 and width of the bars 0.5

a) per_x,.5

b) states,.5

c) per_x, 5.0

d) states, 5.0

ii) Statement 2 to apply line color magenta and label as XII

a) color=’m’, xlabel=’XII’

b) colour=’m’, label=’XII’

c) color=’m’, ylabel = ‘XII’

d) color=’m’, title=’XII’

iii) Statement 3 to lace xticks locations on bar

a) pos, per_x

b) pos, states

c) pos, per_xii

d) None

iv) Statement 4 to show legends

a) legend()

b) legends()

c) legends=true

d) showlegends()

v) Select code to data onto line chart

a)

plt.plot([0.5,1.5,2.5,3.5,4.5],per_x,color='y')
plt.xticks(range(len(states)),states)
plt.plot([0,1,2,3,4],per_xii,color='m',label='XII')
plt.xticks(range(len(states)),states)

b)

plt.plot(states,per_x,color='y',label='X')
plt.plot(states,per_xii,color='m',label='X')

c)

plt.plot([0.5,1.5,2.5,3.5,4.5],per_x,color='y',label='X')
plt.xticks(range(len(states)),states)
plt.plot([0,1,2,3,4],per_xii,color='m',label='X')
plt.xticks(range(len(states)),states)

d) None

In the next section of Term 1 MCQs Informatics Practices Class XII I am going to cover MCQs from Societal Impacts.

MCQ Societal Impacts

[1] Which of the following not a part of digital technologies?

a) Smartphones

b) Computers

c) Internet

d) FM Radio

[2] Which of the following activity does not create any digital footprint?

a) Search online information

b) Online Ticket Booking

c) Saving a word document

d) Responding an email

[3] Any information created on the web is known as

a) Soft Copy

b) Digital Footprint

c) Cyber Print

d) Online Print

[3] Which of the following data can be saved in the digital footprint?

a) IP Address

b) Location details

c) Other device-specific details

d) All of these

[4] Which of the following is/are ethical issues associated with Information Technology?

i) Personal Privacy

ii) Access Rights

iii) Harmful actions

a) Only i

b) Only i and ii

c) All of them i, ii and iii

d) None of them

[5] The digital footprint data could be used for

i) Targeted Advertisement

ii) Can be misused

iii) Can be exploited

a) ii and iii

b) i and iii

c) i and ii

d) i, ii and iii

[6] There are _____________ types of digital footprints.

a) 1

b) 2

c) 3

d) 4

[7] Archana has filled a form online for a survey. Which types of digital footprint she has generated while filling up the form?

a) Active

b) Passive

c) Valid

d) Invalid

[8] The active digital footprint includes

i) emails and their replies

ii) Social media status and posts

iii) data generated by a website or app

a) i and ii

b) ii and iii

c) i and iii

d) all of them

[9] Statement A: Everyone connected to the internet may have a digital footprint.

Statement B: With more and more usage of internet, the trail of digital footprint grows.

a) Statement A is Correct

b) Statement B is Correct

c) Statement A and Statement B are correct

d) Statement A and Statement B are incorrect

[10] Which of the following is not correct about about digital footprint?

a) User doesn’t have any control on how the that data will be used once stored on server

b) User can delete data anytime including digital footprint

c) These is no guarantee that digital footprints will fully eliminated from the internet

d) Digtial footprint can be used to trace location of the device and other usage details

[11] Anyone who is uses digital technology with internet is known as ______________

a) Digital Individual

b) Digital User

c) Digital Freind

d) Digital Citizen

[12] Digital citizen also knonw as ____________

a) e-User

b) e-Individual

c) netizen

d) net citizen

[13] A responsible netizen must abide by

i) net ettiquettes

ii) communication ettiquettes

iii) Social media ettiquettes

a) i and ii

b) ii and iii

c) i and iii

d) i, ii and iii

[14] Which of the following is not a net etiquette?

a) Be Ethical

b) Be Respectful

c) Be Responsible

d) Be Polite

[15] Which of the following is one of the best practices under be ethical net etiquette?

i) No Copyright Violation

ii) Share the expertise

iii) Respect Privacy

iv) Avoid Cyber bullying

a) i and ii

b) ii and iii

c) ii and iv

d) i and iv

[16] Statement A: You can use any image from google search pages into your project directly.

Statement B: You can use any audio, video or images from the internet directly.

a) Statement A is correct

b) Statement B is correct

c) Statement A and B Both are correct

d) Statement A and B both are incorrect

[17] Digital footprints are also termed as

a) Digital Stickers

b) Digital Footstep

c) Digital Tattoos

d) Digital Steps

[18] The apps and websites that use geo-location to detect a user’s location is which type of digital footprint?

a) Active digital footprint

b) Passive digital footprint

c) Valid digital footprint

d) On digital foorprint

[19] Writing in ALL CAPS is one net etiquette.

a) Yes

b) No

c) Not Sure

d) Don’t know

[20] Sending a large number of unsolicited emails are known as

a) Draft

b) Spam

c) Inbox

d) Sent

[21] Online protection refers to

i) The trails left online by users

ii) rules put in place to protect personal information

iii) ensure data remains in control while working online

iv) Secures sensitive data

a) i and ii

b) i, ii and iv

c) ii, iii and iv

d) ii and iv

[22] Elements of data that can cause substantial harm, embarrassment, inconvenience to an individual, if breached or compromised are called ___

a) Sensitive Data

b) Secured Data

c) Data Privacy

d) Ethical Data

[23] Which of the following are considered as unprotected data –

i) Physical Data loss

ii) Physical hardware loss

iii) Virus attack

iv) Targeted by hackers

v) DDOS attacks

a) i-ii-iii-iv

b) i – iii – iv – v

c) Only i – iii – v

d) ii – iv – v

[24] Anmol shared his article on the blog on how to make a recipe for paneer. He is an expert in cooking, shared true information and this type of recipe is not available on the internet. Which of the following net etiquette he has followed?

a) Be respectful

b) Be ethical

c) Be responsible

d) Be polite

[25] While personal communication with any digital citizen where the exchange of data happens for a specific cause. An individual should not share the images, documents, files, videos of this communication. This is called

a) Be respectful etiquette

b) Be ethical etiquettes

c) Be polite etiquette

d) Be responsible etiquette

[26] While using the internet and social media groups or public forum if an individual respects the opinion of others in terms of knowledge, experience, culture and other aspects are considered as

a) respect the privacy

b) respect the opinion

c) resect diversity

d) respect thoughts

[27] Cyberbullying refers to

a) respect each other’s privacy

b) do not share any personal content without any consent of the user

c) feeding the troll

d) posting content such as rumours, online threats, posting someone’s personal information, sexual harassment

[28] Statement A: Bullying online can have very serious implications on the victim.

Statement B: The actions of the user can be traced back using a digital footprint.

a) Statement A is correct

b) Statement B is correct

c) Both are correct

d) Both are not correct

[29] _________ is a person who deliberately sows discord on the Internet by starting quarrels or upsetting people, by posting inflammatory or off-topic messages in an online community, just for amusement.

a) Hacker

b) Cracker

c) Troll

d) Social Media influencer

[30] The best way to discourage a troll is

a) promote it by sharing

b) commenting your opinions

c) doing likes

d) not to pay attention to comments

[31] Mr. Satyaveer is reading only relevant emails and did not expect an instant response from the recipient. This practice is which of the following communication etiquette?

a) Be respectful

b) Be punctual

c) Be polite

d) Be precise

[32] Ms. Seema wants to send large files through email but large files are not allowed to attach with an e-mail account. Whats she can do now?

a) Send the Pendrive by courier

b) Save the file on the computer and wait for the recipient to visit her place

c) Upload the files on cloud shared storage like google drive, MS Once Drive, Dropbox etc. and send the link

d) Do not send any email

[33] Match the following with the service and company

1Google DriveaMircrosoft
2One DrivebYahoo
3DropBoxcGogole

a) 1 – c, 2 – a, 3 – b

b) 1 – b, 2 – a, 3 – c

c) 1 – c, 2 – b , 3 – a

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

[34] The communication etiquette where we should not be aggressive or avoid abusing language even if we don’t agree with other’s point of view is known as

a) Be precise

b) Be Credible

c) Be polite

d) Be secure

[35] The real-time chat, audio calls, videos call happening on the internet is

a) Synchronous Communication

b) Asynchronous Communication

c) Realtime Communications

d) Live Communication

[37] Asynchronous communication includes

a) chat, audio and video calls

b) email, forum post and comments

c) cookies, browser history and temporary files

d) Cloud Storage

[38] ____________ are the websites or applications that enable their users to participate in social networking by creating and sharing content with others in the community.

a) Blog

b) Community

c) Social Media

d) E-Commerce

[39] Which of the following statement(s) is/are correct for social media websites?

i) Platform encourage users to share

ii) Users can interact online with each other using social media apps or channels

iii) shape the outcome of politics, business, culture, education etc.

iv) No matter how genuine someone is appearing online, they might be pretending and hiding their real identity

a) a, ii and iii

b) i, iii and iv

c) ii, iiii and iv

d) All of the above

[40] __________________ can be implemented by encryption, authentication, and other secure methods to ensure data is accessible by the users.

a) Privacy of data

b) username and password

c) user safety

d) cybercrime

[41] __________ are legal documents that provide guidelines to the user on processing, storage and transmission of sensitive data.

a) cybercrime

b) hacking

c) authentication

d) data protection

[42] When someone comes out with a new idea, this new idea is that person’s

a) Copyright Material

b) Intellectual Property

c) Trademark

d) Patent

[43] Intellectual property refers to

a) inventions

b) literacy and artistic expressions

c) names and logos

d) All of the above

[44] The intellectual property is legally protected through

a) copyright

b) patents

c) trademarks

d) all of the above

[45] The copyright includes

a) rights to reproduce the work, distribute copies, copy or sell work like writing, photos, audio, video, artworks, software

b) right to prevent others from using, selling, or distributing the protected invention

c) c) Visual Symbol, word, name, design, slogan, label

d) d) Product, Idea, Thought

[46] Divya wrote a storybook named ‘CyberStories’. It would be an infringement of the writer’s ___________ if someone use any part of this book without the written permission of the author.

a) license

b) copyright

c) patent

d) trademark

[47] ___________________ is usually granted for intbentions.

a) copyright

b) trademark

c) patent

d) license

[48] A patent protects an invention for how many years?

a) 10 Years

b) 15 Years

c) 20 Years

d) 25 Years

[49] Which of the following website did not offer open/public licensing content?

a) ceativecommons.org

b) pixabay.com

c) gnu.org

d) Goolge

[50] The fraudulent process that extract money from an individual by using creadit card, debit card or any oher online meium is known as _____.

a) digital footprint

b) Cyber Crime

c) Phishing

d) Hacking

Kindly provide feedback:

Please rate our website(required)