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

Discussion

Translating a while statement into three address code requires

  • A.a label at the loop head and a conditional jump out of the body
  • B.no jumps at all
  • C.the loop bound to be a compile time constant expression
  • D.the condition to be evaluated only after the body has executed

Answer: A

Correct answer: a label at the loop head and a conditional jump out of the body

The pattern is a label, the test, a conditional jump past the body when the test fails, the body, and an unconditional jump back to the label. Testing before the body is what distinguishes a while from a repeat, and the loop bound need not be known at compile time.

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

Post your comment

Please log in or register to post a comment.