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 process combines data from a list with the content of a document to provide personalized documents?
kakasveta [241]
The answer to this question is "Mail Merge". Due to the advancement of technology, this process was discovered and developed by IT engineers. Mail merge is the process that combines the available data from the list together with the content of a document and the purpose of this is to provide a personalized and organized document which is easier to access.
8 0
3 years ago
Read 2 more answers
Match the file extensions to the file types. Some file types may be used more than once.
Elena L [17]

Answer:

1234 and free points

Explanation:

7 0
3 years ago
Which of these is NOT an input device?
OLEGan [10]
Blinking light is not one of the awansers
6 0
3 years ago
To keep your emails concise and to the point
barxatty [35]
D. <span>use clear, short paragraphs.</span>
8 0
3 years ago
A _ is the acknowledgment of a potential noncomformity, or an opinion regarding an issue that is not covered by a standard
sleet_krkn [62]
Assumption - hope this helped took the test and got 100
5 0
3 years ago
Other questions:
  • If you use the ___ template, as opposed to a formatted theme, you must make all design decisions?
    15·1 answer
  • Vaporization is the process in which liquid is sufficiently cooled to change states of matter from a liquid to a vapor true or f
    8·1 answer
  • In the Word 2016 window, where is the Status bar located?
    11·2 answers
  • Write a program that reads in the length and the width of a rectangular yard.
    5·1 answer
  • Among the rights you have as a user of computing resources is the right to​ _______.
    12·2 answers
  • Develop a Python program. Define a class in Python and use it to create an object and display its components. Define a Student c
    11·1 answer
  • I CANT DO SKIN MODS ON BRAWLHALLA RIGHT!!!! IM SO MADDDDDDDDDDD
    11·1 answer
  • We have studied machine cycle in class. Suppose that each of the four modules of machine cycle is taking 2 seconds. If there are
    5·1 answer
  • GOOD EVENING, FRIENDS, I WANT TO ASK ON THE ACCOUNT OF HIS NAME‏BENJEMIN360 . THIS ANSWERS ARE VERY WONDERFUL, BUT I CAN'T COMMU
    6·1 answer
  • Your client Mr. Smith has requested a reservation at Eleven Madison Park this evening for a party of 2 at 6PM. Unfortunately, th
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!