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, 22.06.2019 12:00
Which of the following β€œinvisible” marks represents an inserted tab?
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What is the name of the sound effect that danny hears
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Technician a says engine assemblies can be mounted longitudinally in a chassis. technician b says engine assemblies can be mounted transversely in a chassis. who is correct?
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
A. in packet tracer, only the server-pt device can act as a server. desktop or laptop pcs cannot act as a server. based on your studies so far, explain the client-server model.
Answers: 2
You know the right answer?
Use the following file to answer the questions (attached below): 1.

Errors can be synta...
Questions
question
Mathematics, 15.04.2020 23:53
question
Mathematics, 15.04.2020 23:53
Questions on the website: 13722362