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 Intel socket recommends the use of a liquid cooling system?
Komok [63]
The socket which Intel recommends that one should use with a liquid cooling system is LGA 2011. LGA 2011, also known as socket R is a CPU socket manufactured by Intel. It was released into the market in November 2011 and it replaced LGA 1366 and LGA 1567 in the performance and high end desk tops and server platforms. Socket R has 2011 pins that touch contact points on the underside of the processor.
7 0
3 years ago
Which body of water is most likely to be a marine ecosystem?
Sophie [7]

Answer:

The body of water that is most likely to be a marine ecosystem would be an estuary.

Explanation:

An estuary is a widened, often funnel-shaped mouth of a river, where fresh river water and salt sea water are mixed and thus brackish water is created, and where tidal differences can be observed. When a river flows as a system of branches, it is called a delta.

Estuaries often have a great natural value. They typically consist of swallows and salt marshes that are very rich in invertebrates and thus have a great attraction for birds, among other things.

4 0
3 years ago
Do you play combat kite ?
nevsk [136]

Answer:

nah

Explanation:

7 0
3 years ago
Data is removed at the back of the queue.a) trueb) false
alexdok [17]

Answer:

true

Explanation:

4 0
3 years ago
Which recovery method allows users to back up their personal files to an external drive or network share without administrative
GarryVolchara [31]

Answer:

File history

Explanation:

File history recovery method  allows users to back up their personal files to an external drive or network share without administrative assistance. File History is a backup program that holds your personal files saved in the directories archives, desktop, favorites, and Contacts. It searches the file system regularly for changes, and copies modified files to a different location.

8 0
3 years ago
Other questions:
  • What does using indirect quotations allow a writer to do?
    7·2 answers
  • What is the chief ethical concern concerning all the new sources of data available through new technological means like internet
    9·1 answer
  • Which finger types the return or enter key?
    6·2 answers
  • What was one of the first inventions that made it possible to communicate almost instantly?
    11·1 answer
  • The words that follow a code number in the cpt manual are called the
    12·1 answer
  • Choose the parts of the browser window. PLEASE ANSWER QUICKLY TEST
    12·2 answers
  • What makes software engineering an engineering discipline and what makes software engineering different from other engineering d
    15·1 answer
  • Write the definition of a void function that takes as input an integer and outputs two times the number if it is even; otherwise
    13·1 answer
  • When a ____________ file is opened, it appears full-screen, in slideshow mode, rather than in edit mode.
    6·1 answer
  • Steps to copy and paste text/information from website to Ms-word using keyboard​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!