NEW
Font size
WorksheetsPython Programming Quiz
Total questions: 20
Worksheet time: 10mins
What type of programming does Python support?
All of the above
Functional programming
Object-oriented programming
Procedural programming
Which of the following is a valid way to print a string in Python?
print[Hello World]
print(Hello World)
print
print('Hello World')
What symbol is used to concatenate strings in Python?
+
&
||
%
Which of the following is NOT a valid variable name in Python?
my_variable
2nd_variable
myVariable2
_myVariable
What is the output of the following code: print('Hello' + ' World')?
Hello World
HelloWorld
Hello + World
Error
Which function is used to get user input in Python?
scan()
get()
input()
read()
What is the purpose of the 'if' statement in Python?
To create loops
To make decisions
To declare variables
To define functions
Which of the following data types is used to represent true/false values in Python?
str
float
int
bool
What will be the output of the following code: print(10 > 5)?
True
False
10
5
Which operator is used for addition in Python?
-
+
*
/
What is the correct way to define a list in Python?
list = {}
list = <>
list = []
list = ()
What will the following code output: print('Hello World')?
Error
HelloWorld
Hello World
Hello World
What is the output of print(5 * 2)?
10
7
Error
12
What does the 'break' statement do in a loop?
Continues to the next iteration
Ends the loop
Exits the program
Starts the loop over
Which of the following is used to comment a single line in Python?
#
//
/*
What is the output of the following code: print(3 == 3)?
True
False
3
Error
Which of the following is a built-in function in Python?
print()
All of the above
len()
input()
What is the purpose of the 'return' statement in a function?
To end the function
To return a value
To call another function
To print a value
Which of the following is a correct way to create a tuple in Python?
my_tuple = ()
my_tuple = {}
my_tuple = <>
my_tuple = []
What will be the output of print('Hello' * 3)?
HelloHelloHello
Hello 3
3 Hello
Error
