WorksheetsPython Programming Quiz
Total questions: 10
Worksheet time: 5mins
What is the output of the following code?
Hello World
HelloWorld
Hello+World
None of the above
What is the output of the following code?
12
13
14
15
What is the output of the following code?
[1, 2, 3]
[1, 2, 3, 4]
[4]
Error
What is the output of the following code?
[2, 4, 6]
[1, 2, 3, 1, 2, 3]
[1, 1, 2, 2, 3, 3]
Error
What is the correct way to create a list in Python?
list = (1, 2, 3)
list = [1, 2, 3]
list = {1, 2, 3}
list = <1, 2, 3>
How do you declare a variable x with the value 10 in Python?
int x = 10
x := 10
x = 10
declare x = 10
What is the output of the following code?
[0, 1, 2, 3, 4]
[1, 2, 3, 4, 5]
[0, 1, 2, 3, 4, 5]
[5, 4, 3, 2, 1]
What does str[::-1] do in Python?
Reverses the string str
Removes the first character of the string str
Repeats the string str
Converts the string str to uppercase
Which function is used to generate random numbers in Python?
random.rand()
random()
random.randint()
rand()
What is a lambda function in Python?
A named function
An anonymous function
A class method
A recursive function
