Font size
WorksheetsPython Quiz
Total questions: 20
Worksheet time: 8mins
:
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
print(3*4+5)
x = 5
print(x == 2)
True
0
2
False
What output will be printed, if 15 and 30 are entered by the user?
Syntax error
The sum of the two numbers - 45
The concatenation of the two numbers - 1530
What result will be displayed if 15 and 20 is entered by the user?
"num1 + num2"
1520
35
What datatype will the answer be if the user enters 15 and 30?
Integer
String
Boolean
Float
for i in range(1,5):
print(i)
1234
1
2
3
4
Indentation Error
What is the output of this code?
0
1
2
3
4
5
6
7
8
9
0123456789
10
Syntax Error
Which of the following is a list?
[1, 2, 3, 4]
(1, 2, 3, 4)
"1,2,3,4"
a = [1,5,2,7,9]
a.insert(0,3)
a.pop(4)
print(a)
[1, 5, 2, 7, 9, 3]
[3, 1, 5, 2, 9]
[3, 1, 5, 7, 9]
[1, 5, 2, 7, 3]
a = 5
if a>5:
print("Hi")
else:
print("Hello")
Hi
Hello
Indentation Error
Hi
Hello
Indentation Error
Which of these functions gives a random item from a list?
random.randint()
random.choice()
random.sample()
