subject

Question 1
errors can be syntax errors or logic errors (the code works, but not as intended).

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 exclusive, which expression would properly generate values for the secret number?

(int)(math. random() * (upper − lower) ) + lower
(int)(math. random() * (upper − lower + 1) ) + lower
(int)(math. random() * (upper − lower) ) + lower + 1
(int)(math. random() * (upper − 1 − lower) ) + lower + 1
(int)(math. random() * (upper − lower + 1) ) + lower − 1

question 2
errors can be syntax errors or logic errors (the code works, but not as intended).

which of the following is equivalent to while( ! (userguess == secretnumber) )?

while( userguess ! = secretnumber )
while(userguess < secretnumber || userguess > secretnumber)
while( userguess < secretnumber & & userguess > secretnumber)
i only
ii only
iii only
i and ii only
i and iii only

question 3
errors can be syntax errors or logic errors (the code works, but not as intended).

after execution of the following code segment, what will be displayed?

int x = 15;
while(x > 0)
{
x −= 6;
}
system. out. println(x);

−6
−3
0
3
15

question 4
errors can be syntax errors or logic errors (the code works, but not as intended).

what conclusion can be made about the state of the program when the while loop terminates? assume answer is a declared and initialized string.

while(! answer. equals( "n"))
{
// code not shown
}

the value of answer is n
the value of answer is n or n
the value of answer is not n
the value of answer is y
nothing can be determined

question 5
errors can be syntax errors or logic errors (the code works, but not as intended).

in the guess my number program, the user continues guessing numbers until the secret number is matched. assuming numguesses is initialized to 1, how would the while statement be modified to include an extra criterion limiting the number of guesses to 15?

while( (userguess == secretnumber) || numguesses < 14 )
while( (userguess== secretnumber) & & numguesses < = 15 )
while( ! (userguess == secretnumber) || numguesses < 15 )
while( ! (userguess == secretnumber) & & numguesses < = 15 )
while( ! (userguess == secretnumber) & & numguesses < 15 )

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:40, EricaLSH7624
Match the personality traits with their description
Answers: 2
image
Computers and Technology, 22.06.2019 20:00, jc624826
What side length would you specify if you were required to create a regular hexagonal plate that was composed of 33 cm(squared) of sheet metal? dimension the side length to 0.1 cm
Answers: 2
image
Computers and Technology, 23.06.2019 12:00, lyn94
Using the list, you can select the number of photos that will appear on each slide. a. theme b. frame shape c. pictures in album d. picture layout
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, carolelai08
Stops: using the information learned in this course, explain three things you will not do when driving. a. b. c. explain why you will not do these things when driving. starts: using the information learned in this course, explain three things you will do when driving. a. b. c. explain why you will do these particular things when driving. explain one thing you will stop doing as a passenger. explain one thing you will start doing as a passenger.
Answers: 3
You know the right answer?
Question 1
errors can be syntax errors or logic errors (the code works, but not as intended).<...

Questions in other subjects:

Konu
English, 01.12.2020 04:30
Konu
Mathematics, 01.12.2020 04:30
Konu
English, 01.12.2020 04:30