Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1: Assume that age has the value 0. List the actions the computer executes when

ID: 3730330 • Letter: 1

Question

1: Assume that age has the value 0. List the actions the computer executes when it 2. Assume that age has the value 8 List the actions thecomputer executes when it runs the following code Writeln('Message o) while age 5 do begin begin ageage t l: ageage - 2,: end; end; WriteLn('Message 2') Sequence Action riteln('Message 2) Note Sequence Action Note 1 Calls the WriteLo procedure with the text Message o 1Calls the Writelo procedure with the text Message O 2 Evaluates the expression (condition of while) age>5 Condition is true Jumps into the while loop 2 Evaluates the expression (condition of while) age

Explanation / Answer

solution 1: assume the age has the value 0. list of action the computer executes when it runs the given code

solution 2: Assume that age has value 8.list of action the computer executes when the given code is executed

sequence Action    Note 1. calls the Writeln Procedure with the text 'Message 0' 2. Evaluates the expression (condition of while)age<5 condotion is true 3. jump into the while loop 4. calls the Writeln Procedure with the text 'Message 1' 5. Increments the value of age by adding 1 to it Age now is 1 6. returns to the top of the while loop 7. Evaluates the expression (condition of while)age<5 condotion is true 8. jump into the while loop 9. calls the Writeln Procedure with the text 'Message 1' 10. Increments the value of age by adding 1 to it Age now is 2 11. returns to the top of the while loop 12. Evaluates the expression (condition of while)age<5 condotion is true 13. jump into the while loop 14. calls the Writeln Procedure with the text 'Message 1' 15. Increments the value of age by adding 1 to it Age now is 3 16. returns to the top of the while loop 18. Evaluates the expression (condition of while)age<5 condotion is true 19. jump into the while loop 20 calls the Writeln Procedure with the text 'Message 1' 21 Increments the value of age by adding 1 to it Age now is 4 22. returns to the top of the while loop 23. Evaluates the expression (condition of while)age<5 condotion is true 24. jump into the while loop 25. calls the Writeln Procedure with the text 'Message 1' 26. Increments the value of age by adding 1 to it Age is now 5 27. returns to the top of the while loop 28. Evaluates the expression (condition of while)age<5 condition is false 29. jumps to the end of the while loop 30. calls the Writeln Procedure with the text 'Message 2'
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote