Essentials
primer-original-v2mediumEssentialsSoftware Fundamentalsprimer-original-v2

Essentials Practice Question

What will be the output for WHILE loop?

 

BEGIN

DECLARE number

SET number <-- 30

WHILE number>0

            number <-- number-4

END WHILE

PRINT number

END

Answer options

A
-2
B
FOR loop
C
WHILE loop
D
DO-WHILE loop

Correct answer: -2

Detailed Solution & Conceptual Analysis

This question has been retained as-is due to its unique context.

Key Engineering Takeaway

In Essentials, understanding the underlying mechanics of Essentials is critical for writing performant, bug-free production code and passing rigorous technical architecture reviews.

Related Essentials questions

Practice more Essentials questions

PrimerPrep has independently reviewed practice questions and coding exercises — all free.