36.8k views
4 votes
In a certain game, a player may have the opportunity to attempt a bonus round to earn extra points. In a typical game, a player is given 1 to 4 bonus round attempts. For each attempt, the player typically earns the extra points 70% of the time and does not earn the extra points 30% of the time. The following code segment can be used to simulate the bonus round.

success - 0
attempts - RANDOM 1, 4
REPEAT attempts TIMES
IF (RANDOM 110 s 7
success - success + 1
DISPLAY "The player had"
DISPLAY attempts
DISPLAY "bonus round attempts and"
DISPLAY success
DISPLAY "of them earned extra points."
Which of the following is not a possible output of this simulation?
А. The player had 1 bonus round attempts and 1 of them earned extra points.
B The player had 2 bonus round attempts and of them earned extra points.
С The player had 3 bonus round attempts and 7 of them earned extra points.
D The player had 4 bonus round attempts and 3 of them earned extra points.

1 Answer

5 votes

Answer:

С The player had 3 bonus round attempts and 7 of them earned extra points.

Step-by-step explanation:

Given

See attachment for correct code segment

Required

Which of the options is not possible?

From the question, we understand that:


attempts \to [1,4] --- attempt can only assume values 1, 2, 3 and 4

The following "if statement" is repeated three times

IF RANDOM[1,10] <= 7:

success = success + 1

This implies that the maximum value of the success variable is 3

The first printed value is the attempt variable

The second printed value is the success variable.

From the list of given options, (a), (b) and (d) are within the correct range of the two variable.

While (c) is out of range because the value printed for variable success is 7 (and 7 is greater than the expected maximum of 3)

In a certain game, a player may have the opportunity to attempt a bonus round to earn-example-1
User LionKimbro
by
4.9k points