Consider the following statements: S1: The value of a synthesized attribute at…
Consider the following statements:
S1: The value of a synthesized attribute at a node is computed from the value of the attribute at the children of that node.
S2: The value of inherited attribute at a node is computed from the value of the attribute at the children of that node. Which of the following is true?
Answer: A. S1 is true — S1: This is correct. Synthesized attributes are computed based on the values of the attributes of the children nodes in a parse tree. S2: This is incorrect.…
- A.
S1 is true
- B.
S2 is true
- C.
S1 is false
- D.
S1 and S2 are false
Attempted by 133 students.
Show answer & explanation
Correct answer: A
S1: This is correct. Synthesized attributes are computed based on the values of the attributes of the children nodes in a parse tree.
S2: This is incorrect. Inherited attributes are computed based on the values of the attributes of the parent or sibling nodes, not the children.