CBSE Class 11 Computer Science Question 117 of 173

Data Handling — Question 6

Back to all questions
6
Question

Question 5a

What will be output produced by following code? State reason for this output.

a, b, c = 1, 1, 2
d = a + b
e = 1.0
f = 1.0
g = 2.0
h = e + f
print(c == d)
print(c is d)
print(g == h)
print(g is h)

Answer

Output
True
True
True
False
Explanation

Value of d becomes 2 and as values of c and d are equal so print(c == d) prints True.

Answer