Computers and Technology, 12.11.2020 09:00 Bra1nPowers
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 inclusive, 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
Question 2
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
Question 3
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)?
I) while( userGuess < secretNumber && userGuess > secretNumber)
II) while( userGuess < secretNumber || userGuess > secretNumber)
III) while( !(userGuess == secretNumber) )
I only
II only
III only
I and III only
II and III only
Question 4
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. The program needs to be modified to include an extra criterion that requires all guesses to be within the lower and upper bounds. If the user guesses below or above the range of the secret number, the while terminates. How would the while statement be modified to include the new criterion?
A) while(userGuess != secretNumber || userGuess >= lowerLimit || userGuess <= upperLimit)
B) while(userGuess != secretNumber || userGuess >= lowerLimit && userGuess <= upperLimit)
C) while(userGuess != secretNumber && userGuess >= lowerLimit && userGuess <= upperLimit)
D) while(userGuess == secretNumber || userGuess >= lowerLimit && userGuess <= upperLimit)
E) while(userGuess == secretNumber && userGuess >= lowerLimit || userGuess <= upperLimit)
Answers: 1
Computers and Technology, 23.06.2019 22:00, elijah1090
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
Computers and Technology, 24.06.2019 05:30, MOONCHILDSUGA
If you combine two cells into one, what action are you performing? a. adding a new row or column b. splitting the cells c. removing a new row or column d. merging the cells
Answers: 2
Computers and Technology, 24.06.2019 11:00, asiaosterling
The program below has been generalized to read a user's input value for hourlywage. run the program. notice the user's input value of 10 is used. modify that input value, and run again. generalize the program to get user input values for workhoursperweek and workweeksperyear (change those variables' initializations to 0). run the program. monthsperyear will never change, so define that variable as final. use the standard for naming final variables. ex: final int max_length
Answers: 2
Question 1
Errors can be syntax errors or logic errors (the code works, but not as intended).
...
...
Biology, 25.01.2021 19:40
Mathematics, 25.01.2021 19:40