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 05:00
Lisa has a section of her document that she would like to include in the index. which option should lisa choose? mark index mark entry insert endnote add text
Answers: 3
question
Computers and Technology, 23.06.2019 01:30
Negative methods of behavior correction include all but this: sarcasm verbal abuse setting an example for proper behavior humiliation
Answers: 1
question
Computers and Technology, 23.06.2019 04:31
Q14 what is most important for you to choose before you build a network? a. private network b. nos c. network media d. network protocol e. directory service
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Which of the statements below describe the guidelines for the use of text in presentation programs? a. do not use numbered lists. b. fonts should be appropriate for your audience. c. limit the number of fonts you use to three or four. d. only use bulleted lists for sales promotions. e. select font sizes that are appropriate for your delivery method. f. use font colors that work well with your background. select all that apply
Answers: 1
You know the right answer?
Use the following file to answer the questions (attached below): 1.

Errors can be synta...
Questions
question
Mathematics, 21.09.2020 02:01
question
Physics, 21.09.2020 02:01
Questions on the website: 13722360