Ask Question
19 January, 15:16

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. 19 January, 15:26
    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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers