Question: Fill in the blank to generate a random number between 100 and 200 including 100 and 200. You must enter one number in each box



Fill in the blank to generate a random number between 100 and 200 including 100 and 200.

You must enter one number in each box otherwise it will be marked incorrect


Random rand = new Random();

_____num = rand.nextInt( ) + ;



Flag question: Question 2Question 21 pts


which one of the following methods can be used to do data validation

Group of answer choices

all of the answers


hasNextInt()


hasNext()


hasNextDouble()



Flag question: Question 3Question 31 pts


do-while loop is an indefinite loop

Group of answer choices

True


False



Flag question: Question 4Question 41 pts


the condition if( !( x > 10 && y < 20) ) is the same as

1. if( x < 10 || y > 20)

2. if( x <= 10 || y >= 20)

3.if(x <= 10 && y >=20)

4. non of the answers


Group of answer choices

2


1


3


4



Flag question: Question 5Question 51 pts


which one of the following loops executes at least once

Group of answer choices

do-while


while


for


all of the answers



Flag question: Question 6Question 61 pts


What would be the range of the number generated by the following code

int num = rand.nextInt(50) + 20;

Group of answer choices

20-69


20-50


0-70


none of the answers



Flag question: Question 7Question 71 pts


The following code will cause a runtime error

String s = "hello"; if(s.charAt(7) == 'a' && s.length() > 7) System.out.println(s.charAt(0)); which one of the following will fix the problem 1. change the && to || 2. swap the two conditions so that s.length() > 7 can be checked first 3. change the == to != 4. change > to <=

Group of answer choices

2


1


3


4



Flag question: Question 8Question 81 pts


Random class is in the ___________package

Group of answer choices

util


Scanner


Random


none of the answers



Flag question: Question 9Question 91 pts


Which of the answers is the same as the following condition!((2 == 3) && (-1 < 5) && isPrime(n))
  1. !(2 != 3) || !(-1 < 5) || isNotPrime(n)
  2. !(2 == 3) && !(-1 < 5) && !isPrime(n)
  3. (2 == 3) || (-1 < 5) || isPrime(n)
  4. (2 != 3) || (-1 >= 5) || !isPrime(n)
  5. (2 != 3) && (-1 > 5) && isPrime(n)

Group of answer choices

4


1


2


3


5



Flag question: Question 10Question 101 pts


The condition for the following two while loops is exactly the same

boolean b = true; while(b) { //some code } while(b == true) { //some code }


Group of answer choices

True


False



Flag question: Question 11Question 111 pts


what is the output of the following code

int zest = 0; do { for(int i = 1; i < 5; i++) System.out.print("Zest "); }while(zest > 0);



Flag question: Question 12Question 123 pts


The following code segment is suppose to ask the user to enter an integer value between 5-10. This code must make sure that the user enters an integer type number, once an integer value is entered then it must be checked to see if it is with the range of 5 and 10.

Fill in the blank to complete the code

do { System.out.println("Enter a number between 5 and 10: "); while( )// making sure the user enters an integer(data type validation { kb.nextLine(); System.out.println("Enter a number between 5 and 10: "); } input = ; }while(input< input > ); Here is a sample output Enter a number between 5 and 10: wdsd Enter a number between 5 and 10: sdfdsf Enter a number between 5 and 10: 78 Enter a number between 5 and 10: 99 Enter a number between 5 and 10: 23 Enter a number between 5 and 10: 5


Flag question: Question 13Question 133 pts


the following code segment is suppose to display 10 9 8 7 6 5 4 3 2 1 0

fill in the blank to get the desired output

int count = ; do { System.out.print(count+ " "); count--; } ( );


Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The detailed answer for the above question is provided below 1 Question java int randomNumrandne... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!