NEW
Font size
WorksheetsPython Quiz 1
Total questions: 24
Worksheet time: 12mins
Python language was developed in which year
1985
1991
1920
2001
The following code is used to create a variable and store a value. Why will it not work?
My number=36
The equals symbol should be at the beginning of the line
A variable name cannot have any spaces
The variable can’t share a number
There variable names cannot be called my number
Which of the following is a prominent python “statistics and econometrics library”?
Bokeh
Seaborn
Statsmodels
None of the above
Identify the correct statement:
The standard marker for missing data in Pandas is NaN
Series acts in a way like that of an array
Both of the above
None of the above
A series is a one-dimensional array which is labelled and can hold any data type.
True
False
Which of the following can be used to make a Dataframe?
Series
Dataframe
Structured ndarray
All of the above
Suppose you are defining a tuple as:
tup = (1,2,3,4,5)
We want to update the value at the second index from 2 to 10. How would we do it?
tup(2) = 10
tup[2] = 10
tup{2} = 10
None of these
Data structures in Pandas can be mutated in the terms of ____ but not of _____.
size, value
value, size
semantic, size
None of the above
Identify the correct statement:
Moving window statistics are available in Pandas
Pandas have a set of array data structures which are labelled
Pandas consist of an integrated group by engine for transforming and aggregating data sets
All of the above
Which of the following is implemented on DataFrame to compute the correlation between like-labeled Series contained in different DataFrame objects?
corrwith
corwith
corwth
None of the above
Lambda functions in Python can extend beyond a single line.
True
False
What is the output of the following program?
x = ['ab', 'cd']
for i in x:
i.upper()
print(x)
[‘ab’, ‘cd’]
[‘AB’, ‘CD’]
All keywords in python are:
UPPER CASE
lower case
Capitalized
None of the above
What is the return type of function id()?
Float
Bool
Dict
Int
Which of the following data types is not supported in python?
String
Numbers
Slice
List
Select the reserved keyword in python?
else
raise
import
All of the above
What is the output of 7^10 in python?
13
15
2
None of the above
Which of the following functions is a built-in function in python?
seed()
sqrt()
factorial()
map()
What will be the output of the following python functions?
sum(2,4,6)
sum([1,2,3])
Error, 6
12, Error
12, 6
Error, Error
Assume, you are given two lists: a = [1,2,3,4,5], b = [6,7,8,9]
The task is to create a list which has all the elements of a and b in one dimension.
Output:
a = [1,2,3,4,5,6,7,8,9]
Which of the following option would you choose?
a.append(b)
a.extend(b)
Any of the above
None of the above
In Python, an ELSE IF statement is represented as what?
elsif
elif
ifelse
Elseif
Which of the following would work?
If answer ==”Yes”:
If answer=”yes”:
If answer==”yes”
IF answer == ”Yes”:
What is the correct order?
1. print(“See you there”) 2. elif reply == “maybe”: 3. reply = input (“Are you going to the fair?”) 4. print(“I hope you do!”) 5. else: 6. if reply == “Yes”: 7. print(“Why not?”)
3,6,1,2,4,5,7
3,6,4,2,1,5,7
3,1,6,5,7,2,4
6,5,3,4,2,1,7
Python is based on which principal?
PEMDAS
PEDMAS
PEASDM
PAESDM
