Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Quiz 2 5. Which of the following types of productions will cause problems for a

ID: 3663188 • Letter: Q

Question

Quiz 2

5. Which of the following types of productions will cause problems for a recursive de- scent parser? CMSC 330 Quiz 2 Spring 2016 1. Which of the following is not a kind of model for dynamic semantics? a) Operational semantics b) Denotational semantics c) Axiomatic semantics d) Static semantics a) b) c) d) Any recursive production Right recursive productions Any nonrecursive production Left recursive productions Which of the following dynamic semantic models defines the meaning of a program by stating pre and postconditions? 6. 2. When it is possible to produce two different parse trees for the same sentence using a particular grammar, what kind of grammar is that? a) b) c) d) A left linear grammar A BNFgrammar An ambiguous grammar A context free grammar a) Axiomatic semantics b) Static semantics c) Denotational semantics d) Operational semantics When a program violates a type checking rule of a language, its compiler will most likely generate which of the following kinds of error? 3. 7. What language rules does an attribute grammar incorporate beyond what an ordinary context-free grammar provides? a) b) c) d) Static semantic error Lexical error Syntax error Linker error a) b) c) d) Lexical rules Syntax rules Dynamic semantic rules Static semantic rules Which of the following is required to verify that a sentence is in a language defined by a grammar? 4. 8. A recursive descent parser is which of the following kinds of parser? a) Creating a parse tree only b) Creating a parse tree or a derivation c) Creating a derivation only d) Creating a new grammar a) Bottom up parser b) Shift-reduce parser c) Top down parser d) LR parser

Explanation / Answer

1. D

2. C

3. A

4. B

5. D

6. A

7. D

8. C

9. A

10. C

11. A

12. D

13. A

14. C

15. C

16. C

17. B

18. B

19. C

20. D