subject

Use the following file to answer the questions (attached below): 1.

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 10?

A while( (userNumber != secretNumber) && numGuesses secretNumber)
II while( userGuess secretNumber)
III while( userGuess = secretNumber)

A. I only

B. II only

C. III only

D. I and II only

E. I and III only

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 = 0;

while(x < 20)

{

x += 3;

}

System. out. println(x);

A. 6

B. 18

C. 20

D. 21

E. 24

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

}

A. The value of answer is N

B. The value of answer is n or N

C. The value of answer is not N

D. The value of answer is Y

E. Nothing can be determined

5.

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?

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

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:00
You should hand write your references on your resume.
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
What is the power dissipated by a resistor with a current of 0.02 a and a resistance of 1,000 ? a. 200 w b. 20 w c. 0.4 w d. 4 w
Answers: 1
question
Computers and Technology, 23.06.2019 15:00
Visually impaired individuals generally rely on the for navigation. thus, designers need to ensure that mouse-specific inputs, such as pointing, clicking, and hovering, can be done without a mouse.
Answers: 1
question
Computers and Technology, 24.06.2019 08:00
Arah has entered data about football players from team a and team b in a worksheet. she enters names of players from team a with details about each player in different columns of the worksheet. similarly, she enters details of all the players from team b. which option will her view the data for team a and team b in two separate sections after printing? a. page break view b. freeze pane view c. split screen view d. full screen view e. zoom out view
Answers: 1
You know the right answer?
Use the following file to answer the questions (attached below): 1.

Errors can be synta...
Questions