LearnFrenzy
Sign in Take a free test

Decision Making · Decision Making MCQ · Question 3

How to test that x is between 10 and 20 in C Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 3 Back to Exercise

Which condition is true exactly when x is between 10 and 20, inclusive?

  • A 10 <= x <= 20
  • B x >= 10 || x <= 20
  • C x >= 10 && x <= 20 Correct
  • D x > 10 && x < 20
Correct Answer: Option C

Both bounds must hold, so join them with &&. The chained form is parsed as (10 <= x) <= 20 (always true), and the || version is true for every x.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links