CBSE Class 11 Computer Science Question 112 of 173

Data Handling — Question 1

Back to all questions
1
Question

Question 1

What is the result produced by (i) bool (0) (ii) bool (str(0))? Justify the outcome.

Answer

(i) bool (0)

The result is False as truth value of 0 is falsetval

(ii) bool (str(0))

The result is True as str(0) converts 0 to string "0". As it becomes a non-empty string so its truth value is truetval

Answer