This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS5363 Midterm Exam Oct 12, 2011 1. (15pts) Answer the following questions, using a single sentence for each question. (a) What are the key features of a functional programming language? Create new variables instead of modifying existing ones; functions are treated as first class objects. (b) What is different between an NFA and a DFA? NFA can have multiple transitions defined for each state on the same token; DFA must have a unique transition defined. (c) What makes a context-free grammar (i.e., BNF) ambiguous? When multiple parse trees can be constructed for a single input. (d) What is a LL(K) parser? Left-to-right, leftmost derivation, K symbol lookahead parser. (e) What is an inherited attribute? Attribute of a parse tree node computed from those of its parent or siblings. (f) What are the tradeoffs of applying type checking at compile-time vs. runtime? Compile-time type check restricting flexibility of defining polymorphic functions but enables early error reporting; runtime checking slows down runtime execution but can discover all type errors. (g) What is polymorphism? Functions that can operate on different types of input values. (h) What are the different types of polymorphism? Subtype, parametric, and ad-hoc polymorphism....
View Full Document
- Spring '08
- Functional Programming