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
RSB [31]
3 years ago
6

Which of the following expressions yields an integer between 0 and 100, inclusive? Question 5 options: (int)(Math.random() * 100

+ 1) (int)(Math.random() * 101) (int)(Math.random() * 100) (int)(Math.random() * 100) + 1
Computers and Technology
1 answer:
Alex17521 [72]3 years ago
3 0

Answer:

(b) (int)(Math.random() * 101)

Explanation:

Given

min = 0 --- minimum

max =100 --- maximum

Required

Java expression to generate random integer between the above interval

The syntax to do this is:

(int)(Math.random((max - min) + 1) + min)

Substitute the values of max and min

(int)(Math.random((100 - 0) + 1) + 0)

Simplify the expression

(int)(Math.random(100 + 1) + 0)

(int)(Math.random(101) + 0)

(int)(Math.random(101))

Hence, the right option is:

(b) (int)(Math.random() * 101)

You might be interested in
The time delay of a long-distance call can be determined by multiplying a small fixed constant by the number of communication li
lara [203]

Answer:

The diameter of T is 2k+1.

See explaination for the details

Explanation:

We can compute the diameter of the tree T by a pruning procedure, starting at the leaves (external nodes).

Remove all leaves of T. Let the remaining tree be T1.

Remove all leaves of T1. Let the remaining tree be T2.

Repeat the "remove" operation as follows: Remove all leaves of Ti. Let remaining tree be Ti+1.

When the remaining tree has only one node or two nodes, stop! Suppose now the remaining tree is Tk.

If Tk has only one node, that is the center of T. The diameter of T is 2k.

If Tk has two nodes, either can be the center of T. The diameter of T is 2k+1.

7 0
3 years ago
The following code is intended to calculate the sum of the first five positive odd integers. int sum = 0, k; for (k = 1; k <=
goldfiish [28.3K]
Calculate the sum of the first 5 positive odd integers: Let's do this in our head first, so we can check if our code is right or not!

The first positive 5 odd integers are: 1, 3, 5, 7, 9
Sum these to: 25

int sum = 0, k; <------These just declare our variables, telling the program 'Hey, I'm going to use 'sum' and 'k' to store data.

for (k = 1; <---We're going to repeat the following code, and we're starting at 1
k <= 10; <---- We're going to continue to repeat until we greater than 10.
k += 2) <------ Every time we do a loop, we're going to add 2.

{ sum += k; } <---- We're going to increase the number inside "sum" by the number inside "k"

Let's run this and see what happens. Remember, we keep going until we hit more than 10.

Round 0: k = nothing, sum = 0 (before we start the loop)
Round 1: k = 1, sum = 1
Round 2: k = 3, sum = 1+3 or 4
Round 3: k = 5, sum = 4 + 5 or 9
Round 4: k = 7, sum = 9 + 7 = 16
Round 5: k = 9, sum = 16 + 9 = 25
Round 6: k = 11, sum = 25 + 11 = 36

Well, we can tell here that round 5 was correct, but round 6 is not correct. And our loop condition says <=10, which means we have to do Round 6.

This means we did it one too many times. Our ending condition should be <10, instead of <=10. 

Option B


5 0
3 years ago
WhyTheCombOfNatashaOtomoskiHas21Teeth?.txt
mash [69]

What is the question?

6 0
3 years ago
What types of items can tab be used to complete once you start typing the entities' name?
White raven [17]
The answer to this question is <span>file, command, or directory names
File is the part of the program that could be used to store various information. The command is part of the program that give abilities for user to run a certain program within the system operation. Directory names will create some sort and arrangement on collection of files</span>
3 0
3 years ago
A cloud data storage company develops a proprietary system of hardware and software, trains its systems analysts on the technolo
cupoosta [38]

Answer:

Creating Strategic Fit

Explanation:

Strategic fit expresses the degree to which an organization is matching its resources and capabilities with the opportunities in the external environment. The matching takes place through strategy and it is therefore vital that the company has the actual resources and capabilities to execute and support the strategy. Strategic fit can be used actively to evaluate the current strategic situation of a company as well as opportunities such as M&A and divestitures of organizational divisions.

7 0
3 years ago
Other questions:
  • When the speaker compares dream memories to fall leaves that are hard to catch,what feeling does the simile suggest?
    14·2 answers
  • Anderson uses his computer and internet link to chart the movement of his favorite 46 stocks. He buys and sells according to the
    15·1 answer
  • Consider the following 32 bit binary representation of the value using IEEE 754 single precision floating point representation.
    15·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    12·1 answer
  • You've just purchased 10 new notebook systems for your users. You are concerned that users will leave the systems on for long pe
    10·1 answer
  • Week 3 Discussion Requirements Modeling Requirements modeling is one of the earlier phases of software development where require
    7·2 answers
  • Create a winform application that lets the user enter a temperature. With a ComboBox object offer the user three choices for inp
    9·1 answer
  • Simple example of hybrid computer​
    7·2 answers
  • How to download film​
    14·2 answers
  • Rudy accidentally sent a sensitive work report to a personal friend named James instead one of his co-workers, who is also named
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!