Code

The following pseudocode snippet describes a segment of a computer program. What value of Y is displayed?
SET Y = 30
SET X = 3
While X ≥ 2
	Y = Y*X
	X = X - 1
End While
Print Y

Expand Hint
The code is running a loop. $$X$$ increases incrementally every time the code cycles through.
Hint 2
Factor in the exit criteria for the loop to end. Track the $$X$$ and $$Y$$ values for each cycle.
The code is running a loop. $$X$$ increases incrementally every time the code cycles through. Although the exit criteria is based on $$X$$ , we’ll need to track both $$X$$ and $$Y$$ for every cycle. Running through the script logically:
Loop is exited once $$X = 1$$ . When $$X = 1$$ , $$Y = 180$$ . Thus, the value of $$Y$$ that is printed is 180.
180
Time Analysis See how quickly you looked at the hint, solution, and answer. This is important for making sure you will finish the FE Exam in time.
  • Hint: Not clicked
  • Solution: Not clicked
  • Answer: Not clicked

Similar Problems from FE Sub Section: Software Syntax Guidelines
104. VAR Code
370. Pseudocode
379. Complex Code

Similar Problems from FE Section: Software Engineering
104. VAR Code
370. Pseudocode
379. Complex Code