Explore Online Courses
Free Courses
Hire from us
Become an Instructor
Reviews
All Courses
Submit
Submit
Take the Free Practice Test
Free Practice Test
Instructions:
FREE test and can be attempted multiple times.
60 Minutes
30 Multiple Choice Questions
Fill in the Details to Get Started
Select your preference
Self-learning and knowledge validation
Completed a course & revising
Just curious
By providing your contact details, you agree to our
Terms of Use
&
Privacy Policy
Welcome to your Python Quiz
Where did the Python name come from?
Python Snake
Monty Python’s Circus Flying
Monty Python’s Flying Circus
None of the above
What does the following code do? def a(b, c, d): pass
defines a list and initializes it
defines a function, which does nothing - correct
defines a function, which passes its parameters through
defines an empty class
What is the output? x = True y = False z = False if x or y and z: print('yes') else: print('no')
Yes
No
Fails to compiler
Which among the following can be an identifier in Python?
@HEllo
1hello
$Hello1
_Hello1
What is the output of the following? 4 | 6
4
6
10
1
What is the output of the following? 10<<1
10
1
20
None of the above
Which of the following is going to throw an exception out of the following?
A = 10
int A = 10
Name = 'Noah'
What is the output of the following? List1 = ['Python', 'Py', 'Pyth', 'Python3'] print(List1[-1][2])
t
3
n
Python
What is the output of the following? x = range(10) y = sum(x) print(y)
10
45
1
An exception is thrown
What is the output of the following? List1 = ['Python', 'Py', 'Pyth', 'Python3'] List2 = List1*2 List3 = List1[:] List2[0] = 'Hello' List3[1] = 'World' sum = 0 for ls in (List1, List2, List3): if ls[0] == 'Hello': sum += 1 if ls[1] == 'World': sum += 2 print(sum, List2)
3 ['Hello', 'Py', 'Pyth', 'Python3', 'Python', 'Py', 'Pyth', 'Python3']
2 ['Hello', 'Py', 'Pyth', 'Python3']
3 ['Hello', 'Py', 'Pyth', 'Python3']
2 ['Hello', 'Py', 'Pyth', 'Python3', 'Python', 'Py', 'Pyth', 'Python3']
We have two lists a=['a','b'] b=['r','n'] We want to achieve the following output ['a', 'b', ['r', 'n']] Which of the following should be used?
a.extend(b)
a.append(b)
a.insert(1,b)
None
Which of the following will be used to write to csv file?
pd.read_csv('Filename.csv')
pd.read_file('Filename.csv')
dataframe.read_ csv('Filename.csv')
dataframe.read_file('Filename.csv')
What will be the output of the following: import pandas as pd arr=[[1,2],[4,5],[7,8]] df = pd.DataFrame(arr, index = ['a','b','c'], columns = ['A', 'B']) df.loc[:,'A']
a 1 b 4 c 7
0 1 1 4 2 7
1 1 2 2 3 4
a 1 b 2 c 4
To view the first 15 rows of the a given csv dataset, which command is used? import pandas as pd Dataframe1=pd.read_csv('somedataset.csv')
Dataframe1.row(15)
Dataframe1.row(0:15)
Dataframe1.head(0:15)
Dataframe1.head(15)
To rename a column in a given csv dataset, which command is used? import pandas as pd Dataframe1=pd.read_csv('somedataset.csv')
Dataframe1.rename(columns={'Old-name':'New-name'})
Dataframe1.title('Old-name':'New-name')
Dataframe1.rename('Old-name':'New-name')
Dataframe1.title(columns={'Old-name':'New-name'})
What is the output of the following: one = ['one','1','one1'] a = ['A','a','Aa'] df1 = pd.DataFrame({'one': one, 'a': a}) df1 = df1[['one', 'a']] a = ['A','a','Aa'] b = ['B','b','Bb'] df2 = pd.DataFrame({'a': a, 'b': b}) df2 = df2[['a', 'b']] df1.merge(df2, on='a', how='inner')
one a b 0 one A B 1 1 a b 2 one1 Aa Bb
a b one 0 A B one 1 a b 1 2 Aa Bb one1
a one b 0 A one B 1 a 1 b 2 Aa one1 Bb
0 1 2 one one 1 one1 a A a Aa b B b Bb
Which of the following will be used to find out the zscore of the given numpy array? from scipy import stats import numpy as np numarr=np.array([9,8,7,6,5,4,3,2,1,0])
np.stats.zscore(numarr)
stats.zscore(numarr)
stats.zcores(numarr)
np.stats.zscores(numarr)
Find out the correct output: import numpy as np from scipy import stats new=np.array([[0.1,1,2],[3,0.2,1],[1,0.5,4]]) _,p,_,_ =stats.chi2_contingency(new) p
0.2464
1.0929
2.3111
None of the above
Find out the correct output: from scipy import linalg import numpy as np new=np.array([[0.1,1,2],[3,0.2,1],[1,0.5,4]]) linalg.det(new)
8.37
-8.37
1
None of the above
Find out the correct cluster index array for the following: from scipy.cluster.vq import kmeans,vq,whiten import matplotlib.pyplot as plt new=[0.1,1,3,0.2,1,0.5,12,0.2,10,0.5,10,2,5,0.8] plt.scatter(range(len(new)),new) centroid,_ = kmeans(new,2) idx, _ = vq(new,centroid) idx
array([1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1])
array([1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1])
array([1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1])
array([1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1])
Which of the following is used to find double integration:
doublequad
dblquad
quadquad
None
What is the output of the following? import numpy array_1 = numpy.array([[1,2,3],[0,0,0]]) array_2 = numpy.array([[0,0,0],[7,8,9]]) print(numpy.concatenate((array_1, array_2), axis = 1))
[[1 2 3 0 0 0 0 0 0 7 8 9]]
[[1 2 3 0 0 0] [0 0 0 7 8 9]]
[[1 2 3] [7 8 9]]
None
What is the output? import numpy my_array = numpy.array([1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9]) print(numpy.ceil(my_array))
[1. 2. 3. 4. 5. 6. 7. 8. 9.]
[ 2. 3. 4. 5. 6. 7. 8. 9. 10.]
[.1 .2 .3 .4 .5 .6 .7 .8 .9]
[.2 .3 .4 .5 .6 .7 .8 .9 .10]
Which of the following is used to plot horizontal bar plot in matplotlib?
matplotlib.pyplot.bar.horizontal()
matplotlib.pyplot.barh()
matplotlib.pytplot.horizontal.bar()
matplotlib.pyplot.hbar()
We are plotting a line plot between two variables, a and b. To add a legend which of the following will be used:
matplotlib.pyplot.legend([a,b],[loc= 'best'])
matplotlib.pyplot.legend(['a', 'b'],[loc='best'])
matplotlib.pyplot.legend(['a', 'b', loc='best'])
matplotlib.pyplot.legend([a, b, loc='best'])
To add title in the plot which of the following is used?
matplotlib.pyplot.plot(title=['name'])
matplotlib.pyplot.plot.title('name')
matplotlib.pyplot.title('name')
matplotlib.pyplot.title(name)
Which of the following represents categorical data?
Area plot
Histogram
Quiver plot
Bar plot
Which of the following is useful to display data with 10 categories?
Histogram
Bar plot
Pie chart
Area plot
Which of the following regression is best suited for dealing with categorical dependent variable?
Linear Regression
Multiple Linear Regression
Logistic Regression
Quantile Regression
Which of the following methods do we use to find the best fit line for data in Linear Regression?
Least Square Error
Maximum Likelihood
Logarithmic Loss
Both a and b
Time is Up!