answer.
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
balandron [24]
1 year ago
5

What conclusion can be made about the state of the program when the while loop terminates? Assume answer is a declared and initi

alized String. (4 points)
while(answer.equals("N"))
{
// code not shown
}

In the Guess My Number game, there is a lower limit and an upper limit for the range of possible numbers to guess. If the lower limit were exclusive and the upper limit inclusive, which expression would properly generate values for the secret number? (4 points)

a
(int)(Math.random() * (upper − lower) ) + lower

b
(int)(Math.random() * (upper − lower + 1) ) + lower

c
(int)(Math.random() * (upper − lower) ) + lower + 1

d
(int)(Math.random() * (upper − 1 − lower) ) + lower + 1

e
(int)(Math.random() * (upper − lower + 1) ) + lower - 1



In the Guess My Number program, the user continues guessing numbers until the secret number is matched. The program needs to be modified to include an extra criterion that requires all guesses to be within the lower and upper bounds. If the user guesses below or above the range of the secret number, the while terminates. How would the while statement be modified to include the new criterion? (4 points)


a

while(userGuess != secretNumber || userGuess >= lowerLimit || userGuess <= upperLimit)


b

while(userGuess != secretNumber || userGuess >= lowerLimit && userGuess <= upperLimit)


c

while(userGuess != secretNumber && userGuess >= lowerLimit && userGuess <= upperLimit)


d

while(userGuess == secretNumber || userGuess >= lowerLimit && userGuess <= upperLimit)


e

while(userGuess == secretNumber && userGuess >= lowerLimit || userGuess <= upperLimit)
Computers and Technology
1 answer:
stellarik [79]1 year ago
3 0

<u>Answer:</u>

<em>1. The loop will run unless the value of answer equals to Capital N.</em> The method equals is “case-sensitive” that is lower case letter and upper case letters are considered different. That “a” and “A” means the same to us, but for the method equals it is different and equals method will return false if the case is not matching.

<em>2. a (int)(Math.random() * (upper − lower) ) + lower </em>

Since we need to consider the lower limit value together to get the desired results we need to add the value of lower limit to the multiplied answer.

<em>3. b while(userGuess != secretNumber || userGuess >= lowerLimit && userGuess <= upperLimit)</em>

Here the program is required to check the while loop and exit when user guess the number or we can say the loop should continue until the user guess the number, so that is why we have taken <em>userGuess!=secretNumber. </em>Next the loop should be exited if it is not within the range or we can say that the loop should run only if the guessed number is within the upper and lower limit.<em> That is why we have opted for the condition userGues>=lowerlimit && userGuess<=upperlimit.</em> Why we have taken && as the operator is that, it’s a range of values so && operator best suit for this kind of logical condition.

You might be interested in
The OSI security architecture provides a systematic framework for defining security attacks, mechanisms, and services. True or F
Alex Ar [27]

Answer:

True is the correct answer for the above question

Explanation:

  • The OSI security architecture is a security framework that is used to secure the data packets when it is going to transfer on the internet for communication.
  • It is used to define the security rules and mechanism which need to secure the data packets.
  • It mainly focuses on Security services, Security attacks, Security mechanisms.
  • The above question-statement states about the framework which defines the security mechanism to secure from the attacks are known as OSI Security architecture which is the correct statement which is described above. Hence True is the correct answer.
3 0
2 years ago
A common fallacy is to use MIPS (millions of instructions per second) to compare the performance of two different processors, an
yulyashka [42]

The question is incomplete. It can be found in search engines. However, kindly find the complete question below:

Question

Cites as a pitfall the utilization of a subset of the performance equation as a performance metric. To illustrate this, consider the following two processors. P1 has a clock rate of 4 GHz, average CPI of 0.9, and requires the execution of 5.0E9 instructions. P2 has a clock rate of 3 GHz, an average CPI of 0.75, and requires the execution of 1.0E9 instructions. 1. One usual fallacy is to consider the computer with the largest clock rate as having the largest performance. Check if this is true for P1 and P2. 2. Another fallacy is to consider that the processor executing the largest number of instructions will need a larger CPU time. Considering that processor P1 is executing a sequence of 1.0E9 instructions and that the CPI of processors P1 and P2 do not change, determine the number of instructions that P2 can execute in the same time that P1 needs to execute 1.0E9 instructions. 3. A common fallacy is to use MIPS (millions of instructions per second) to compare the performance of two different processors, and consider that the processor with the largest MIPS has the largest performance. Check if this is true for P1 and P2. 4. Another common performance figure is MFLOPS (millions of floating-point operations per second), defined as MFLOPS = No. FP operations / (execution time x 1E6) but this figure has the same problems as MIPS. Assume that 40% of the instructions executed on both P1 and P2 are floating-point instructions. Find the MFLOPS figures for the programs.

Answer:

(1) We will use the formula:

                                       CPU time = number of instructions x CPI / Clock rate

So, using the 1 Ghz = 10⁹ Hz, we get that

CPU time₁ = 5 x 10⁹ x 0.9 / 4 Gh

                    = 4.5 x 10⁹ / 4 x 10⁹Hz = 1.125 s

and,

CPU time₂ = 1 x  10⁹ x 0.75 / 3 Ghz

                  = 0.75 x 10⁹ / 3 x 10⁹ Hz = 0.25 s

So, P2 is actually a lot faster than P1 since CPU₂ is less than CPU₁

(2)

     Find the CPU time of P1 using (*)

CPU time₁ = 10⁹ x 0.9 / 4 Ghz

                = 0.9 x 10⁹ / 4 x 10⁹ Hz = 0.225 s

So, we need to find the number of instructions₂ such that  CPU time₂ = 0.225 s. This means that using (*) along with clock rate₂ = 3 Ghz and CPI₂ = 0.75

Therefore,   numbers of instruction₂ x 0.75 / 3 Ghz = 0.225 s

Hence, numbers of instructions₂ = 0.225 x 3 x  10⁹ / 0.75  = 9 x 10⁸

So, P1 can process more instructions than P2 in the same period of time.

(3)

We recall  that:

MIPS = Clock rate / CPI X 10⁶

  So, MIPS₁ = 4GHZ / 0.9 X 10⁶ = 4 X 10⁹HZ / 0.9 X 10⁶ = 4444

        MIPS₂ = 3GHZ / 0.75 X 10⁶ = 3 x 10⁹ / 0.75 X 10⁶ = 4000

So, P1 has the bigger MIPS

(4)

  We now recall that:

MFLOPS = FLOPS Instructions / time x 10⁶

              = 0.4 x instructions / time x 10⁶ = 0.4 MIPS

Therefore,

                  MFLOPS₁ = 1777.6

                  MFLOPS₂ = 1600

Again, P1 has the bigger MFLOPS

3 0
1 year ago
A patient asks her doctor to send a copy of her records to another medical office. However, the records are not transmitted beca
bezimeni [28]
 This type of security failure is called WIN32K_SECURITY_FAILURE. <span> This indicates a </span>security failure was detected in win32k. <span>According to a new report issued by Dark Reading, there are a number of key </span>security failures<span> that cybercriminals take advantage of.</span>
5 0
2 years ago
Read 2 more answers
Develop an EER model for the following situation using the traditional EER notation, the Visio notation, or the subtypes inside
podryga [215]

Answer:

Explanation:

To develop the model for Creating the supertype/subtype relationship three diffrent types of notation is given bellow accrdig to the diagram attached.

1.Traditional EER (Enhance Entity-Relational) notation

2.Microsoft Visio notation

3.Subtypes Inside supertype note

<em><u>Traditional EER(Enhance Entity-Relational)notation for the international school of technology diagram is attached bellow</u></em>

The diagram consist of the following entity

Room Supertype

Media Entity Type

COURSE entity type

Section weak entity type

Schedule associatiative entity type

<u><em>Microsoft Visio Notation for the international school of technology  is ashown in the diagram bellow.</em></u>

The diagram consist of the following entity

Room Supertype

Media Entity Type

Computer entity type

Instructor entity type

Time slot entity type

<u><em>Subtype Inside Supertype note Notation for the international school of technology  is shown in the diagram bellow.</em></u>

The diagram consist of the following entity

Room Supertype

Media Entity Type

Computer entity type

Instructor entity type

Time slot entity type

3 0
2 years ago
Lynn runs the locate command and the results include many files from a directory that she doesn't want to include in her search.
Zinaida [17]

Answer:

C) /etc/updatedb.conf

Explanation:

The locate command actually uses the configuration file located at /etc/updated.conf.

5 0
1 year ago
Read 2 more answers
Other questions:
  • ____ refers to typing your entire e-mail message or discussion group post using only capital letters.
    15·1 answer
  • ________ is free software created and updated by a worldwide community of programmers. office software a web service cloud-based
    9·1 answer
  • Assume the availability of class named IMath that provides a static method, toThePowerOf which accepts two int arguments and ret
    10·1 answer
  • If, instead, charge 3 is located to the left of charge 1 at a point (on the x axis) that satisfies the conditions given in the p
    7·1 answer
  • Write the definition of a class Telephone. The class has no constructors, one instance variable of type String called number, an
    9·1 answer
  • Ciscon Telecom is a mobile operator in the European Union. The company provides personalized services to its customers, and its
    8·2 answers
  • E xercise 17.2.4: The following is a sequence of undo-log records written by two transactions T and U: &lt; START T&gt;; ; &lt;
    15·1 answer
  • Suppose that we have a set of activities to schedule among a large number of lecture halls, where any activity can take place in
    8·1 answer
  • In this code, identify the repeated pattern and replace it with a function called month_days, that receives the name of the mont
    14·1 answer
  • Explain working principle of computer?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!