Machine-translated by Google. Questions are authored in English.
Top

Discussion

The two statements that can change the flow of control are :

  • A.if and switch
  • B.if and while
  • C.switch and do-while
  • D.break and continue

Answer: A

The keyed answer is break and continue.

break and continue are jump statements: their only effect is to transfer control. break leaves the innermost loop or switch immediately, and continue skips the rest of the current loop iteration and goes to the next one. They change the flow of control inside a structure that is already running.

if, switch, while and do-while are selection and iteration constructs: they define the structure of the flow, choosing which block runs or repeating it, rather than being statements that break the normal sequence. The key takes the question in this sense, so the pairs in A, B and C are not accepted.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.