LearnFrenzy
Sign in Take a free test

C Loops · Exercise 1 of 4

C Loops Loops MCQ

  • 12 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Twelve multiple-choice questions on for, while and do-while, break and continue, loop scope, unsigned and floating-point counters, and nested-loop complexity. Pick an option to check your answer instantly.

Question 11 Medium

With int n = 3;, how many times does while (n--) { … } run, and what is n afterwards?

A 3 times, n = 0
B 3 times, n = -1
C 2 times, n = 0
D 4 times, n = -1
Question page & discussion
Question 12 Hard

Why are multi-statement macros often written as do { … } while (0)?

A To make the macro run twice
B So the macro behaves like a single statement and is safe after an if without braces
C To make it faster
D Because macros cannot contain braces otherwise
Question page & discussion
Up next · Exercise 2Predict the Output12 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links