I have another debugging exercise I could use help with. 1. Find the error in th
ID: 3906292 • Letter: I
Question
I have another debugging exercise I could use help with.
1. Find the error in the following pseudocode.
Declare Boolean finished = False
Declare Integer value, cube
While NOT finished
Display "Enter a value to be cubed."
Input value;
Set cube = value^3
Display value, " cubed is ", cube
End While
2. The programmer intended the following pseudocode to display the numbers 1 through 60, and then display the message “Time’s up!" It will not function as intended, however. Find the error.
Declare Integer counter = 1
Const Integer TIME_LIMIT = 60
While counter < TIME_LIMIT
Display counter
Set counter = counter + 1
End While
Display "Time's up!"
Explanation / Answer
1.It will print "Enter a value to be cubed" infinite values
because you didnt make finished as true in loop and the loop runs upto false condition infinitly
2.It will print from 1 to 59.It wont print 60 since in the loop condition
your counter condtion exits when counter =60.It will print if you make
while condtion
while counter <= TIME_LIMIT
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.