| preferred AP College board partner for AP classes
hard Solved by 11 students
Equivalent Boolean Expression
< Prev
Next >

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 integer values of num?

A

boolean b2 = (num > -100) || (num < 100);

B

boolean b2 = (num < -100) && (num > 0 || num < 100);

C

boolean b2 = (num > -100) && (num < 100);

D

boolean b2 = (num < -100) || (num > 0 && num < 100);

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1hitrishabhatia14 0m 00s 70
#2y.seong202701 0m 40s -50
#3kazvin.tjakradinata11 3m 18s -98
#4namansoin00011 8m 24s -404
#5chunxiangxu.cxu11 15m 54s -854
#6bommasam00024 42m 23s -2,363
Items per page:
10
1 – 6 of 6
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy