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
ryzh [129]
2 years ago
13

Consider the following code segment, which is intended to simulate a random process. The code is intended to set the value of th

e variable event to exactly one of the values 1, 2, or 3, depending on the probability of an event occurring. The value of event should be set to 1 if the probability is 70 percent or less. The value of event should be set to 2 if the probability is greater than 70 percent but no more than 80 percent. The value of event should be set to 3 if the probability is greater than 80 percent. The variable randomNumber is used to simulate the probability of the event occurring.
int event = 0;
if (randomNumber <= 0.70)
{
event = 1;
}
if (randomNumber <= 0.80)
{
event = 2;
}
else
{
event = 3;
}
The code does not work as intended. Assume that the variable randomNumber has been properly declared and initialized. Which of the following initializations for randomNumber will demonstrate that the code segment will not work as intended?
A) randomNumber = 0.70;
B) randomNumber = 0.80;
C) randomNumber = 0.85;
D) randomNumber = 0.90;
E) randomNumber = 1.00;
Computers and Technology
1 answer:
lora16 [44]2 years ago
3 0

Answer:

A) randomNumber = 0.70;

Explanation:

The code works perfectly for all values of randomNumber given in the options except option (a)

This is so because:

The first condition

<em>if (randomNumber <= 0.70)  {  event = 1;  }</em>

It checks if randomNumber is less than or equal to 0.70. This is true, so event is set to 1.

However, the next condition after it will also be executed because it is a different conditional to be executed.

So, we have:

if (randomNumber <= 0.80)  {  event = 2;  }

This condition is also true, so event is set to 2.

From the question randomNumber is meant to be event 1. However, this is different from the result of executing the code.

Hence, (a) is true

You might be interested in
An application programming interface (API) is: Group of answer choices the code the application software needs in order to inter
WITCHER [35]

Answer:

The code the application software needs in order to interact with the CPU

Explanation:

7 0
3 years ago
Imagine a typical website that works as a storefront for a business, allowing customers to browse goods online, place orders, re
Gwar [14]

Answer: See explanation

Explanation:

Following the information given in the question, the testing process for the website will include testing the links that are on the site.

Another that ng to test is to check if the menus and the buttons are working properly. Furthermore, the layout should be ensured that it's consistent as well as the ease with which the website can be used.

5 0
3 years ago
True or false? any webb app can be accessed and run on any computing
Mademuasel [1]

Answer:

B. False

Explanation:

A web application is a computer program that  works over the internet. So, in order to access and run it you need a web browser and this will also require to have an internet access. If you don't have one of these you will not be able to run the app.

6 0
2 years ago
Why doesn't the ad load ?
baherus [9]
Try refreshing the page, if not restart your device check your internet etc.
3 0
2 years ago
Read 2 more answers
As data travels further over a wavelength or frequency, what goes down?
LUCKY_DIMON [66]

As data travels further over a wavelength or frequency, the radiation type goes down.

<h3>What is an electromagnetic spectrum?</h3>

An electromagnetic spectrum can be defined as a range of frequencies and wavelengths into which an electromagnetic wave is distributed into.

In Science, the electromagnetic spectrum consist of the following types of energy from highest to lowest frequency and shortest to longest wavelength:

  • Gamma rays
  • X-rays
  • Ultraviolet radiation
  • Visible light
  • Infrared radiation
  • Microwaves
  • Radio waves

In this context, we can infer and logically deduce that as data travels further over a wavelength or frequency within the electromagnetic spectrum, the radiation type goes down.

Read more on electromagnetic spectrum here: brainly.com/question/23423065

#SPJ1

5 0
1 year ago
Other questions:
  • Write a function chat accepts a pointer to a C-string as its argument. The function should count the number of vowels appearing
    5·1 answer
  • Can you combine a wireless and wired lan in the same home
    14·1 answer
  • Which of the following is the process of writing the step-by-step instructions that can be understood by a computer?
    5·1 answer
  • The _____ component of a decision support system (DSS) includes mathematical and statistical models that, along with the databas
    14·1 answer
  • What type of formula uses data from multiple worksheets
    6·1 answer
  • Plz answer the following ​
    9·2 answers
  • Film’s importance in today’s economy?
    12·1 answer
  • What online resource would you use if you wanted to read a review about a new movie?
    8·1 answer
  • Part of the operating system core is responsible for controlling security, managing the file system, and providing a platform fo
    6·1 answer
  • Is each of the following method identifiers (a) legal and conventional, (b) legal but unconventional, or (C) illegal?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!