Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have to answer this question.

Which of the following conditions definitely make the following expression evaluate to false? Select all that apply. Keep in mind the order of evaluation.

a == 15 or b != 5 and c <=10

a) a = 15, b = any positive int, c = any positive int
b) a != 15, b = any positive int, c = any positive int
c) a = any positive int, b = 5, c = any positive in
d) a = any positive int, b = any positive int, c = 100
e) a != 15, b = any positive int, c = 15

why is e the only right answer here? I thought with most of them saying "any positive int" would make them evaluate to false as well!

What I have tried:

I tried to look up why I was wrong on google and I can't find any wirttin answer there.
Posted
Updated 27-Feb-22 11:07am
Comments
Richard MacCutchan 28-Feb-22 4:48am    
The question asks which expressions definitely evaluate to False. So you need to try some sample values in each to see if they can sometimes be True.

1 solution

Look at the values and read the question carefully: it gives you the answer explicitly if you read it correctly. Then try the values and see if you can find any value which causes a true result.
Hint:
Quote:
Keep in mind the order of evaluation.
Could be important ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900