Ask Question
27 September, 22:19

What will be displayed if code corresponding to the following pseudocode is executed?

Set Number = 4

Repeat

Write 2 * Number

Set Number = Number + 2

Until Number = 8

a. 8 b. 4 c. 8 d. 12

12 8 12 16

16 12

+5
Answers (1)
  1. 28 September, 00:49
    0
    8, 12, 16

    Explanation:

    The user defines an integer "Number" that is 4, then creates a loop, the loop consists of multiplying by 2 the integer that he defined at the beginning, after this operation, increases the integer "Number" by 2, replacing the value of "Number" in each iteration. This cycle is repeated until the value of "Number" is 8.

    Therefore, in the first iteration Number = 4

    4 * 2 = 8

    This is the first result, then the number increases 2 units

    Number = 4 + 2 = 6

    in the second iteration Number = 6

    6 * 2 = 12

    This is the second result, then the number increases 2 units

    Number = 6 + 2 = 8

    in the third iteration Number = 8

    8 * 2 = 16

    This is the third and final result, because the iteration stops when "Number" reaches the value of 8.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “What will be displayed if code corresponding to the following pseudocode is executed? Set Number = 4 Repeat Write 2 * Number Set Number = ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers