Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



Consider the following conditional code, which returns Boolean values

if $((x>25) \land (y>100))$
return $false$;

else if $((x \le 25) \land (y \le 100))$
return $true$;

else if $((x>25) \land (y \le 100))$
return $false$;

else
return $true$;

Simplify it by filling in the following blank with a single Boolean expression without changing the behaviour of the conditional code.

if $($ ________ $)$
return $true$;

else
return $false$;






Solution

Given code returns $false$ when:

$((x>25) \land (y>100))$

or

$((x>25) \land (y \le 100))$

So,

$false = (x>25)$

Therefore, the code returns $true$ when:

$x \le 25$

Hence, the required Boolean expression is:

$x \le 25$



Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...