Exam 2 Review, Fall 2005

Total Page:16

File Type:pdf, Size:1020Kb

Exam 2 Review, Fall 2005

Exam 2 Review, Fall 2005 Exam 1 covered: o General Introduction to Programming Languages o Evolution of Programming Languages o Implementation, Syntax, and Semantics o Naming, Scoping, and Binding.

Exam 2 topics:

I. Functional programming: a. The basis for paradigm (mathematical functions – return values) i. Function application vs variable assignment b. 2 parts to functional programming: function defn and function application. i. No notion of variables for making assignments  no iteration c. Referential transparency (evaluation always produces the same value). d. Functional forms: (takes fx as params, yields a fx, or both) e. LISP/SCHEME: (quote, CAR, CDR, pred. functions (EQ? list?, etc.), lambda expressions, define, control flow (IF, COND) f. Substitution Model: Determine meaning of expressions g. Recursion: linear recursive vs linear iterative. h. Higher-order functions (operators as params, yields an oper, or both) i. Global and local variables (define vs let): let is lambda in disguise j. Compound data types (recall complex numbers examples, use of cons) II. Data Types: a. Collection of objects with a set of operations defined to manipulate objects. b. Types: primitive, strings, records, unions, arrays, assoc. arrays, sets, pointers c. Foundational view: collection of values from a domain; internal structure of data – down to fundamental types (structural view), equiv class of objects (implementor’s view), collex of well-defined operns to be applied (abstraction view) III. Expression Types: (expressions and assignment statements) a. Arithmetic expressions (opnd and operator evaluation order) b. Overloaded operators (+ for real and int values) c. Type conversions (narrowing (double to float), widening (int to float): coercion, explicit type conv) d. Relational and boolean expressions (also short-circuit, AND-THEN) e. Assignment statements (mixed-mode assignments) IV. Control Flow : a. Selection (if, case), iteration (top, bottom-tested), unconditional (gotos) b. Subprograms: (parameter passing, type checks for params, local vars static or dynamic, referencing env., etc.) V. Logic Programming: a. Basic idea behind logic programming (just logic not the control flow) b. Fxl vs logic: relationships expressed as functions vs clauses. c. Logic programs are declarative (use symbolic logic for specifying programs, uses logical inferencing for reasoning). d. Horn clauses (antecedent and consequent): know the logical equivalence. e. Inferencing process in prolog (start with goal, and try to satisfy subgoals. f. Role of backtracking (reaches a subgoal that cannot be prove) VI. UML modeling (class diagrams and metamodels) VII. Embedded systems (basic concepts)

Recommended publications