NEW
Font size
WorksheetsMDM_III_TA_2
Total questions: 20
Worksheet time: 10mins
What is an identifier in Python?
A built-in function for string manipulation
An identifier in Python is a name used to identify a variable, function, class, or other object.
A type of data structure in Python
A keyword used to define a function
Which of the following is a keyword in Python?
function
def
variable
class
What is the output of the expression 5 + 3 * 2?
8
16
11
10
Which of the following is a valid variable name in Python?
1invalidVariable
invalid-variable-name
invalid variable name
valid_variable_name
What type of data does the input() function return?
list
string
boolean
integer
What does the 'if' statement do in Python?
The 'if' statement executes a block of code based on a condition.
The 'if' statement is used to declare variables in Python.
The 'if' statement defines a function in Python.
The 'if' statement creates a loop in Python.
What is the purpose of indentation in Python?
To increase the speed of the program
To make the code look more colorful
To define variable types in Python
The purpose of indentation in Python is to define code blocks and control flow.
What will be the output of print('Hello, World!')?
Hi, World!
Hello, World!
Hello, Universe!
Hello World!
What is the result of the expression True and False?
True
False and True
False
True or False
What will be the output of print(2 ** 3)?
6
4
8
9
What is the output of the following code: print(type(5))?
list
float
str
int
Which keyword is used to define a function in Python?
define
def
function
method
What will be the result of the expression 3 * 'abc' in Python?
3abc
None
TypeError
abcabcabc
What will be the result of the expression 'Python' + '3'?
Python3
Python 3
3Python
Python + 3
What is the output of the expression 4 * (3 + 2)?
20
15
12
10
What is the output of the following code: print(type(5))?
<class 'list'>
<class 'float'>
<class 'str'>
<class 'int'>
Which of the following data types is immutable in Python?
Set
String
List
Char
What does the 'len()' function do in Python?
Returns the length of an object
Creates a new object
Converts an object to a list
Checks if an object is empty
What is the output of the expression 10 // 3?
3.0
3
3.33
4
Which of the following methods can be used to add an element to a list in Python?
Both append() and insert()
insert()
add()
append()
