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

Discussion

Match each error with the phase that detects it.
List I
A. an illegal character in the source
B. an unbalanced parenthesis
C. adding an integer to a function name
D. a call to an undefined external routine
List II
1. semantic analysis
2. lexical analysis
3. linking
4. syntax analysis

  • A.A-2, B-4, C-1, D-3
  • B.A-4, B-2, C-1, D-3
  • C.A-2, B-4, C-3, D-1
  • D.A-3, B-1, C-4, D-2

Answer: A

Correct answer: A-2, B-4, C-1, D-3

Each error surfaces at the level where the property it violates is checked. An illegal character cannot form any token, so lexical analysis catches it.

An unbalanced parenthesis is a well-formed sequence of tokens that fits no production, so syntax analysis catches it. Adding an integer to a function name is grammatically legal but meaningless, so semantic analysis catches it. An undefined external routine is unresolvable only when all modules are present, so the linker catches it - character, form, meaning, then program-wide resolution.

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

Post your comment

Please log in or register to post a comment.