CFORBEGINNERS.COM

C Quizzes

C Quiz on Loops

1. Which one is not a loop?
a) for
b) have
c) do
d) while
2. What loops needs a semi colon after?
a) for
b) do
c) while
3. Which for loop is correct?
a) for {i=0,i<10,i++}
b) for (i=0; i<10; i++);
c) for (i=0; i<10; i++)
4. What loops will always execute at least once?
a) for
b) do
c) while
5. which for loop will not work?
a) for (i=0; i<5; i++)
b) for (i=5; i<=10; i++)
c) for (i=5; i=10; i++)
6. Does every loop require curly braces?
a) yes
b) no
7. What loop required curly braces?
a) for
b) do
c) while
d) all
8. Which loop is correct?
a) do {//code}while (condition);
b) do {//code}while (condition)
c) do {//code}while (condition):