Valid While and Do/While Statements Quiz in ANSI C and Betty-compliant Syntax

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following while or do/while statements are valid in ANSI C and Betty-compliant?

  • a = 0; do { printf("%d\n", a); a++; } while (a < b); (correct)
  • a = 0; while (a < b) ( printf("%d\n", a); a++; )
  • a = 0; while (a = 0; a < b; a++) { printf("%d\n", a); }
  • a = 0; while (a < b) printf("%d\n", a++);

Which of the following while or do/while statements are invalid in ANSI C and Betty-compliant?

  • a = 0; while (a = 0; a < b; a++) { printf("%d\n", a); } (correct)
  • a = 0; do { printf("%d\n", a); a++; } while (a < b);
  • a = 0; while (a < b) ( printf("%d\n", a); a++; )
  • a = 0; while (a < b) printf("%d\n", a++);

Which of the following while or do/while statements will print the values of 'a' while 'a' is less than 'b' in ANSI C and Betty-compliant?

  • a = 0; while (a < b) ( printf("%d\n", a); a++; ) (correct)
  • a = 0; while (a = 0; a < b; a++) { printf("%d\n", a); }
  • a = 0; while (a < b) printf("%d\n", a++);
  • a = 0; do { printf("%d\n", a); a++; } while (a < b);

Flashcards are hidden until you start studying

More Like This

ANSI C Standard Library Functions Quiz
10 questions

ANSI C Standard Library Functions Quiz

AccessibleBlueTourmaline8567 avatar
AccessibleBlueTourmaline8567
History of C Programming Language
40 questions
ANSI Device Numbers Flashcards
33 questions
Use Quizgecko on...
Browser
Browser