The correct sequence to write a loop statement is formed
I. body
II. main( )
III. test condition
IV. initialization
UGC NET - 2012,
Answer: D
The correct sequence for writing a loop is main( ), initialization, test condition, body, which is II, IV, III, I, option (D). A C program starts in the function main( ), the loop variable is given its initial value, the test condition is then checked before each pass, and the body of the loop runs if the test is true. Option (A) starts with the body. Option (B) leaves out main( ) at the start. Option (C) places the test before the initialization and puts the body last without a start.
Please log in or register to report this question.