WorksheetsPython Syntax Quiz
Total questions: 14
Worksheet time: 7mins
Which of the following is a data type that can have one of two values: True or False?
float
string
integer
boolean
What symbol is used for modulo operation in Python?
%
&&
**
//
What is used to create exponents in Python?
^^
exp
**
^^^
Which of the following is the correct way to write a variable in Python?
10 = my_variable
my_variable: 10
my variable = 10
my_variable = 10
What does the interpreter do in Python?
Runs code line by line and checks for errors
Creates comments
Compiles the code
Stores data
What is the purpose of whitespace in Python?
Used for variables
Used to structure code
Used for comments
Used for data types
What is the correct way to create a multi-line comment in Python?
// comment
/* comment */
''' comment '''
# comment
What does the modulo operator return?
The remainder from division
The quotient from division
The sum of two numbers
The product of two numbers
Which of the following is used to change the value of a variable?
define
reassign
comment
initialize
What is the data type of the value 7.3 in Python?
float
int
str
bool
Which of the following represents a string in Python?
3.14
True
'Hello'
7
What is the data type of the value True in Python?
bool
str
int
float
Which of the following is the correct syntax to calculate ten squared in Python?
10 ** 2
10 * 2
10 ^ 2
10 // 2
What is the purpose of comments in Python?
To define variables
To store data
To execute code
To explain code
