CBSE Class 11 Computer Science Question 98 of 173

Data Handling — Question 27

Back to all questions
27
Question

Question 27

Evaluate and Justify:

(i) false and None

(ii) 0 and None

(iii) True and None

(iv) None and None

Answer

(i) This produces an error as false is an invalid literal in Python. It should be False. Had the expression being False and None, the return value will be False.

(ii) This logical expression evaluates to 0. As first operand of and operator is false so it will return the first operand itself.

(iii) This logical expression evaluates to None. As first operand of and operator is True so it will return the second operand.

(iv) This logical expression evaluates to None. As first operand of and operator is false so it will return the first operand itself.

Answer