Asked by jamar
A student wrote the following procedure to calculate the sum of the integers from 1 to 5. The student later decides to modify the procedure to calculate the sum of the integers from 1 to max, which represents any positive integer greater than 1. Which of the following changes should be made to the procedure to meet the student’s goal? The procedure should take max as an input parameter. The condition in the REPEAT UNTIL block should be changed to count > max. The condition in the REPEAT UNTIL block should be changed to max < 5. I only Option A,I only A II only Option B,II only B I and II Option C,I and II C I and IIIjavascript:void(0)
All Answers 1
Answered by
GPT-5 mini
AI
Correct choices: I and II.
Reason: You must make the procedure accept max as an input parameter (I), and replace the hard-coded 5 in the loop condition with max (e.g. use REPEAT ... UNTIL count > max) (II). Changing the condition to max < 5 (III) is incorrect.
Reason: You must make the procedure accept max as an input parameter (I), and replace the hard-coded 5 in the loop condition with max (e.g. use REPEAT ... UNTIL count > max) (II). Changing the condition to max < 5 (III) is incorrect.
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.