Professional Documents
Culture Documents
3. Which of the following libraries allows to manipulate, transform and visualize data
easily and efficiently.
a. Pandas
b. NumPy
c. Matplotlib
d. All of the above
7. Which of the following library in Python is used for plotting graphs and visualization.
a. Pandas
b. NumPy
c. Matplotlib
d. None of the above
11. A __________ is a collection of data values and operations that can be applied to that
data.
a. Data Structure
b. Data Frame
c. Table
d. None of the above
14. A Series by default have numeric data labels starting from ______________.
a. 3
b. 2
c. 1
d. 0
15. The data label associated with a particular value of Series is called
its ______________
a. Data value
b. Index
c. Value
d. None of the above
16. Which of the following module is to be imported to create Series?
a. NumPy
b. Pandas
c. Matplotlib
d. None of the above
17. Which of the following function/method help to create Series?
a. series( )
b. Series( )
c. createSeries( )
d. None of the above
19. When you print/display any series then the left most column is showing
_________ value.
a. Index
b. Data
c. Value
d. None of the above
20. How many values will be there in array1, if given code is not returning any error?
>>> series4 = pd.Series(array1, index = [“Jan”, “Feb”, “Mar”, “Apr”])
a. 1
b. 2
c. 3
d. 4
21. Which of the following statement will create an empty series named “S1”?
a. S1 = pd.Series(None)
b. S1 = pd.Series( )
c. Both of the above
d. None of the above
22. How many elements will be there in the series named “S1”?
>>> S1 = pd.Series(range(5))
>>> print(S1)
a. 5
b. 4
c. 6
d. None of the above
23. When we create a series from dictionary then the keys of dictionary
become ________________
a. Index of the series
b. Value of the series
c. Caption of the series
d. None of the series
27. Which of the following code will generate the following output?
Jan 31
Feb 28
Mar 31
dtype: int64
a.
import pandas as pd
S1 = pd.Series(data = [31,28,31], index=["Jan","Feb","Mar"])
print(S1)
b.
import pandas as pd
S1 = pd.Series([31,28,31], index=["Jan","Feb","Mar"])
print(S1)
c. Both of the above
d. None of the above
34. Which of the following statement is correct for importing pandas in python?
a. import pandas
b. import pandas as pd
c. import pandas as pds
d. All of the above
38. Write the statement to get NewDelhi as output using positional index.
import pandas as pd
S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'],
index=['India', 'USA', 'UK', 'France'])
a. print(S1[0])
b. print(S1[‘India’])
c. Both of the above
d. print(S1.India)
39. We can access elements in Series by using ________ index and ____________index.
a. Numeric, labelled
b. Positional, Naming
c. Positional, labelled
d. None of the above
41. Which of the following statement will print Series ‘S1’ in reverse order?
a. print(S1[: : 1]
b. print(S1[: : -1]
c. print(S1[-1: : 1]
d. print(S1.reverse( ))
42. How many values will be modified by last statement of given code ?
import pandas as pd
S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'],
index=['A', 'B', 'C', 'D'])
S1['A' : 'C'] = 'ND'
a. 1
b. 2
c. 3
d. 4
43. How many values will be modified by last statement of given code ?
import pandas as pd
S1 = pd.Series(['NewDelhi', 'WashingtonDC', 'London', 'Paris'],
index=['A', 'B', 'C', 'D'])
S1[1 : 3] = 'ND'
a. 1
b. 2
c. 3
d. 4
45. S1.values will return all the values of Series ‘S1’ in _________
a. Tuple
b. Dictionary
c. List
d. String
46. Which of the following property/attribute return total number of values in Series ‘S1’?
a. size
b. values
c. index
d. None of the above
47. Which of the following attributes returns True if there is no value in Series?
a. index
b. size
c. empty
d. values
48. Which of the following attributes returns all the values of Series?
a. size
b. index
c. name
d. values
6. The following code create a dataframe named ‘D1’ with _______________ columns.
import pandas as pd
D1 = pd.DataFrame([1,2,3] )
1
2
3
4
7. We can create DataFrame from _____
a. Numpy arrays
b. List of Dictionaries
c. Dictionary of Lists
d. All of the above
8. Which of the following is used to give user defined column index in DataFrame?
a. index
b. column
c. columns
d. colindex
9. The following code create a dataframe named ‘D1’ with ___________ columns.
import pandas as pd
LoD = [{‘a’:10, ‘b’:20}, {‘a’:5, ‘b’:10, ‘c’:20}]
D1 = pd.DataFrame(LoD)
a. 1
b. 2
c. 3
d. 4
10. The following code create a dataframe named ‘D1’ with ______ rows.
import pandas as pd
LoD = [{'a':10, 'b':20}, {'a':5, 'b':10, 'c':20}]
D1 = pd.DataFrame(LoD)
a. 0
b. 1
c. 2
d. 3
11. When we create DataFrame from List of Dictionaries, then dictionary keys will
become ____________
a. Column labels
b. Row labels
c. Both of the above
d. None of the above
12. When we create DataFrame from List of Dictionaries, then number of columns in
DataFrame is equal to the _______
a. maximum number of keys in first dictionary of the list
b. maximum number of different keys in all dictionaries of the list
c. maximum number of dictionaries in the list
d. None of the above
13. When we create DataFrame from List of Dictionaries, then number of rows in
DataFrame is equal to the ____________
a. maximum number of keys in first dictionary of the list
b. maximum number of keys in any dictionary of the list
c. number of dictionaries in the list
d. None of the above
14. In given code dataframe ‘D1’ has ________ rows and _______ columns.
import pandas as pd
LoD = [{‘a’:10, ‘b’:20}, {‘a’:5, ‘b’:10, ‘c’:20},{‘a’:7, ‘d’:10, ‘e’:20}]
D1 = pd.DataFrame(LoD)
a. 3, 3
b. 3, 4
c. 3, 5
d. None of the above
15. When we create DataFrame from Dictionary of List then Keys becomes the
_____________
a. Row Labels
b. Column Labels
c. Both of the above
d. None of the above
16. When we create DataFrame from Dictionary of List then List becomes the
________________
a. Row Labels
b. Column Labels
c. Values of rows
d. None of the above
17. In given code dataframe ‘D1’ has _____ rows and ______ columns.
import pandas as pd
LoD = {“Name” : [“Amit”, “Anil”,”Ravi”], “RollNo” : [1,2,3]}
D1 = pd.DataFrame(LoD)
a. 3, 3
b. 3, 2
c. 2, 3
d. None of the above
21. We can add a new row to a DataFrame using the _____________ method
a. rloc[ ]
b. iloc[ ]
c. loc[ ]
d. None of the above
22. D1[ : ] = 77 , will set __________ values of a Data Frame ‘D1’ to 77.
a. Only First Row
b. Only First Column
c. All
d. None of the above
23. In the following statement, if column ‘Rollno’ already exists in the DataFrame ‘D1’
then the assignment statement will _____________
D1['Rollno'] = [1,2,3] #There are only three rows in DataFrame D1'
a. Return error
b. Replace the already existing values.
c. Add new column
d. None of the above
24. In the following statement, if column ‘Rollno’ already exists in the DataFrame ‘D1’
then the assignment statement will __________
D1['Rollno'] = [1, 2] #There are only three rows in DataFrame D1'
a. Return error
b. Replace the already existing values.
c. Add new column
d. None of the above
25. Q26. In the following statement, if column ‘Rollno’ already exists in the DataFrame
‘D1’ then the assignment statement will __________
D1['Rollno'] = 11
a. Return error
b. Change all values of column Roll numbers to 11
c. Add new column
d. None of the above
28. To delete a row, the parameter axis of function drop( ) is assigned the value
______________
a. 0
b. 1
c. 2
d. 3
29. To delete a column, the parameter axis of function drop( ) is assigned the value
_____________
a. 0
b. 1
c. 2
d. 3
31. If the DataFrame has more than one row with the same label, then DataFrame.drop( )
method will delete _____
a. first matching row from it.
b. all the matching rows from it
c. last matching row from it.
d. Return Error
32. Write the code to remove duplicate row labelled as ‘R1’ from DataFrame ‘DF1’
a. DF1 = DF1.drop(‘R1’, axis = 0)
b. DF1 = DF1.drop(‘R1’, axis = 1)
c. DF1 = DF1.del(‘R1’, axis = 0)
d. DF1 = DF1.del(‘R1’, axis = 1)
33. Which method is used to change the labels of rows and columns in DataFrame?
a. change( )
b. rename( )
c. replace( )
d. None of the above
34. The parameter axis=’index’ of rename( ) function is used to specify that the ________
a. row and column label is to be changed
b. column label is to be changed
c. row label is to be changed
d. None of the above
35. What will happen if in the rename( ) function we pass only a value for a row label that
does not exist?
a. it returns an error.
b. matching row label will not change .
c. the existing row label will left as it is.
d. None of the above
36. What value should be given to axis parameter of rename function to alter column
name?
a. column
b. columns
c. index
d. None of the above
37. The following statement is __________
>>> DF=DF.rename({‘Maths’:’Sub1′,‘Science’:’Sub2′}, axis=’index’) #DF is a
DataFrame
39. Which of the following parameter is used to specify row or column in rename
function of DataFrame?
a. rowindex
b. colindex
c. Both of the above
40. Which of the following are ways of indexing to access Data elements in a DataFrame?
a. Label based indexing
b. Boolean Indexing
c. All of the above
d. None of the above
a. 1
b. 2
c. 3
d. 4
48. ________ parameter of append( ) method may be set to True when we want to raise
an error if the row labels are duplicate.
a. verify_integrity
b. verifyintegrity
c. verify.integrity
d. None of the above
50. The append() method of DataFrame can also be used to append ____________to a
DataFrame
a. Series
b. Dictionary
c. Both of the above
d. None of the above
Ch3:Data Visualization
1. __________________ means graphical or pictorial representation of the data using
graph, chart, etc.
a. Data visualization
b. Visual Data
c. Matplot
d. None of the above
16. Which of the following pyplot function is used to plot pie chart.
a. pie( )
b. piechart( )
c. circle( )
d. oval( )
17. Which of the following pyplot function is used to plot bar graph.
a. bargraph( )
b. bar( )
c. barchart( )
d. oval( )
18. Which of the following pyplot function is used to set the label for the x-axis.
a. xlabeled( )
b. xlabel( )
c. x_axis_label( )
d. None of the above
19. Which of the following pyplot function is used to set the values on the x-axis.
a. xticks( )
b. xlabel( )
c. xvalues( )
d. None of the above
20. Which of the following pyplot function is used to set a title for the chart.
a. Title( )
b. c_title( )
c. title( )
d. None of the above
21. To show the grid lines in plot, we can write _______________ #plt is an alias of
matplotlib.pyplot
a. plt.grid( )
b. plt.grid(True)
c. Both of the above
d. None of the above
22. ___________ is any symbol that represents a data value in a line chart.
a. marker
b. mark
c. marks
d. None of the above
24. Write a statement to display “Amount” as x-axis label. (consider plt as an alias name
of matplotlib.pyplot)
a. plt.label(“Amount”)
b. plt.xlabel(“Amount”)
c. plt.xlabel(Amount)
d. None of the above
28. Which attribute of plot( ) function help to specify the type of chart?
a. type
b. kind
c. kinds
d. types
29. Statement to plot a line chart for data stored in a DataFrame ‘df’ is _____
a. df.plot(line)
b. plot(df, line)
c. df.plot(kind = “line”)
d. None of the above
31. A _____________ plot is a graph that shows the frequency of data along a number
line.
a. line
b. box
c. histogram
d. bargraph
32. Which attribute of plot( ) function is used to set the width of line in line plot?
a. widthline
b. linewidth
c. widthofline
d. none of the above
33. Which attribute of plot( ) function is used to set the style of line in line plot?
a. linestyle
b. styleline
c. styleofline
d. none of the above
34. Which attribute of plot( ) function is used to set the edge color of bar in bar chart?
a. bordercolor
b. colorofedge
c. edgecolor
d. none of the above
35. Which attribute of plot( ) function is used to set the different color of bars in bar
chart?
a. color
b. barcolor
c. colorbar
d. none of the above
36. ____________ are column-charts, where each column represents a range of values,
and the height of a column corresponds to how many values are in that range.
a. Bar graph
b. Histograms
c. Line chart
d. pie chart
37. Which parameter of plot( ) function help to set the values of bins in Histogram?
a. bin
b. bins
c. binvalue
d. none of the above
38. Which attribute is used to change the border color of each hist in histogram?
a. border color
b. colorofborder
c. edgecolor
d. none of the above
39. Which attribute is used to fill each hist with pattern in histogram?
a. pattern
b. fill
c. hatch
d. color
40. What is the default value of fill property in plot( ) function of creating histogram?
a. True
b. False
c. Green
d. Black
41. Fill in the blank in the given code, if we want to plot a line chart for values of list ‘a’
vs values of list ‘b’.
a = [1, 2, 3, 4, 5]
b = [10, 20, 30, 40, 50]
import matplotlib.pyplot as plt
plt.plot __________
a. (a, b)
b. (b, a)
c. [a, b]
d. None of the above
42. Which of the following is used to design 2D charts/graphs/figures?
a. matplotlib.pythonplot
b. matplotlib.pyplot
c. matplot.pyplot
d. none of the above
44. The following code will show ___________ lines in the figure/chart.
import matplotlib.pyplot as pl
a = [1,2,3,4,5]
b = [10, 20, 30, 40, 50]
c = [5, 10, 15, 20, 25]
pl.plot(a,b)
pl.plot(a,c)
pl.show()
a. 1
b. 2
c. 3
d. 4
45. The following statement will create line plot of __________ color.
pl.plot(a, b, ‘g’) #a and b are list
a. black
b. yellow
c. green
d. magenta
46. Which of the following chart can not be created by using matplotlib.pyplot ?
a. Box
b. Stats
c. Pie
d. Line
4. Whenever we surf the Internet using smartphones we leave a trail of data reflecting the
activities performed by us online, which is our ___________
a. Digital footprint
b. Digital activities
c. Online handprint
d. Internet activities
24. ________ are websites or applications that enable users to participate by creating and
sharing content with others in the community.
a. Social media
b. Social channel
c. Social networking
d. None of the above
25. A responsible netizen must abide by ____________
a. net etiquettes
b. communication etiquettes
c. social media etiquettes
d. All of the above
26. In social media platform, we can share _____________
a. images
b. text
c. videos
d. All of the above
28. Data that can cause substantial harm, embarrassment, inconvenience and unfairness to an
individual, if breached or compromised, is called _______________
a. Sensitive data
b. Important data
c. security data
d. None of the above
29. Example of sensitive data is ___________
a. Name of a person
b. Credit card detail of a person
c. Date of birth of a person
d. None of the above
35. The ____________ include right to copy (reproduce) a work, right to distribute copies of
the work to the public, and right to publicly display or perform the work.
a. Copyright
b. Patent
c. Createright
d. None of the above
36. A ______________ provide an exclusive right to prevent others from using, selling, or
distributing the protected invention
a. copyright
b. trademark
c. patent
d. All of the above
37. A patent protects an invention for ___________ years, after which it can be freely used.
a. 10
b. 20
c. 30
d. 40
38. _____________ includes any visual symbol, word, name, design, slogan, label, etc., that
distinguishes the brand from other brands.
a. Trademark
b. Patent
c. Copyright
d. None of the above
39. EULA stands for _____________
a. End User Leave Agreement
b. End User License Aim
c. End User License Agreement
d. None of the above
40. _________________covers all clauses of software purchase, viz., how many copies can
be installed, whether source is available, whether it can be modified and redistributed and
so on.
a. EULA
b. EULE
c. AULA
d. AULI
41. ___________ means using other’s work and not giving adequate citation for use.
a. Plagiarism
b. Licensing
c. Copyright
d. None of the above
42. A ____________ is a type of contract between the creator of an original work permitting
someone to use their work, generally for some price.
a. Agreement
b. License
c. Patent
d. Copyright
43. Presenting someone else’s idea or work as one’s own idea or work is called ________
a. Plagiarism
b. Copyright infringement
c. Patent infringement
d. None of the above
44. Ravi copy some contents from Internet, but do not mention the source or the original
creator. This is an act of ______
a. Plagiarism
b. Copyright Infringement
c. Trademark Infringement
d. Licence Infringement
45. _____________ means unauthorized use of other’s trademark on products and services.
a. Copyright Infringement
b. Trademark Infringement
c. Plagiarism
d. Patent
46. GPL stands for ___________
a. General Public License
b. GNU General Private License
c. GNU General Public License
d. GNU Public License