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 three reasons does Dr. Boyd give to explain why returning to a friends only network would be impossible
Digiron [165]
Ummmmmm... Dr. Boyd is a Psychologist  that has nothing to do with computers and technology
7 0
3 years ago
An online store uses 6-bit binary sequences to identify each unique item for sale. The store plans to increase the number of ite
hjlf

Answer:

2 times as many items can be uniquely identified

Explanation:

Option 'C' is the answer. because

if we use 6 bit binary sequence

then

No. of Unique address will be = 2 ^ 6  = 64

as we increase the bit by 1. Now total bits are 7.

so

No. of Unique address for 7 bit Sequence = 2 ^ 7  = 128

So,

128 is double of 64, that is 2 times greater value than 64.

6 0
3 years ago
What is the difference between the ISO and the OSI?
geniusboy [140]

ISO it is an organzation for agreement on internationational of network communication worldwide

OSI is the model for understanding and designing a network architecture

7 0
3 years ago
Read 2 more answers
Jane is designing a print brochure for a retail company. She’s having trouble deciding on the page margin. Which best practice w
8090 [49]

I think the answer will be C

7 0
3 years ago
Read 2 more answers
Write a function that takes a character string value and prints out the bytes stored in memory of its representation (including
Goryan [66]

Answer:

C++ code explained below

Explanation:

SOURCE CODE:

*Please follow the comments to better understand the code.

#include <stdio.h>

int numOfBytes(char* string)

{

// initialise the variables

int i=0,size=0;

// while the string reaches to \0, repeat the loop.

while(string[i]!='\0')

{

// add that size

size += sizeof(*string);

 

// increase the i value.

i++;

}

// add 1 byte for \0

size = size+1;

return size;

}

int main() {

char name[]="Praveen Kumar Reddy";

printf("The size is %d bytes.",numOfBytes(name));

 

  return 0;

}

=============

6 0
3 years ago
Other questions:
  • When purchasing a(n) ________ computer, having cellular as well as wifi can be important?
    9·1 answer
  • Sending an identical message in an e-mail blast to all customers is an example of
    13·1 answer
  • Wireless networks are the most difficult type of network to set up <br> true or false
    15·1 answer
  • When it comes to collecting and organizing prospect and account​ information, salespeople have a large variety of computer syste
    15·1 answer
  • the easiest and cheapest time to alter the information system is in the ________ phase of the sdlc. a. requirements analysis b.
    8·1 answer
  • How to make a water bottle rocket??
    6·1 answer
  • your friend's parent's are worried about going over their budget for the month. Which expense would you suggest is NOT a need?
    11·1 answer
  • A computer scientist creates an app that tells you a funny joke each time you touch the Joke button.
    15·1 answer
  • Kitchen Gadgets
    10·1 answer
  • Read the statement and justify your answer. “ICT is important for every field.”
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!