WorksheetsPython Basics - Quiz
Total questions: 10
Worksheet time: 5mins
Which of the following identifier would NOT be accepted by Python?
MalaysiaBoleh100
global
pneumonoultra
FLAG
Which of the following is the slicing operator?
[ ]
{ }
( )
/
What is the output of the following lines of code?
var1 = 12
var1 = 23.4
var1 = "I love AI!"
print(var1)
12
23.4
I love AI!
Error
What is the output from the following lines of code?
a = [2, 4, 8]
a[2] = 6
print(a)
[2, 4, 8]
[2, 6, 8]
[2, 4, 6]
[6, 4, 8]
Which function allows us to add one element to a list at a desired location?
append()
extend()
insert()
pop()
How many parameters are there in the sum() function call below?
sum(1, 3, 5)
0
1
2
3
Which of the following refers to a file containing Python statements and definitions?
function
module
block
attribute
Which control structure allows Python codes to branch out for decision making?
if
while
for
loop
How many times would the while loop execute?
0
1
2
3
Which function transforms a 2D numpy array into a 1D array?
flatten()
ravel()
concatenate()
array()
