C Programming Quiz : Loops in C [for, while and do-while]

The C Programming Quiz on Loops. The loops are for, while and do-while. Learn about loops.

C Programming Quiz : Loops in C [for, while and do-while]

C Programming Quiz : Loops in C [for, while and do-while]

1. Loops in C Language are implemented using?
  • A) while block
  • B) for block
  • C) do-while block
  • D) All of the above

Answer is D)
Description:
for, while and do-while are C Programming Loops that can be implemented.

2. Which loop is faster in C Language, for, while or Do While?
  • A) do-while loop
  • B) for loop
  • C) while loop
  • D) All work at same speed

Answer is D)
Description:
For, while and do-while loops is faster in C Language. They all work at same speed.

3. What is the output of the C statement?
  • A) RABBIT
  • B) Compiler error.
  • C) RABBIT is printed unlimited number of times.
  • D) No output

Answer is B)
Description:
while(TRUE) or while(true) does not work. true is not a keyword.

4. What is the output of C Program?
  • A) CodingTaggers
  • B) CodingTaggers is printed unlimited number of times
  • C) Compiler error
  • D) None of the above.

Answer is A)
Description:
If there is no BREAK statement, while loop runs continuously until the computer hangs. BREAK causes the loop to break once and the statement below the while if any will be executed.

5. Choose a right C Statement.
  • A) Loops usually take advantage of Loop Counter.
  • B) Loop is usually executed as long as a condition is met.
  • C) Loops or Repetition block executes a group of statements repeatedly.
  • D) All the above.

Answer is D)
Description:
Read all the above options.

6. Choose correct C while loop syntax.
  • A)
  • B)
  • C)
  • D)

Answer is A)
Description:
The correct C while loop syntax is

7. What is the output of the C Program?
  • A) Coding
  • B) Coding Taggers
  • C) Error
  • D) CodingTaggers

Answer is B)
Description:
while(a=123) = while(123) = while(Non Zero Number). So while is executed. BREAK breaks the loop immediately. Without break statement, while loop runs infinite number of times.

8. Choose a correct C Statement.
  • A) ++a is (a=a+1) PRE INCRMENT Operator
  • B) a++ is (a=a+1) POST INCREMENT Operator
  • C) a-- is (a=a-1) POST DECREMENT Opeartor --a is (a=a-1) PRE DECREMENT Opeator
  • D) All of the these.

Answer is D)
Description:
Read all of these above options.

9. What is the way to suddenly come out of or Quit any Loop in C Language?
  • A) continue; statement
  • B) quit; statement
  • C) break; statement
  • D) leave; statement

Answer is C)
Description:
break; statement is the way to suddenly come out of or Quit any Loop in C Language.
Example:

10. continue; statement causes the _______ statements to skip for execution
  • A) Above Statement
  • B) Whole Program
  • C) Below Statement
  • D) Whole Loop

Answer is C)
Description:
continue; statement causes the below statements to skip for execution.


Submit your Quiz Question
Submit your quiz question to us, We will feature your quiz question in our blog with your credits.