Question: Consider the following code segment. int num = / * initial value not shown * / ; boolean b 1 = true; if ( num

Consider the following code segment.
int num =/* initial value not shown */;
boolean b1= true;
if (num >0)
{
if (num >=100)
{
b1= false;
}
}
else
{
if (num >=-100)
{
b1= false;
}
}
Which of the following statements assigns the same value to b2 as the code segment assigns to b1 for all values of num ?
Responses
boolean b2=(num >-100) && (num <100);
boolean b2=(num >-100) && (num <100);
boolean b2=(num >-100)||(num <100);
boolean b2=(num >-100)||(num <100);
boolean b2=(num <-100)||(num >100);
boolean b2=(num <-100)||(num >100);
boolean b2=(num <-100) && (num >0|| num <100);
boolean b2=(num <-100) && (num >0|| num <100);
boolean b2=(num <-100)||(num >0 && num <100);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!