# Algorithm: Failure and Program Segment

Appendix J

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? Failed grade

o What will be printed if the input is 100? Passing grade

o What will be printed if the input is 51? Average grade

o What will be printed if the user enters “Wingding”? How did you do? o Is this design robust? If so, explain why. If not, explain what you can do to make it robust. This design is not robust due to lack of check data job. It should appear at the beginning before the analysis to determine if this was a number within the scope required. You must check to ensure number is correct, otherwise it is an error, then you must re-enter and start again. o How many levels of nesting are there in this design? There are a total of 4 nest levels and a default level. o Give a set of values that will test the normal operation of this program segment. Defend your choices. -1,0,49,50,51,69,70,71,84,85,86,99,100,101 All values one below the other, and one above the various numbers strictly for researching if the actual numbers work properly. o Give a set of test values that will cause each of the branches to be executed. Some test values would be 25,65, 75, 95 and 101 in which 101 would be default. o Give a set of test values that test the abnormal operation of this program segment. Test values that would have an abnormal operation on this program segment has to be -1, and 101 because it goes above and below the actual algorithm.

Vanessa Dunigan

IT210

Week 6 Checkpoint

University of...

Please join StudyMode to read the full document