RRB Junior Engineer / DMS / CMA 2019 · Question 3706 of 3719
while Loops Both while loops and do-while loops are condition-controlled, meaning that they continue to loop until some condition is met. While loops check for the stopping condition first, and may not execute the body of the loop at all if the condition is initially false. Syntax: while( condition ) body; where the body can be either a single statement or a block of statements within { curly braces }. do-while Loops do-while loops are exactly like while loops, except that the test is performed at the end of the loop rather than the beginning. This guarantees that the loop will be performed at least once. Syntax: do { body; } while( condition ); In theory, the body can be either a single statement or a block of statements within { curly braces }, but in practice, the curly braces are almost always used with do- whiles. for Loops for-loops are counter-controlled, meaning that they are normally used whenever the number of iterations is known in advance. Syntax for (initializationStatement; testExpression; updateStatement) { body of loop; }
Source: RRB JE 2019 (CBT 2) (IT) Previous Year Paper (30 Aug 2019) — prepp.in solved-paper PDF (answer key with explanations) · reliable-secondary
Practice the full RRB Junior Engineer / DMS / CMA 2019 paper
Timed test with all 3719 questions, just like the real exam.
Start test