Sequence CS Thinking Example 1
Follow the full solution, then compare it with the other examples linked below.
Example 1
easyWhat is the output of this sequence of instructions? SET x = 5. SET y = 3. SET z = x + y. OUTPUT z.
Solution
- 1 Step 1: x is assigned 5.
- 2 Step 2: y is assigned 3.
- 3 Step 3: z = x + y = 5 + 3 = 8. Output: 8.
Answer
A sequence executes instructions one after another in order. The order matters โ changing it would change the result.
About Sequence
Executing a series of instructions one after another in a fixed, specific order. In sequential execution, each instruction must complete before the next one begins, and the order in which statements appear determines the order in which they run.
Learn more about Sequence โ