CBSE Class 11 Informatics Practices Question 30 of 75

Conditional and Looping Constructs — Question 2

Back to all questions
2
Question

Question 2

Construct a logical expression to represent each of the following conditions:

(a) Marks are greater than or equal to 70 but less than 100.

(b) Num is between 0 and 5 but not equal to 2.

(c) Answer is either 'N' OR 'n'.

(d) Age is greater than or equal to 18 and gender is male.

(e) City is either 'Kolkata' or 'Mumbai'.

Answer

(a) (marks >= 70) and (marks < 100)

(b) (num > 0) and (num < 5) and (num != 2)

(c) (answer == 'N') or (answer == 'n')

(d) (age >= 18) and (gender == 'male')

(e) (city == 'Kolkata') or (city == 'Mumbai')