--:--









Quiz for Loops for, while, do-while

Course: C++ Language | Subject: Unit 2 | Topic: Control Structures



Logo

Q1: Which loop will always execute at least once?

Logo

Q2: What is the correct syntax for a for loop?

Logo

Q3: Which loop checks the condition before executing the loop body?

Logo

Q4: What will be output of this code? int i=0; while(i<3) { cout << i; i++; }

Logo

Q5: What keyword exits a loop immediately?

Logo

Q6: What does the continue statement do in loops?

Logo

Q7: Which loop is best when number of iterations is known?

Logo

Q8: Can a for loop be used without all three expressions (init, condition, increment)?

Logo

Q9: What happens if the condition in a while loop is false initially?

Logo

Q10: Which loop structure is guaranteed to execute at least once?

Logo

Q11: How can infinite loops be created?

Logo

Q12: Which keyword can be used to skip the current iteration?

Logo

Q13: Is it possible to nest loops in C++?

Logo

Q14: What is the output of: for(int i=0; i<3; i++) cout << i;

Logo

Q15: Which loop is used when condition must be checked after executing the loop body?

Logo

Q16: Can you omit the increment expression in a for loop?

Logo

Q17: What is the result of: int i=0; do { cout << i; } while(i>0);

Logo

Q18: Which of the following can be used to create an infinite loop?

Logo

Q19: Which loop control can skip execution of loop body for some iterations?

Logo

Q20: What is the purpose of a loop?

Are you ready to start test? Set your time limit