Worksheets2021 SAMPLE PAPER 1 (TERM 1)
Total questions: 55
Worksheet time: 28mins
To create an empty Series object, you can use:
pd.Series(empty)
pd.Series( )
pd.Series(np.NaN)
all of these
To specify datatype int16 for a Series object, you can write :
pd.Series(data = array, dtype = int16)
pd.Series(data = array, dtype = numpy.int16)
pd.Series(data = array.dtype pandas.int16)
all of the above
To get the number of dimensions of a Series object,
index
size attribute is displayed.
itemsize
ndim
To get the size of the datatype of the items in Series object, you can display attribute.
index
size
itemsize
ndim
To get the number of elements in a Series object, attribute may be used.
index
size
itemsize
ndim
To get the number of bytes of the Series data, attribute is displayed.
hasnans
nbytes
ndim
dtype
To check if the Series object contains NaN values, attribute is displayed.
hasnans
nbytes
ndim
dtype
To display third element of a Series object S, you will write
S[:3]
S[2]
S[3]
S[:2]
To display first three elements of a Series object S, you may write
S[:3]
S[3]
S[3rd]
all of these
To display last five rows of a Series object S, you may write
head()
head(5)
tail( )
tail(5)
both c and d
Pandas object cannot grow in size.
DataFrane
Panel
Series
None of the above
Given a Pandas series called Sequences, the command which will display the first 4 rows is
print(Sequences.head(4))
print(Sequences.Head (4))
print(Sequences.heads(4))
print(Sequences.Heads (4))
If a Dataframe is created using a 2D dictionary, then the indexes/row labels are formed from
dictionary's values
inner dictionary's keys
outer dictionary's keys
none of these
If a dataframe is created using a 2D dictionary, then the column labels are formed from
dictionary's values
inner dictionary's keys
outer dictionary's keys
none of these
The axis 0 identifies a dataframe's
rows
columns
values
datatype
The axis 1 identifies a dataframe's
rows
columns
values
datatype
To get the number of elements in a dataframe,
size
shape
values
ndim
To get a number representing number of axes in a dataframe, used. attribute may be
size
shape
ndim
values
To display the 3rd, 4th and 5th columns from the 6th to 9th rows of a dataframe you can write
DF.loc[6:9, 3:5]
DF.loc[6:10, 3:6]
DF.iloc[6:10, 3:6]
DF.iloc[6:9, 3:5]
To change the 5th column's value at 3rd row as 35 in dataframe DF, you can write
DF[4, 6] = 35
DF.iat[4, 6] = 35
DF[3, 5] = 35
DF.iat[3, 5] = 35
Which among the following options can be used to create a DataFrame in Pandas ?
A scalar value
An ndarray
A python dict
All of these
Identify the correct statement:
Data frames can change their size.
Series act in a way similar to that of an array.
Both (a) and b)
None of the above
To delete a column from a DataFrame, you may use statement.
remove
del
drop
cancel
both b and c
To delete a row from a DataFrame, you may use
remove
del
drop
cancel
To iterate over horizontal subsets of dataframe,
iterate()
iterrows()
itercolss()
iteritems()
To iterate over vertical subsets of a dataframe, function may be used.
iterate()
iterrows()
itercols()
iteritems()
To add two dataframes' values,
plus function may be used.
rplus
add
radd
both c and d
To subtract the values of two dataframes,
sub
difference
rsub
both a and c
minus
To divide the values of two dataframes, function may be used. function may be used.
divide and /
div and rdiv
division and %
/ and %
To get the 3 bottommost rows from a dataframe, you may use
bottom()
bottom(3)
tail()
tail(3)
Which of the following arguments lets you specify index labels of dataframe through Dataframe( ) ?
index
label
columns
all of the above
To get top 5 rows of a dataframe, you may use
head()
head(5)
both a and b
none of the above
Which of the following can be used to specify data for creating a Dataframe ?
Series
DataFrame
Structured ndarray
all of these
All Pandas' data structures are mutable but not always mutable
size, value
semantic, size
value, size
none of these
Which of the following statement will import Pandas library ?
import pandas as pd
import pandas as py
from pandas import *
all of these
. What will be the output for the following code ?
import pandas as pd
S = pd. Series([1,2,3,4,5],index = ['a', 'b', 'c', 'd', 'e'])
print ( s[ 'a'] )
2
1
3
4
What will be the output for the following code ?
import pandas as pd
import numpy as np
S = pd.Series (np.random.randn(2))
print (s.size)
0
1
2
3
What will be the output for the following code ?
import pandas as pd
import numpy as np
S= pd.Series(np.random.randn(4))
print (s.ndim)
0
1
2
3
What is the purpose of using ndim attribute ?
It returns the number of elements in the given data structure
It returns the Series object in the form of an ndarray
It returns a list of the indexes / labels.
It returns the number of dimensions of the given data structure
PyPlot is an interface of Python's.
seaborn
plotly library.
ggplot
matplotlib
For 2D plotting using a Python library, which library interface is often used ,
seaborn
plotly
matplotlib
matplotlib.pyplot
Which of the following is not a valid chart type ?
Statistical
Box
Pie
Line
Which of the following is not a valid plotting function of pyplot ?
pie()
plot()
bar()
line()
Which of the following plotting functions does not plot multiple data series ?
plot()
barh()
bar()
pie()
The plot which tells the trend between two graphed variables is the
scatter
bar
line
pie
Which of the following functions is used to create a line chart ?
line()
chart()
plot()
plotline()
Which of the following function will produce a bar chart ?
plotbar()
plot()
bar()
barh()
Which of the following function will create a vertical bar chart ?
plot()
bar()
plotbar()
barh()
Which of the following function will create a horizontal bar chart ?
plot()
bar()
barh()
plotbarh()
The data points plotted on a graph are called
point
pointers
marks
markers
A connected by straight line segments.
line
bar
pie
boxplot
Which argument of bar() lets you set the thickness of bar ?
thick
thickness
width
barwidth
Which function lets you set the title of the plot ?
title()
graphtitle()
plottitle()
all of these
The command used to give a heading to a graph is
plt.show()
plt.plot()
plt.xlabel( )
plt.title( )
Which function would you use to set the limits for x-axis of the plot?
limits()
xlimits()
xlim()
lim()
