Loops Interview Questions

    Question 1For Loop Iterations

    How many times does the loop run in for (int i = 0; i < 10; i++)?

    Question 2While Loop Condition

    Which statement about the while loop is true?

    Question 3Do-While Loop

    What is the key difference between a while and a do-while loop?

    Question 4Break Statement

    What does the break statement do inside a loop?

    Question 5Continue Statement

    What does the continue statement do inside a loop?

    Question 6For Loop Output

    What will be printed?

    #include <stdio.h> int main() { for (int i = 1; i <= 3; i++) { printf("%d ", i); } return 0; }

    Question 7While Loop Execution

    What will be the output?

    #include <stdio.h> int main() { int i = 0; while (i < 3) { printf("Hi "); i++; } return 0; }

    Question 8Nested Loop

    If an outer loop runs 5 times and an inner loop runs 4 times, how many total iterations occur?

    Question 9Infinite Loop

    Which of these will create an infinite loop?

    Question 10Loop Control

    Which loop is best suited when the number of iterations is known in advance?