WorksheetsPythonQuizOnKeywordsVariablesExpressionsOperators&Statements
Total questions: 25
Worksheet time: 13mins
Number of keywords supported by Python 3.9 and later
34
35
36
37
What is the purpose of the Python keyword def?
To define a variable
To define a class
To define a function
To define a loop
Choose the correct answer/answers related to Python programming.
created by Guido van Rossum
released on February 20, 1991
the python is a large snake
it came from BBC television comedy sketch series called Monty Python's Flying Circus.
Which of the following is not a Python keyword
lambda
assert
eval
global
Which keyword is used to exit a loop prematurely in Python
continue
pass
break
yield
Which keyword is used for conditional statements in Python
for
while
if
try
Does the python uses compiler or interpreter
compiler
interpreter
both compiler and interpreter
Python interpreter called as
bytecode interpreter
byte code virtual machine
python virtual machine
byte code compiler
Which type of language python is? choose your answer/answers.
High-level
General-purpose
Interpreted and Dynamic Semantics
Object-oriented
What does the Python keyword yield primarily do
Creates a new function
Defines a loop
Returns a value from a generator function
Raises an exception
Which of the following is an example of a Python expression
print("Hello")
x = 10
a + b
if x > 5:
Which of the following is an example of a Python statement?
5 * 2
name == "Alice"
for item in my_list:
True and False
What is the result of the following expression: 10 // 3
3.33
3
1
Error
What will be the output of the following code snippet of Python
x = 5
y = 2
print(x ** y)
7
10
25
3
Which of the following is a valid assignment statement in Python?
x + y = z
10 = num
result = a * b
if condition = True:
What is the purpose of the pass statement in Python?
To skip the current iteration of a loop
To exit a function
To act as a placeholder where a statement is syntactically required but no action is desired
To raise an exception.
Which of the following is a valid variable name in Python?
1variable
my-variable
_my_variable
class
What is a variable in Python?
reserved keyword
A data type
A named location in memory to store data
A function
Which symbol is used to assign a value to a variable in Python?
:
=
#
$
In Python, are variable names case-sensitive?
Yes
No
Only for certain data types
It depends on the operating system
Which of the following is an invalid variable name in Python?
1stattempt
my_variable
score
totalSales
What will be the output of the following code of Python
x = 10
y = x
x += 5
print(y)
10
15
Error
None
Which of the following is not a valid way to create multiple variables in one line with the same value?
s t u = 5
p = 10; q = 10; r = 10
a, b, c = 1, 2, 3
x = y = z = 0
Which operator is used to calculate the remainder of a division?
%
//
/
**
What is the result of the expression 4 < 5 and 5 < 6?
True
False
Error
None of the above
