Which loop executes at least once?
- for loop
- while loop
- do-while loop
- switch
Show answer and explanation
Answer: C. do-while loop
A do-while loop checks its condition after the body runs, so the body always executes at least once.
Practise 22 real Federal Board questions on Data and Repetition from 2023 to 2025. See the answer and explanation as soon as you answer.
Data and Repetition is one of the 9 main chapters in our Federal Board Matric Computer Science question bank (10th class), and about 7% of its real questions come from it. Tayyari Karo has 22 real questions on this chapter from 2023 to 2025; 5 are multiple choice and marked instantly, and the rest are short and long questions with a model answer. By difficulty: 13 medium, 9 easy.
Work through the questions below, then open the explanation for each one. Redo the ones you missed a few days later.
These are real past-paper questions. Think of your answer first, then open the explanation.
Which loop executes at least once?
Answer: C. do-while loop
A do-while loop checks its condition after the body runs, so the body always executes at least once.
Which loop is most efficient for iterating a known number of times?
Answer: D. for loop
The for loop's structure (init; condition; update) is built exactly for a known/fixed number of iterations.
Which loop executes at least once?
Answer: C. do-while loop
A do-while loop tests its condition after executing the body, so the body always runs at least once.
Which loop is most efficient for iterating a known number of times?
Answer: D. for loop
The for loop keeps initialisation, condition and update together, making it the natural choice when the number of iterations is already known.
The loop within another loop is called:
Answer: B. Nested
A loop placed inside the body of another loop is called a nested loop, regardless of the loop type used.
What is a loop structure? Give an example.
A loop structure is a control structure that repeats a set of statements multiple times as long as a given condition holds (or for a set number of times), instead of writing the same statements repeatedly.
Example: for(i=1;i<=5;i++) printf("%d",i); prints 1 2 3 4 5.
Write down the purpose and syntax of do-while loop.
Purpose: executes the loop body first, then checks the condition — so the body always runs at least once.
Syntax:do {
statement(s);
} while (condition);
Rewrite the following for loop by using while loop:
int k;
for (k=25;k>0;k=k-3)
printf("\n%d",k);
int k = 25;
while (k > 0) {
printf("\n%d", k);
k = k - 3;
}
| Session | Questions |
|---|---|
| 2025 2nd Annual | 11 |
| 2024 Annual | 7 |
| 2023 Annual | 4 |
22 real Federal Board (FBISE) Computer Science questions on Data and Repetition from 2023 to 2025, for 10th class. Each one shows the session it came from.
No. We could not find an official FBISE marking scheme for these papers, so the answers and explanations are written by Tayyari Karo for practice. Check anything important with your teacher or textbook.
You can start free with no signup. A small set of papers per subject is free, and Premium unlocks the full question bank.