Algorithm Verification

Consider the following selection statement where X is an integer test score between 0 and 100.
input X
if (0 <= X and X < 49)
output "you fail"
else if (50 <= X and X < 70)
output "your grade is" X
output "you did OK"
else if (70 <= X and X < 85)
output "your grade is" X
output "you did well"
else if (85 <= X and X < 100)
output "your grade is" X
output "you did great"
endif
output "how did you do?"
o What will be printed if the input is 0?
o What will be printed if the input is 100?
o What will be printed if the input is 51?
o What will be printed if the user enters ¿Wingding¿?
o Is this design robust? If so, explain why. If not, explain what you can do to make it robust. The design is not robust because there is no explicit assignment of an integer type to the input variable X or check to see if the integer input lies between 0 and 100 (inclusive). So, the program will execute irrespective of the input. Moreover, it does not have a proper output defined at X = 49 and X = 1 ...
o How many levels of nesting are there in this design?
o Give a set of values that will test the normal operation of this program segment. Defend your choices.
o Give a set of test values that will cause each of the branches to be executed.
o Give a set of test values that test the abnormal operation of this program segment.

Please Help!!!!

To answer these questions, let's go through the algorithm step by step:

1. What will be printed if the input is 0?
If the input is 0, the condition (0 <= X and X < 49) evaluates to true, so "you fail" will be output.

2. What will be printed if the input is 100?
If the input is 100, the condition (85 <= X and X < 100) evaluates to true, so "your grade is 100" and "you did great" will be output.

3. What will be printed if the input is 51?
If the input is 51, the condition (50 <= X and X < 70) evaluates to true, so "your grade is 51" and "you did OK" will be output.

4. What will be printed if the user enters "Wingding"?
Since the input is expected to be an integer, if the user enters "Wingding", it will not satisfy any of the conditions, and no output will be printed. The program may throw an error or enter an infinite loop, depending on how the input is handled.

5. Is this design robust? If not, explain what you can do to make it robust.
No, this design is not robust. It does not handle input validation to ensure that the input is an integer. Additionally, it does not have a defined output for certain values such as 49 and 100. To make it robust, you can add input validation to ensure the user enters an integer and handle cases where the input is outside the expected range.

6. How many levels of nesting are there in this design?
There are four levels of nesting in this design: if-else if-else if-else.

7. Give a set of values that will test the normal operation of this program segment. Defend your choices.
To test the normal operation, you can provide inputs within the expected range of 0 to 100, such as 0, 25, 50, 75, and 99. These values cover all the conditions and will execute the respective branches, printing the corresponding outputs.

8. Give a set of test values that will cause each of the branches to be executed.
To ensure each branch is executed, you can provide inputs such as -1 (less than the minimum range), 49, 70, and 100 (maximum range). These values will trigger the respective conditions and execute the corresponding branches.

9. Give a set of test values that test the abnormal operation of this program segment.
To test abnormal operation, you can provide inputs that are not integers or fall outside the expected range, such as "Wingding", -50, 101, or any non-numeric value. These inputs will test the program's ability to handle invalid inputs and ensure it doesn't produce unexpected results or errors.

Remember, when testing a program, it's essential to cover all possible scenarios to ensure it behaves correctly and handles exceptions gracefully.