NEW
Font size
WorksheetsPython Fundamental 1
Total questions: 10
Worksheet time: 5mins
What is the output of "12"+"4"+"3"?
1234
1243
10
19
What does the ** operator do in Python?
It performs exponentiation (raising the left operand to the power of the right operand).
It performs floor division (divides and rounds down to the nearest integer).
It performs bitwise AND (compares each bit of the operands and returns 1 if both bits are 1).
It performs addition (adds the numeric values of both operands).
Which operator is used for string concatenation?
+
&
|
^
Which of the following is a valid variable name in Python?
2things
_myVar
my-var
None of the above
What data type is the object below?
[1, 2.2, 'python']
List
Dictionary
Tuple
Set
To check the data type of a variable a in Python, which function will you use?
typeof(a)
datatype(a)
type(a)
data_type(a)
What does the expression None == None evaluate to?
True
False
None
Error
Which function is used to add an element to a set in Python?
append()
add()
insert()
push()
How can you add a new key-value pair to a dictionary named data? Assume data = {}.
data.add('key': 'value')
data['key'] = 'value'
data.insert('key', 'value')
data.append('key': 'value')
What will be the output of len({'a':1, 'b':2, 'c':3})?
3
6
None
An error
