Font size
WorksheetsPython Operators
Total questions: 35
Worksheet time: 2hrs 45mins
Which of these is not a core data type?
Lists
Dictionary
Tuples
Class
What is the output of the following code :
print 9//2
4.5
4.0
4
Error
Who developed the Python language?
Zim Den
Guido van Rossum
Niene Stom
Wick van Rossum
Which one of the following is the correct extension of the Python file?
.python
.p
.py
None of these
Which of the following declarations is incorrect?
_x = 2
__x = 3
__xyz__ = 5
None of these
Which of the following declarations is incorrect in python language?
xyzp = 5,000,000
x y z p = 5000 6000 7000 8000
x,y,z,p = 5000, 6000, 7000, 8000
x_y_z_p = 5,000,000
What will be the output of this statement?
>>>"a"+"bc"
a+bc
a bc
abc
a
print("3+4")
Which of these operators means EQUAL TO?
'='
'=>'
'<='
'=='
amount = 2 + 5 * 2
What is the output of range(1,10)
0123456789
123456789
1 to 10
012345
Choose the correct declaration of a float variable with the value 3.14
pi = "3.14"
pi = int(3.14)
pi = 3.14
float pi = 3.14
What is the final result of the expression 4 + 5 * 3?
27
12
19
21
What is the final result of the expression 7 / 3 + 6?
0
8.33333333
8
.777777777778
What does the following code print?
x = 3.4
y = 1
print int(x)
print x + y
3.4
4.4
3
4.4
3
4
The code causes an error
What is the final result of the expression 2**3?
6
8
2
That is not a valid Python expression.
What is the operator below called?
%
Exponent
Modulus
Divide
Percent
print(9//3,9/3)
3 3.3
3.3 3
3.0 3.3
3.3 3.3
Valid operation?
'2'-'1'
'third'*'2'
'sum'**3
"2"+"1"
What is the output of this expression, 3*1**3?
3
21
9
33
print(1.1+2.2==3.3)
True
False
Error
3.3
Suppose the following statements are executed:
a = 100 b = 200
What is the value of the expression a and b?
200
100
0
False
What is the output of “hello”+1+2+3 ?
hello123
hello
Error
hello6
str1 = "My salary is 7000"; str2 = "7000" print(str1.isdigit()) print(str2.isdigit())
False True
False False
True False
True True
print(-18//-2)
print(18//2)
print(18/2)
print(18%2)
print(str(18/2))
find output
9.0
9
9.0
0
9.0
9
9
9.0
0
"9.0"
9
9
9.0
0
9.0
9
9
9.0
0
90
x = 10
y = 50
if x ** 2 > 100 and y < 100:
print(x, y)
find output
NONE
Error
10,50
100
4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators?a = 4
b = 11
print(a | b)
print(a >> 2)
15
0
0
15
15
1
1
15
y = 10
x = y += 2
print(x)
12
10
0
Error
print(int(12.53))
print(round(12.53))
print(round(12.36,1))
13
12
12.4
12
13
12.4
12
13
12.3
error
Single line comment Symbol?
//
/
$
#
Choose the correct function to get the character from ASCII number
ascii(number)
char(number)
chr(number)
ord(number)
str1 = 'Welcome'
print (str1[:6] + ' PYnative')
Welcome PYnative
WelcomPYnative
Welcom PYnative
WelcomePYnative
The function pow(x,y,z) is evaluated as:
(x**y)**z
(x**y) / z
(x**y) % z
(x**y)*z
