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

Discussion

In the statement count = count + 1, the number of lexemes is

  • A.two, being the left hand side and the right hand side expression
  • B.one, since the whole statement forms a single unit of meaning
  • C.five, counting each identifier, operator and literal separately
  • D.three, since the identifier count appears twice in the statement

Answer: C

Correct answer: five, counting each identifier, operator and literal separately

The lexemes are count, =, count, + and 1 - five in all. The identifier count appears twice and is counted twice, because a lexeme is an occurrence in the input rather than a distinct name; the two occurrences produce two tokens that happen to carry a pointer to the same symbol table entry.

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

Post your comment

Please log in or register to post a comment.