Preparing C loops for UP Police, RSSB, MPPSC, UPLT, UPPSC, UGC NET, ISRO or placement tests? Many lost marks need no new theory. Check the condition before trusting the body, trace on paper, and read the whole fragment. Loop questions in these papers take just four shapes, and those three habits crack all four.
The four shapes loop questions take
Loop MCQs test definitions and keywords, termination, output traces, or hidden mathematics such as GCD and doubling. Teaching, police and clerical papers favour the first two; ISRO, UGC NET and lecturer papers lean towards the last two. Loops support later data-structure traces, so continue with the Data Structures MCQs practice hub.
Which loop, which keyword: 3 solved questions
Q1. UP Police Computer Operator 2023, Paper 2
Which control structure is depicted by a loop that executes a set of instructions as long as a specific condition remains true?
(A) Iteration
(B) Selection
(C) Recursion
(D) Sequence
Answer: (A) Iteration. Condition-governed repetition is iteration; selection chooses once, and sequence runs top to bottom. Recursion repeats through a function calling itself, not a loop body. Practise on the solved page.
Q2. Beltron Programmer 2025, Shift 3
Which of the following is true about the while loop in C?
(A) Is used only when the number of iterations is known
(B) Does not allow break statement
(C) May never execute if the condition is false
(D) Executes at least once even if the condition is false
Answer: (C) May never execute if the condition is false. while is entry-controlled, so a false first test means zero executions. Option D describes the exit-controlled do-while. Practise on the solved page.
Q3. RSSB Informatic Assistant 2023
In a loop of C program, ________ statement immediately exits a loop, skipping the rest of the body of the loop.
(A) if
(B) else
(C) continue
(D) break
Answer: (D) break. break leaves the loop; continue abandons only the current pass and returns to the condition check. Q7 tests that second behaviour. Practise on the solved page.
Loops that never stop, never run, or never compile: 3 solved questions
Before predicting output, ask: does it compile, start and end? Each question hides one check.
Q4. UGC NET June 2014
While (87) printf("computer"); The above C statement will
(A) print "computer" 87 times
(B) print "computer" 0 times
(C) print "computer" 1 times
(D) print "computer" infinite times
Answer: (D) print "computer" infinite times. The intended loop treats non-zero 87 as true, and no update or break changes that. Option A mistakes a truth value for a counter. The source prints While with a capital W; the tested idea is the constant condition. Practise on the solved page.
Q5. MPPSC 2025
What will be the output of the following program? Void main () { int i ; for (i = 0 ; i < 3 ; i ++); printf ("%d ", i); }
(A) 3
(B) 0 1 2
(C) 0 1 2 3
(D) Errors
Answer: (A) 3. The semicolon makes the body empty: i moves 0 -> 1 -> 2 -> 3, then i < 3 fails and the following printf runs once. Option B wrongly places printf inside the loop. The paper prints Void with a capital V; what is being tested is the empty body, not the typo. Practise on the solved page.
Q6. UPLT 2026
What will be the output of the following 'C' code? for (i = 1; i < 5; i++) if (i != 3) printf ("%d", i);
(A) 1245
(B) 0000
(C) Error
(D) 12345
Answer: (C) Error. Undeclared i prevents compilation. With int i;, the trace would be 124 because 5 fails the guard and 3 is skipped; its absence from the options tells you to audit before tracing. Practise on the solved page.
Trace-the-output programs: 3 solved questions
Use a value table for every pass. Head-tracing is unreliable here.
Q7. UPLT 2018
What is the output of the following C program?
#include <stdio.h>
int main () { int index; for (index = 1; index <= 5; index ++) { printf ("%d", index); if (index == 3) continue; } }(A) 1245
(B) 12345
(C) 12245
(D) 12354
Answer: (B) 12345. printf runs before the if, so 3 is already printed; continue then skips nothing because it is last. Option A would require continue before printf. Practise on the solved page.
Q8. UP Police Computer Operator 2018, Paper 2
Start / Read n / Initialize i to 1. / while i < n do: / Write i / Increment i / end while / Stop. Which of the following options is CORRECT?
(A) Read number n and print the integers counting up to (n-1)
(B) ... up to i
(C) ... up to (n+1)
(D) ... up to n
Answer: (A) Read number n and print the integers counting up to (n-1). With i < n, the last value that passes is n-1; the pass printing n never starts. This strict versus non-strict guard is the standard off-by-one trap. Practise on the solved page.
Q9. UPPSC Polytechnic Lecturer 2018
Consider the following program segment in C programming language: i = 6720; j = 4; while ((i % j) == 0) { i = i / j; j = j + 1; } On termination, j will have the value:
(A) 4
(B) 8
(C) 9
(D) 6720
Answer: (C) 9. 6720 % 4 = 0, so i = 1680, j = 5; 1680 % 5 = 0, so i = 336, j = 6; 336 % 6 = 0, so i = 56, j = 7; 56 % 7 = 0, so i = 8, j = 8; 8 % 8 = 0, so i = 1, j = 9. Then 1 % 9 = 1, not 0, so the loop stops after five divisions with j = 9. Practise on the solved page.

Loops doing mathematics: 3 solved questions
Hard loop MCQs hide GCD or logarithms inside bare code. Name the mathematics before choosing.
Q10. ISRO 2018
Assume A and B are non-zero positive integers. The following code segment: while ( A != B){ if ( A > B ) A -= B ; else B -= A ; } cout << A; // printing the value of A
(A) Computes the LCM of two numbers
(B) Divides the larger number by the smaller number
(C) Computes the GCD of two numbers
(D) Finds the smaller of two numbers
Answer: (C) Computes the GCD of two numbers. This language-neutral loop is subtraction-form Euclid: with A = 12, B = 8, (12, 8) -> (4, 8) -> (4, 4), then it prints 4 = gcd(12, 8). Option D fails because subtraction continues beyond the first smaller value. Practise on the solved page.
Q11. ISRO 2014
How many lines of output does the following C code produce?
#include<stdio.h>
float i=2.0; float j=1.0; float sum = 0.0;
main() { while (i/j > 0.001) { j+=j; sum=sum+(i/j); printf("%f\n", sum); } }(A) 8
(B) 9
(C) 10
(D) 11
Answer: (D) 11. Since i = 2.0, the loop runs while j < 2000; test values are 1, 2, 4, ..., 1024, or 2^0 through 2^10, giving 11 printed lines. Next comes j = 2048, where 2/2048 < 0.001; option C forgot the first test at j = 1. Practise on the solved page.
Q12. UPLT 2018
Consider the following segment of C code: int j, n; j = 1; while (j <= n) j = j * 2; The number of iterations made in the execution of the loop for any n > 0 is (assuming no integer overflow):
(A) [log2 n] + 1
(B) n
(C) [log2 n]
(D) [2 log2 n] + 1
(Square brackets mean floor.)
Answer: (A) [log2 n] + 1. After k doublings, j = 2^k, so the test j <= n succeeds for k = 0 up to floor(log2 n), which is floor(log2 n) + 1 passes through the body. With n = 8 those passes take j through 1, 2, 4 and 8, four iterations, and floor(log2 8) + 1 = 4. The one failing test that ends the loop is not an iteration, so it is not counted here. Option B assumes linear growth, but doubling is logarithmic, as explained in Sorting Algorithms: Complexity, Stability, n log n Bound. Practise on the solved page.

The pattern behind all 12
Bucket | What it tests | Five-second check |
|---|---|---|
Keywords | Entry or exit control, | Locate the test and control transfer |
Termination | Failure to compile, start or end | Check those three in order |
Traces | Values and statement order | Draw each pass and the failing test |
Mathematics | The update's invariant | Ask what remains true |
Wrong options swap twin concepts, trust unaudited code or exploit mental tracing. Q2, Q3 and Q7 swap paired ideas; Q5 and Q6 need an audit; Q9 and Q11 punish skipped rows. Mark the guard, audit the fragment, then make the table. Arrays and functions reuse these shapes.
The short version and where to practise next
These 12 PYQs span UP Police, Beltron, RSSB, UGC NET, MPPSC, UPLT, UPPSC and ISRO. KnowledgeGate carries about 120 Loops & Iteration questions in all, each with its own solved page.
Use the C Programming Course for the taught sequence. The C Language Course, Concepts, MCQs & Coding adds the output drill Q5 to Q9 demand. Find more solved sets in the MCQ Practice hub. Always trace on paper.




