Operators Assignment
The Output of a = 2+3-4/2**2 and also tell its type?
4 and int
4.0 and float
1.0 and float
5 and int
The output of the following python code snippet print(type(4/2)) print(type(4//2))
float and float
float and int
int and float
int and int
What will be the output of the following python code snippet a= 12 print(type(a)) a=’12345’ print(type(a))
a. Int and str
b. Int and int
c. str and int
d. str and str
Operators with the same precedence are evaluated in which manner?
a. Left to right b. Right to left c. Can’t say d. None of the Above Mentioned
Output of a = 2*3/4**1==2.00
a. 1.5 b. 2 c. True d. False
The Output of following code print(bool(0), bool(3.14159), bool(-3), bool(1.0+1j))
a. False False False False b. True True False True c. False True False True d. False True True True
The Output of the following 2**3**2
a. 512 b. 64 c. 12 d. None
The output of the following
A = 100 B= 30 print(A and B)
a. True b. False c. 100 d. 30
Output of the following print(100>2 and 100 > 30)
a. True b. False c. 100 d. 30
20 or 30 =?
a. False b. True c. 20 d. 30
What will be the output of the following code
print(True or True and False)
a. True b. False
What will be the precedence of
a. Not b. And c. Or
a. Abc b. Bac c. Bca d. Cab
The Output of the following 2/2*3**2<=10
a. True b. False c. 9 d. 10
Int(4.5) = ?
a. 4 b. 5 c. 4.5 d. 4.0
str(4.5) = ?
a. 4 b. 4.5 c. 4.0 d. 5
type(22%3) = ?
a. Int b. Str c. Float d. Can’t say
Output of :
X = 25 print(X+int(‘2’))
a. Error b. 27 c. 252 d. None
Output of :
X = ‘24’ print(X+str(int(‘2’)))
a. 26 b. 242 c. Error d. None
Which of the following gives error in python?
a. A = b= c =1 b. A, b, c = 1, 2, 3 c. A, b, c = 1 d. Abc = 1
a. A b. B c. C d. D
Which will give an error?
a. A++ b. ++a c. A += 1 d. Both A and B
Last updated