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
MrRissso [65]
4 years ago
12

The code segment below is intended to randomly print one of the values 2, 4, 6, or 8 with equal probability.

Computers and Technology
1 answer:
WARRIOR [948]4 years ago
3 0

Answer:

D. (int) (Math.random() * 4 + 1)

Explanation:

The first two options (A and B) will give a compiler error incompactible types since the Math.random() functions returns a double and val has been declared as an int. To overcome this, a type casting to integer is carried out. Option D (int) (Math.random() * 4 + 1)  will return a value after been casted to an int of 1,2,3,4 which when this line val *= 2; is executed gives the expected output of  2,4,6 or 8.

You might be interested in
Mary’s computer is running slow and will not load programs or videos. She has tried restarting her computer yet it is still not
luda_lava [24]
She shall not reset her computer because she will have to load every thing again
8 0
4 years ago
I don't know what to do, anyone there?​
s2008m [1.1K]
I’m here, hello. . . . . . .
3 0
3 years ago
A car can move, a crystal can grow, a fire alarm is sensitive and they are classified as non-living things. Explain?​
aleksandrvk [35]

Answer:

They are all controlled by something else. A car is controlled by humans. A crystal grows due to the temperature and climate. A fire alarm only rings when it senses smoke, which is caused by something else, usually humans.

7 0
3 years ago
This standard library function returns a random oating-point number within a specied range of values.
IgorLugansk [536]

Answer:

Uniform

Explanation:

The uniform is a standard library function in python that returns a random floating number withing a specified range of values. Floating numbers which are integer numbers separated by a dot or decimal point from the fractional part. It is part of the random module. it is implemented as

Because it is defined in the random module, random module needs to be imported for uniform to be available for use.

import random

random.uniform(lowest point or highest number, highest point or highest number)

5 0
3 years ago
Explain two consequences that would occur, if the "Device Manager and the "File Managerstopped communicating with each other?
sladkih [1.3K]

Answer:

So, you won't be able to install driver via a file because device manager can't find it. Just reinstall windows if that happens lol.

4 0
3 years ago
Other questions:
  • You begin your first day of responsibilities by examining the recent IS security breach at GearUp to get ideas for safeguards yo
    11·1 answer
  • Technlogies are having a negative impact on business true or false
    7·1 answer
  • . A double is more precise than a float... true or false?
    12·1 answer
  • Teachers can organize the classroom environment to facilitate activities and to prevent problems. True Or False
    15·1 answer
  • 1. How do you identify the location of components and replacement procedures for notebook systems?
    6·1 answer
  • Differentiate the term, "bundling," as applied to a Mac/Apple computer and a PC.
    5·1 answer
  • Which of the following allows you to copy
    15·1 answer
  • Which feature helps an edit-test-bug cycle work faster in the python programming language
    15·2 answers
  • The key uniquely identifies each record
    9·1 answer
  • Hello. I really need this done ASAP. Don't scroll down. JUst look please.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!