100.0k views
5 votes
Look at pseudocode segment below. y ← x + x + x + x + x // line a z ← y + y + y // line b If x = 6 before this segment is executed, what is the value of z after execution?

1 Answer

3 votes

Answer:

90.

Explanation:

We have two lines of code:

y ← x + x + x + x + x

z ← y + y + y

and, x=6 before the execution. Then, when the program starts to run we obtain:

y ← 6 + 6 + 6 + 6 + 6

y ← 30

z ← 30+30+30

z ← 90.

Then, the value of z after excecution is 90.

User Dfmetro
by
7.7k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.

9.4m questions

12.2m answers

Categories