Do only question 2

. 2

Step-by-step answer

03.02.2023, solved by verified expert
Unlock the full answer
1 students found this answer . helpful

Answer:

Solution given below.

Step-by-step explanation:

When x = -2 

f(-2) = 2(-2) -3 = -7 

point (-2,-7)

When x = 1

f(1) = 2(1) - 3 = -1 

point(1,-1)

when x = 2

f(2) = -4 

point (2,-4) 

and when x = -5 

f(-5) = 2(-5) - 3 = -13 

point (-5,-13) 

Complete table is: 

Do only question 2, №15256660, 10.04.2021 12:28
It is was helpful?

Faq

Computers and Technology
Step-by-step answer
P Answered by Master

1. E: II and III only

2. A: (int)(Math.random() * (upper − lower) ) + lower

3. A: The value of answer is N

4. E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

5. C: 21

Explanation:

1. Which of the following is equivalent to while(userGuess != secretNumber)?

I. while( userGuess < secretNumber && userGuess > secretNumber)  

NO - This will test until the userGuess is smaller AND greater than the secretNumber, at the same time... so that condition will never be true.

II. while( userGuess < secretNumber || userGuess > secretNumber)

YES - This will test the value of userGuess and see if it's smaller OR greater than secetNumber.  So, it will loop until the user guesses right.

III. while( !(userGuess == secretNumber) )

YES, this will negate the match with the secretNumber.  In order words, if it's not a match, it will return true... so the loop will run until it finds a false condition (a match).

As you can see, only II and III are valid.

2.  If the lower limit were inclusive and the upper limit exclusive, which expression would properly generate values for the secret number?

A: (int)(Math.random() * (upper − lower) ) + lower

Since the lower limit is INCLUSIVE, we mustn't add one to the lower limit.  Also, the Math.random() function returns a value that matches our needs; it returns a value between [0,1[ (meaning the 0 is included, but not the 1).

Assuming the (int) caster does return only the integer portion doing a round down of the result, we'll be perfect.

3. What conclusion can be made about the state of the program when the while loop terminates?

while(!answer.equals( "N"))

{

A: The value of answer is N

The condition in the loops reads as "While the negation of the answer being 'N', loop".  If the answer equals 'N' then the method should return true... which will be negated by the '!' operator, causing the condition to be false. Thus we know that if the loop ends, the value of answer contains 'N', any other value will keep the loop going.

4. Assuming numGuesses is initialized to 1, how would the while statement be modified to include an extra criterion limiting the number of guesses to 15?

E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

This modified condition will first test to see if the user has guessed the secretNumber (if he has, the first sub-parenthesis will be true... so the left side of the && operator will be false due to the negation operator.  The right side of the && operator will check to see how many tries have been attempted. Since the counter starts at 1, it needs to go up to 15 inclusively... so the <= is the right comparison operator.

5. After execution of the following code segment, what will be displayed?

int x = 1;

while(x < 18)

{

x += 5;

}

System.out.println(x);

C: 21

The x variable is initialized with 1... then enters the loop, in which it is incremented by 5 at each passage.

So after first passage, x = 6

After second passage, x = 11

After third passage, x = 16

After fourth passage, x = 21

Cannot enter the loop again because 21 > 18.

So, it will print out the value of 21.

Computers and Technology
Step-by-step answer
P Answered by Master

1. E: II and III only

2. A: (int)(Math.random() * (upper − lower) ) + lower

3. A: The value of answer is N

4. E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

5. C: 21

Explanation:

1. Which of the following is equivalent to while(userGuess != secretNumber)?

I. while( userGuess < secretNumber && userGuess > secretNumber)  

NO - This will test until the userGuess is smaller AND greater than the secretNumber, at the same time... so that condition will never be true.

II. while( userGuess < secretNumber || userGuess > secretNumber)

YES - This will test the value of userGuess and see if it's smaller OR greater than secetNumber.  So, it will loop until the user guesses right.

III. while( !(userGuess == secretNumber) )

YES, this will negate the match with the secretNumber.  In order words, if it's not a match, it will return true... so the loop will run until it finds a false condition (a match).

As you can see, only II and III are valid.

2.  If the lower limit were inclusive and the upper limit exclusive, which expression would properly generate values for the secret number?

A: (int)(Math.random() * (upper − lower) ) + lower

Since the lower limit is INCLUSIVE, we mustn't add one to the lower limit.  Also, the Math.random() function returns a value that matches our needs; it returns a value between [0,1[ (meaning the 0 is included, but not the 1).

Assuming the (int) caster does return only the integer portion doing a round down of the result, we'll be perfect.

3. What conclusion can be made about the state of the program when the while loop terminates?

while(!answer.equals( "N"))

{

A: The value of answer is N

The condition in the loops reads as "While the negation of the answer being 'N', loop".  If the answer equals 'N' then the method should return true... which will be negated by the '!' operator, causing the condition to be false. Thus we know that if the loop ends, the value of answer contains 'N', any other value will keep the loop going.

4. Assuming numGuesses is initialized to 1, how would the while statement be modified to include an extra criterion limiting the number of guesses to 15?

E: while( !(userGuess == secretNumber) && numGuesses <= 15 )

This modified condition will first test to see if the user has guessed the secretNumber (if he has, the first sub-parenthesis will be true... so the left side of the && operator will be false due to the negation operator.  The right side of the && operator will check to see how many tries have been attempted. Since the counter starts at 1, it needs to go up to 15 inclusively... so the <= is the right comparison operator.

5. After execution of the following code segment, what will be displayed?

int x = 1;

while(x < 18)

{

x += 5;

}

System.out.println(x);

C: 21

The x variable is initialized with 1... then enters the loop, in which it is incremented by 5 at each passage.

So after first passage, x = 6

After second passage, x = 11

After third passage, x = 16

After fourth passage, x = 21

Cannot enter the loop again because 21 > 18.

So, it will print out the value of 21.

Mathematics
Step-by-step answer
P Answered by PhD

Step-by-step explanation:

2. the height for the first row is 4. The capacity is most likely the same as the volume

the width for the second row is 3.5

the length of the third one is 12

5a. 4

5b. 5

5.c 100

Biology
Step-by-step answer
P Answered by PhD

D. temperature

explanation:

hope this helped <3 also if wouldn't mind could you pls give me brainliest? (im trying to level up) thanks! :)

Mathematics
Step-by-step answer
P Answered by PhD

Step-by-step explanation:

2. the height for the first row is 4. The capacity is most likely the same as the volume

the width for the second row is 3.5

the length of the third one is 12

5a. 4

5b. 5

5.c 100

Biology
Step-by-step answer
P Answered by PhD

D. temperature

explanation:

hope this helped <3 also if wouldn't mind could you pls give me brainliest? (im trying to level up) thanks! :)

Social Studies
Step-by-step answer
P Answered by Master

Explanation:

A lunar eclipse can only occur at the time of Full Moon.

another is 1) were treated badly

The Middle Passage was the most infamous route of this triangular trade. Although danger lurked constantly throughout the voyage across the Atlantic, the greatest danger to the slave ships always came when they were loading on the African coast. Once aboard the ships, the negroes realized that they were being sent far away from home, and often there was violence even before the ship set sail. However, most of these uprisings were easily put down. Others jumped overboard and plunged from the ship into the sea, choosing to either drown or be devoured by blood-thirsty sharks rather than be taken from their homeland. P2.

Social Studies
Step-by-step answer
P Answered by Specialist

Explanation:

A lunar eclipse can only occur at the time of Full Moon.

another is 1) were treated badly

The Middle Passage was the most infamous route of this triangular trade. Although danger lurked constantly throughout the voyage across the Atlantic, the greatest danger to the slave ships always came when they were loading on the African coast. Once aboard the ships, the negroes realized that they were being sent far away from home, and often there was violence even before the ship set sail. However, most of these uprisings were easily put down. Others jumped overboard and plunged from the ship into the sea, choosing to either drown or be devoured by blood-thirsty sharks rather than be taken from their homeland. P2.

Try asking the Studen AI a question.

It will provide an instant answer!

FREE