Which of the following represent legal flow control statements? (A) break; (B) break(); (C) continue outer; (D) continue(inner); (E) return; (F) exit();

  1. (A), (B) & (C)

  2. (A), (C) & (E)

  3. (A), (C) & (D)

  4. (A) & (E)

  5. (C) & (E)


Correct Option: B
Explanation:

To answer this question, the user needs to have a basic understanding of flow control statements in programming. Flow control statements are used to control the order in which statements are executed in a program. They can be used to make decisions, loop over sets of instructions, and interrupt the normal flow of execution.

Now, let's go through each option and explain why it is right or wrong:

A. (A), (B) & (C): Option A is incorrect because (B) break(); is not a valid flow control statement. (A) break; is a legal statement that is used to terminate a loop or switch statement. (C) continue outer; is also a legal statement that is used to skip to the next iteration of an outer loop. Therefore, option A is incorrect.

B. (A), (C) & (E): Option B is correct. (A) break; is a legal statement that is used to terminate a loop or switch statement. (C) continue outer; is also a legal statement that is used to skip to the next iteration of an outer loop. (E) return; is a legal statement that is used to exit a function and return a value. Therefore, option B is the correct answer.

C. (A), (C) & (D): Option C is incorrect because (D) continue(inner); is not a valid flow control statement. (A) break; is a legal statement that is used to terminate a loop or switch statement. (C) continue outer; is also a legal statement that is used to skip to the next iteration of an outer loop. Therefore, option C is incorrect.

D. (A) & (E): Option D is incorrect because (E) exit(); is not a valid flow control statement. (A) break; is a legal statement that is used to terminate a loop or switch statement. (E) return; is also a legal statement that is used to exit a function and return a value. Therefore, option D is incorrect.

E. (C) & (E): Option E is incorrect because it is missing a legal statement. (C) continue outer; is a legal statement that is used to skip to the next iteration of an outer loop. (E) return; is also a legal statement that is used to exit a function and return a value. Therefore, option E is incorrect.

The Answer is: B. (A), (C) & (E)

Find more quizzes: