1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OlgaM077 [116]
3 years ago
5

Consider the following code segment, which is intended to set the Boolean variable inRange to true if the integer value num is g

reater than min value and less than max value. Otherwise inRange is set to false. Assume that inRange, num, min, and max have been properly declared and initialized. boolean isBigger; boolean isSmaller; boolean inRange; if (num < max) { isSmaller = true; } else { isSmaller = false; } if (num > min) { isBigger = true; } else { isBigger = false; } if (isBigger == isSmaller) { inRange = true; } else { inRange = false; } Which of the following values of num, min, and max can be used to show that the code does NOT work as intended?a.num = 20, min = 30, max = 50
b.num = 30, min = 20, max = 40
c.num = 40, min = 10, max = 40
d.num = 50, min = 50, max = 50
e.num = 60, min = 40, max = 50
Computers and Technology
1 answer:
Natasha_Volkova [10]3 years ago
8 0

Answer:

Option d  num = 50, min = 50, max = 50

Explanation:

Given the code segment:

  1. boolean isBigger;
  2. boolean isSmaller;
  3. boolean inRange;
  4. if (num < max)
  5.        {
  6.            isSmaller = true;
  7.        }
  8.        else {
  9.            isSmaller = false;
  10.        }
  11.        if (num > min)
  12.        {
  13.            isBigger = true;
  14.        }
  15.        else {
  16.            isBigger = false;
  17.        }
  18.        if (isBigger == isSmaller) {
  19.            inRange = true;
  20.        } else {
  21.            inRange = false;
  22.        }

If we have num = 50, min = 50 , max = 50,  the condition num < max will be evaluated to false and therefore isSmaller is set to false.

The condition num > min will be evaluated to false as well and therefore isBigger is set to false.

Since isSmaller and isBigger are both false and therefore isBigger == isSmaller will be evaluated to true and set the inRange = true. This has violated the statement that if the integer value num is greater than min value and less than max value, then only set inRange to true. This is because num = 50 is neither greater than min nor less than max, it is supposedly not in range according to the original intention of the code design.

You might be interested in
What kind of company would hire an Information Support and Service employee?
Murrr4er [49]

Answer:

B. Computer Repair

Explanation:

I got it right on edge. trust.

7 0
2 years ago
Read 2 more answers
Given the strings s1 and s2 that are of the same length, create a new string consisting of the first character of s1 followed by
LiRa [457]

Answer:

s1='abc'

s2='wxyz'

length=len(s1)

s3=''

for i in range(length):

   s3+=s1[i]+s2[i]

print(s3)

3 0
3 years ago
Should charter schools allow cell phone use in class?
lawyer [7]

Answer:

yes

Explanation:

4 0
3 years ago
Read 2 more answers
What is the way of retrieving information from the Internet?
TEA [102]
We have to search the desired topic on the search box in the homepage
4 0
2 years ago
Read 2 more answers
How do i cancel my brainly premium account?
Vikki [24]

Answer:

press cancel

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • When computers connect to one another to share information, but are not dependent on each other to work, they are connected thro
    7·1 answer
  • The concept of vertical farming allows agriculture to occur when there is not enough___Available .
    13·1 answer
  • Which of the following is a full selector?
    12·1 answer
  • Determine the number of bytes necessary to store an uncompressed RGB color image of size 640 × 480 pixels using 8, 10, 12 and 14
    11·1 answer
  • Using social media and sending a blast are examples of
    13·1 answer
  • When creating a chart or graph, which should be completed first?
    9·2 answers
  • Linda is viewing the campaign report in her Google Ads account after successfully implementing conversion tracking tags for her
    7·1 answer
  • To improve readability,______ use text on a dark green background.
    11·2 answers
  • Which feature helps an edit-test-bug cycle work faster in the python programming language?
    15·2 answers
  • Create a multimedia project that contains the text element and all the contents that you have studied about that element
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!