Which one of the following statements is FALSE?
2018
Which one of the following statements is FALSE?
Answer: B. Type checking is done before parsing. — Answer: The false statement is "Type checking is done before parsing." Why this is false: Type checking is part of semantic analysis and requires a parsed…
- A.
Context-free grammar can be used to specify both lexical and syntax rules.
- B.
Type checking is done before parsing.
- C.
High-level language programs can be translated to different Intermediate Representations.
- D.
Arguments to a function can be passed using the program stack.
Attempted by 119 students.
Show answer & explanation
Correct answer: B
Answer: The false statement is "Type checking is done before parsing."
Why this is false: Type checking is part of semantic analysis and requires a parsed representation (abstract syntax tree) and symbol information, so it occurs after parsing, not before.
Notes on the other statements:
Context-free grammar can be used to specify both lexical and syntax rules.: While context-free grammars can express regular languages in principle, lexical rules are usually specified by regular expressions because they are simpler and faster to implement; CFGs are primarily used for syntax.
High-level language programs can be translated to different Intermediate Representations.: True. Compilers commonly use different IRs (for example, three-address code, SSA form, or bytecode) for optimization and portability.
Arguments to a function can be passed using the program stack.: True. Many calling conventions pass arguments on the stack (though others use registers); stack passing supports recursion and variable-length argument lists.
A video solution is available for this question — log in and enroll to watch it.