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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 18:30, erjalinalii
Janice recently received her college degree and is looking for a job. she is worried that since she just finished school, she will be required to repay her perkins and direct subsidized loans immediately. janice pulls out the paperwork she signed and reviews it again for repayment information. after reading all of the information, janice discovers that
Answers: 2
image
Computers and Technology, 24.06.2019 00:00, miguelturner
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
image
Computers and Technology, 24.06.2019 16:50, bella7524
7.23 main lab 7 - online shopping cart background this main lab extends the earlier prep lab "online shopping cart part 1". (you should save this as a separate project from the earlier prep lab). you will create an on-line shopping cart like you might use for your on-line purchases. the goal is to become comfortable with setting up classes and using objects. requirements this lab can be done individually or as pair programming. expanded itemtopurchase class (15 points) extend the itemtopurchase class as follows. we will not do unit testing in this lab so we will not be giving you the names of the member functions. create good ones on your own. create a parameterized constructor to assign item name, item description, item price, and item quantity (default values of "none" for name and description, and 0 for price and quantity). additional public member functions set an item description get an item description print the cost of an item - outputs the item name followed by the quantity, price, and subtotal (see example) print the description of an item - outputs the item name and description (see example) additional private data members a string for the description of the item. example output of the function which prints the cost of an item: bottled water 10 @ $1.50 = $15.00 example output of the function which prints the item description:
Answers: 1
image
Computers and Technology, 24.06.2019 18:10, albattatasraap5wymy
Most information security incidents will occur because of select one: a. users who do not follow secure computing practices and procedures b. increases in hacker skills and capabilities c. poorly designed network protection software d. increasing sophistication of computer viruses and worms
Answers: 1
You know the right answer?
Use the following file to answer the questions (attached below): 1.

Errors can be synta...

Questions in other subjects:

Konu
Physics, 30.07.2019 08:30
Konu
Mathematics, 30.07.2019 08:30