WorksheetsExploring Python Fundamentals
Total questions: 20
Worksheet time: 10mins
What is the output of 3 + 2 in Python?
4
6
3
5
Which of the following is a valid variable name in Python?
variable-name
1variable
variable@1
variable1
What data type is the result of 5 / 2 in Python 3?
boolean
string
float
integer
How do you create a list in Python?
my_list = {1, 2, 3}
my_list = (1, 2, 3)
my_list = '1, 2, 3'
my_list = [1, 2, 3]
What is the purpose of the 'len()' function in Python?
The 'len()' function calculates the sum of numbers in a list.
The 'len()' function checks if an object is empty or not.
The 'len()' function converts an object to a string format.
The purpose of the 'len()' function is to return the number of items in an object.
Which operator is used for exponentiation in Python?
//
%%
**
^
What will be the output of 'Hello' + 'World'?
HelloWorld
Hello+World
Hello-World
Hello World
How do you check the type of a variable in Python?
Use the 'type()' function.
Use the 'checktype()' function.
Utilize the 'var_type()' method.
Apply the 'data_type()' command.
What is the result of 10 % 3?
1
2
3
0
Which of the following is not a built-in data type in Python?
dictionary
list
array
set
What is the output of the expression '5' * 2?
55.0
25
10
55
How do you define a function in Python?
create function_name(parameters)
function_name(parameters) =>
def function_name(parameters):
function_name: parameters ->
What is the difference between '==' and 'is' in Python?
The '==' operator checks for value equality, while 'is' checks for object identity.
The '==' operator checks for reference equality, while 'is' checks for value equality.
The '==' operator compares types, while 'is' compares values.
The '==' operator checks for object identity, while 'is' checks for value equality.
Which keyword is used to define a class in Python?
define
function
module
class
What will be the output of the following code: print(type([]))?
How do you create a dictionary in Python?
You can create a dictionary in Python using curly braces, e.g., {'key': 'value'}.
Dictionaries in Python are created with parentheses, e.g., ('key', 'value').
You can create a dictionary in Python using square brackets, e.g., ['key': 'value'].
To create a dictionary in Python, use a list, e.g., ['key', 'value'].
What is the output of 'abc' in uppercase?
ABc
ABC
abc
aBc
Which operator is used to concatenate strings in Python?
&
-
+
|
What is the result of the expression 2 ** 3?
4
6
10
8
How do you create a tuple in Python?
You create a tuple in Python by using brackets, e.g., [1, 2, 3].
You create a tuple in Python by using angle brackets, e.g., <1, 2, 3>.
You create a tuple in Python by using parentheses, e.g., (1, 2, 3).
You create a tuple in Python by using curly braces, e.g., {1, 2, 3}.
