Class 12 Informatics Practices Sample Paper Term 1 With Solutions Set A

Sample Paper Class 12

Section A

Question 1. In which of the following format, Pandas does not allow reading and writing?
(a) int
(b) float
(c) double
(d) All of these formats are allowed

Answer

D

Question 2. Which of the following statement(s) is/are incorrect?
(a) A column of a dataframe can be deleted.
(b) A column of a dataframe can be deleted, if it carries no data.
(c) A column of a dataframe can be deleted, if it carries NaN values.
(d) Columns of dataframes cannot be deleted.

Answer

D

Question 3. The pop() function when used to remove a column from a dataframe requires a minimum of ………… parameters.
(a) 2
(b) 1
(c) 3
(d) 0

Answer

B

Question 4. A series is created with 5 integers as:
import pandas as pd
Nseries=pd.Series([22,44,55,33,66])
print(Nseries.nbytes)
Find the output of the above code.
(a) 15
(b) 10
(c) 20
(d) 25

Answer

C

Question 5. Which of the following cannot be the name of a series?
(a) NaN
(b) int
(c) True
(d) None of the above can be the name of a series

Answer

D

Question 6. Priya created a series using the pandas object “pd” ,storing the names of some ornaments as values, now she wants to see what are the indexes assigned by Python to the elements of series. The command she would write
(a) pd.index
(b) pd.indices
(c) pd.indexes
(d) Both (a) and (b)

Answer

A

Question 7. Find the output of the statement df.loc[:], where df is a dataframe.
(a) Produces error
(b) Displays the 1st row only
(c) Displays the last column only
(d) Displays all the rows and columns

Answer

D

Question 8. While creating a dataframe Sunil wanted to specify the datatype , which property will help him to do so?
(a) datatype
(b) type
(c) dtype
(d) dt

Answer

C

Question 9. Which of the following is not a vector operation on a series “S1”?
(a) S1+10
(b) S1*10
(c) S1**10
(d) All of the above are vector operations

Answer

D

Question 10. To provide user defined column indexes to a dataframe, the property used is
(a) colindex
(b) index
(c) columns
(d) colindices

Answer

C

Question 11. Electronic discovery technique used to determine and reveal technical criminal evidence is called
(a) cyber investigation
(b) cyber evidence
(c) cyber forensics
(d) cyber intrude

Answer

C

Question 12. The term phishing is synonymous to the term
(a) spoofing
(b) spooling
(c) stalking
(d) None of these

Answer

A

Question 13. The laws that deal with regulating , storing and using personally identifiable information of individuals , which can be collected by government , public organisations, etc., are called
(a) cyber laws
(b) court laws
(c) IT laws
(d) privacy laws

Answer

D

Question 14. The function that iterates vertically over the columns of a dataframe is
(a) itercols()
(b) iterrows()
(c) iteritems()
(d) loopcols()

Answer

C

Question 15. Kaustubh wants to know about the features of open data. Which of the following is not the feature of open data?
(a) Open availability
(b) Accessibility
(c) Universal participation
(d) None of these

Answer

D

Question 16. What does a CC license mean?
(a) Carbon Copy
(b) Common Copy
(c) Creative Cost
(d) Creative Common

Answer

D

Question 17. The statements
i.df.count()
ii.df.count(0)
where, df is a dataframe.
(a) It will produce same output
(b) It will have different outputs
(c) It will display number of columns
(d) None of these

Answer

A

Question 18. Which of the following is not a case of cyber fraud?
(a) Non-delivery of goods / service
(b) Credit/Debit card fraud
(c) Spamming
(d) Misbehaviour in a public place

Answer

D

Question 19. The statement :
Empdf.loc[1:1,‘class’]
where, Empdf is a dataframe. It will display
(a) indexes and values in class column of dataframe Empdf
(b) values in class column of dataframe Empdf
(c) index and value of row index 1 in class column of dataframe Empdf
(d) No output

Answer

C

Question 20. In proprietary licenses , the exclusive rights of the software are retained with the
(a) user
(b) owner/developer
(c) government
(d) software installer

Answer

B

Question 21. Which of the following is not a benefit of proprietary softwares?
(a) Creates jobs for developers
(b) Service and support
(c) Needs to be bought
(d) Both (b) and (c)

Answer

C

Question 22. GPL stands for
(a) Government’s Public License
(b) Gifted Proprietary License
(c) General Public License
(d) None of these

Answer

C

Question 23. Given the code :
import pandas as p1
Lst1=[1,2,3] #Line 2
Lst2= list(‘ABC’) #Line 3
S1= p1.Series( Lst1, rows=Lst2) #Line 4
To create the series properly, the correction is
(a) No correction required
(b) ‘rows’ to be replaced by ‘indices’
(c) ‘rows’ to be replaced by ‘index’
(d) ‘Series’ to be replaced by ‘series’

Answer

C

Question 24. The role of pip program is
(a) install only
(b) download only
(c) download and install
(d) running a .py file

Answer

C

Question 25. A CSV file can be read without header using the attribute
(a) header=None
(b) noheader
(c) header = NIL
(d) header=1

Answer

A

Section B

Question 26. A series “Hospital” stores the data of doctors as follows :
Index           Values
‘ENT’         ‘Dr. Rakesh’
‘Ortho’       ‘Dr. Priya’
‘Skin’         ‘Dr.John’
To create the above series, the statement would be (assume pandas is imported as pd)
(a) Hospital=pd.Series([‘Dr. Rakesh’, ‘Dr. Priya’, ‘Dr.John’],index=[‘ENT’,‘Ortho’, ‘Skin’])
(b) Hospital=pd.series([‘Dr. Rakesh’, ‘Dr. Priya’, ‘Dr.John’],index=[‘ENT’,‘Ortho’, ‘Skin’])
(c) Hospital=pd.createSeries([‘Dr. Rakesh’, ‘Dr. Priya’, ‘Dr.John’],index=[‘ENT’,‘Ortho’,‘Skin’])
(d) Hospital=pd.Series([‘Dr. Rakesh’, ‘Dr. Priya’, ‘Dr.John’],indexes=[‘ENT’,‘Ortho’, ‘Skin’])

Answer

A

Question 27. Given below is a code , identify the error in it.
import pandas as p
S1=p.Series([1,2,3,4])–
S1.index=[12.13.14.15]
(a) Index cannot be assigned after creation
(b) Correct code
(c) S1.indexes=[12.13.14.15]
(d) S1.index=[12,13,14,15]

Answer

D

Question 28. Given a dataframe gradedf:
import pandas as pd
gradedf=pd.DataFrame({‘Name’:[‘Rashmi’,‘Ani’,‘Sunil’,‘Becker’],
‘Grade’:[‘A’,‘B’,‘C’,‘D’]})
print(gradedf.iloc[0:2])
Find the output.
(a)     Name   Grade
    0   Rashmi    A
    1   Ani          B
(b)     Name      Grade
     0   Rashmi    A
(c)     Name     Grade
     1   Ani         B
(d) None of these

Answer

A

Question 29. The crimes for which cyber laws are enforced in India?
(a) IPR
(b) Data protection and privacy
(c) Robbery
(d) Both (a) and (b)

Answer

D

Question 30. Given below is a line chart showing sales of some automobiles.

Class 12 Informatics Practices Sample Paper Term 1 With Solutions Set A

The code for the above plot should be
(a) import matplotlib.pyplot
Labels=[‘Cars’,‘Bikes’,‘Cycles’,‘Scooters’]
Sales=[100,200,50,150]
plt.plot(Labels, Sales )
plt.show()
(b) import matplotlib.pyplot as plt
Labels=[‘Cars’,‘Bikes’,‘Cycles’,‘Scooters’]
plt.linechart(Labels, Sales ,marker=‘@’)
plt.show()
(c) import matplotlib.pyplot as plt
Labels=[‘Cars’,‘Bikes’,‘Cycles’,‘Scooters’]
Sales=[100,200,50,150]
plt.plot(Labels, Sales ,linestyle=‘dashed’,marker=‘*’)
plt.show()
(d)None of the above

Answer

C

Question 31. Read the statements given below and identify the right option.
Statement A Dataframes can store heterogeneous data.
Statement B Dataframes are immutable.
(a) Statement A is correct.
(b) Statement B is correct.
(c) Statement A is correct, but Statement B is incorrect.
(d) Statement A is incorrect, but Statement B is correct.

Answer

C

Question 32. The role of the rename() function is
(a) to rename the indexes of a series
(b) to rename a series
(c) to rename a CSV file
(d) Both (a) and (b)

Answer

A

Question 33. Which of the following is not done by cyber criminal?
(a) Stealing personal information
(b) Harassing
(c) Copyright infringement
(d) Anti-virus installation

Answer

D

Question 34. Given statements regarding risks faced by Internet users?
Statement A They get unwanted contacts.
Statement B They may receive inappropriate content.
Statement C They may loose their household articles.
Statement D Their computer systems may be stolen.
(a) Statement A and Statement B
(b) Statement B and Statement C
(c) Statement C and Statement D
(d) Statement B and Statement D

Answer

A

Question 35. Given the following code, where a series is created storing population of some cities:
import pandas as pd
popseries=pd.Series([34567,890,450,678,900])
print(popseries.tail(3).head(2))
The output of the code will be
(a) 1 450
     2 678
(b) 2 450
     3 678
(c) 3 678
(d) Empty set

Answer

B

Question 36. Which of the following is/are not feature(s) of Apache license?
(a) Rights are never ending
(b) Worldwise authority of rights
(c) Rights for no fee
(d) All of the above

Answer

D

Question 37. A series “parts” is created by statement as:
import pandas as ps
parts=ps.Series([10,20,30,40,50])
ps=ps/2
print(ps[ps>18])
What is the output of above code?
(a) Error in code
(b) Empty set
(c) 3 30
     4 40
(d) 5 40

Answer

A

Question 38. Adwares are
(a) malwares that delete files
(b) make duplicate of files
(c) damage the operating system
(d) display advertisements blocking the view

Answer

D

Question 39. A dataframe “Mdf” has the columns “Model”,”Modelname”,”Price” . A command to display the column Price is
(a) Mdf[‘Price’]
(b) Mdf[2]
(c) Mdf[3]
(d) None of these

Answer

A

Question 40. Given the code :
import pandas as ps
parts=ps.Series([10,20,30,40,50],index=[‘p’,‘q’,‘r’,‘s’,‘t’])
parts=parts/2
print(parts[parts>18])
The output of the above code is
(a) s 20.0
      t 25.0
(b) s 22.0
      t 27.0
(c) s 25.0
      t 25.0
(d) None of these

Answer

A

Question 41. The ways to avoid plagiarism are
(a) use own words
(b) always provide reference of the source
(c) use someone’s exact words in “quotes”
(d) All of the above

Answer

D

Question 42. Given the code :
import pandas as pd
tvdata={‘LED’:[‘Samsung’,‘LG’,‘BPL’], ‘OLED’:[‘Sony’,‘Toshiba’,‘Tata’],
‘Curved’:[‘Panorama’,‘Weston’,‘Microsoft’]}
tvdf=pd.DataFrame(tvdata,columns=[‘LED’,‘OLED’,‘Curved’])
print(tvdf.loc[1:,‘Curved’])
What will be the output of the code?
(a) 1 Weston
      2 Microsoft
(b) 1 Weston
(c) 2 Microsoft
(d) Error in code

Answer

A

Question 43. Given a dataframe “vaccine” store the following:
      TokenNo    Vaccine       Price
0    T567        Covaxin        780
1    T667        Covishield     900
2    T990        Sputnik V     1200
2    T990        Sputnik V      1200
The statement to increase the price of the vaccines by 10% will be
(a) vaccine=vaccine[‘Price’]+ 10%
(b) vaccine=vaccine[‘Price’]+ vaccine[‘Price’]*10/100
(c) vaccine=vaccine[‘Price’]+ vaccine[‘Price’]*0.1
(d) Both (b) and (c)

Answer

D

Question 44. Ankita created a dataframe “Teacher” storing data of teachers follows :
Index     TName    Dept       Salary
0           John        Physics   56000
1           Jack        CS            72000
2           Smriti      Maths     45000
She wrote the following commands :

Teacher[‘Salary’]=[56500,72500,45500]
Teacher=Teacher.reindex[2,1,0]
print(Teacher.loc[0:,‘Dept’]
(a) 0 Physics
(b) 2 Maths
(c) 0 Physics
     1 CS
     2 Maths
(d) Error in code

Answer

A

Question 45. A dataframe “States” contains data as follows :
      SName    covidcases
0    Punjab     2090
1    WB           1600
2    Kerala      4000
To write the dataframe to a CSV file “covid.csv”
(a) States.csv(‘c:\\covid.csv’)
(b) States.writedata(‘c:\\covid.csv’)
(c) States.to_csv(‘c:\\covid.csv’)
(d) None of the above

Answer

C

Question 46. Predict output of the following code :
s1=pd.Series([12,14,16,18],index=[‘a’,‘b’,‘c’,‘d’])
s2=s1+2
s2=s2**2
print(s2[2:6])
(a) c 324
     d 400
(b) c 196
     d 324
(c) Error
(d) None of these

Answer

A

Question 47. Which of the following are against cyber etiquettes?
(a) Writing in CAPS
(b) Posting private images
(c) Both (a) and (b)
(d) None of the above

Answer

C

Question 48. Given a dataframe “E-mail” having the following data:
Index      Domain     Passwordchars
0              G-mail         8
1              Rediff         12
2              Y-mail        10
The output of the code :
for pwd in Email[“Passwordchars”]:
if pwd>=10:
print(pwd)
(a) 10
    12
(b) Empty set
(c) Error in code
(d) 12

Answer

A

Question 49. Preeti wants to read data of some students from a CSV file “stud.csv”. She wants to
read only 3 records . Help her with the correct statement.
The records in the file are as follows :
Roll     Name             House
1         Priya              Ganga
2         Arunita         Yamuna
3         Pawandeep   Saraswati
(a) studdf=pd.read_csv(‘c:\\stud.csv’,rows=2)
(b) studdf=pd.read_csv(‘c:\\stud.csv’,nrows=3)
(c) studdf=pd.readfromcsv(‘c:\\stud.csv’,nrows=3)
(d) Both (b) and (c)

Answer

B

Section C

(Case Study Based Questions)

Mr. Ganesh wants to create a bar chart showing the names of some movies and number of peoples who viewed the movies.

Class 12 Informatics Practices Sample Paper Term 1 With Solutions Set A

The code he wrote is as follows :
import matplotlib.pyplot as plt
movies=(‘Comedy’,‘Action’,‘Romance’,‘Drama’,‘Fiction’)
x_pos=[1,2,3,4,5]
viewers=(12,15,2,6,9)
plt.barplot(x_pos,viewers,align=‘center’,color=‘magenta’)
                                                   # Line 1 To plot the bar chart
plt.xticks(x_pos,movies)
plt.label(‘Viewers’)                       # Line 2 To display a y-axis label
plt.label(‘Movies’)                        # Line 3 To display a x-axis label
plt.________(‘Movies Viewed’)     # Line 4 To display a chart title
_________.show() # Line 5 To display the chart

Question 50. The correct statement in Line1 would be
(a) plt.barchart(x_pos,types,align=‘center’,color=‘magenta’)
(b) plt.barplot(align=‘center’,color=‘magenta’)
(c) plt.bar(x_pos,viewers,color=‘magenta’)
(d) plt.barplot(x_pos,views,color=‘magenta’)

Answer

C

Question 51. The correct statement for Line 2 would be
(a) plt.label(‘Viewers’)
(b) plt. ylabel(‘Viewers’)
(c) plt.yaxislabel(‘Viewers’)
(d) None of these

Answer

B

Question 52. The correct statement for Line 3 would be
(a) plt.x_label(‘Movies’)
(b) plt.xlabel(‘Movies’)
(c) plt.labels(‘Movies’)
(d) plt.x-label(‘Movies’)

Answer

B

Question 53. The code in the blank at Line 4 would be
(a) title
(b) top
(c) heading
(d) None of these

Answer

A

Question 54. The statement for Line 5 would be
(a) plt
(b) show()
(c) matplotlib
(d) py

Answer

A

Question 55. The parameter to be added to get the boxplot colored is
(a) Color=True
(b) notch=True
(c) patch_artist=True
(d) colour=True

Answer

C