STUDY_GUIDE_T2_FA2014

advertisement

STUDY GUIDE

– TEST 2 – CS 424/524: Fall 2014

Material covered: Chapter 4 (Names – applications of the principles ) Chapter 5, 6.1 (Types & Type Systems); parts of Chapter 7 (Semantics), Chapter 9 (Functions), Chapter 15: (Logic Programming and Prolog ).

The structure of the test will be similar to the structure of Test 1: Objective questions, short answer questions, simple programming exercises and other types of problems similar to those found on the homework.

Chapter 4:Names

Be able to demonstrate understanding of the properties associated with names; for example, problems like those on the last homework assignment.

Be able to draw a symbol table stack for a certain phase of language translation

Be able to explain or demonstrate how the symbol table is used during name resolution.

Chapter 5: Types

Definitions: type, type error, strongly typed, etc. Be able to give an example of a type error.

Difference between static and dynamic typing

What are some of the problems associated with number representation in computers?

 What does “overloaded” mean with respect to a function or operator?

What are the issues connected to mixed type expressions and assignments? (type mismatches, type conversions: implicit (type coercion) or explicit (casts) )

Enumeration types

Issues related to pointers and dynamic memory allocation

Arrays: access functions for one- and two-dimension arrays; row major versus column major storage, dope vectors. Why can’t all array addresses be determined at compile-time? What are the pros and cons of array bounds checking?

Understand buffer overflow and its relation to arrays.

Define/identify list, slice, structure, union. Know something about their characteristics.

Definition of polymorphism. What is parametric polymorphism, as exhibited in generic functions or templates?

Chapter 6: Type Systems

Why are type rules not included as part of the language’s grammar; how are they represented?

Know the purpose of the Clite type map

Review the Clite type rules and be able to give several examples of issues they address; for example: type

Rule 6.6 specifies how the result type of an expression is determined.

Chapter 7: Semantics

Definition of semantics, why is a well-defined semantic system important?

Program state; semantics as a description of how instructions modify program state

Expression semantics – various notations (Polish, Cambridge) and their advantages

Examples of specific semantic issues o Definition of short-circuit evaluation o Side effects: definition, examples, pros and cons. Also see Side Effect slides in Chapter 9. o Understand the problems related to sub-expression evaluation order o Assignment expression versus assignment statement o Copy versus reference semantics

 “Meaning rules” as a way of describing semantics by showing how a program maps one state to the next

Chapter 9: Functions

Definitions; “caller” versus “called”, value-returning versus void, aliasing, etc.

Parameter versus argument,

Parameter passing mechanisms: by value, by reference, by value-result, by result

Be able to explain/show the difference between two types of parameter passing (e.g. 9.1, page 241)

Three types of storage; in particular, purose of the run-time stack

Definition/purpose of activation records; support for recursive functions; contents

– be sure you understand

 all the information that must be saved, not just the parts we’ve included in our examples.

Run-time stack, understand, be able to reproduce examples such as those on pages 238 & 239

Chapter 15: Logic Programming

Be able to informally describe the difference between the imperative and logic(declarative) programming paradigms. Give examples of statements that represent this difference

What is the difference between propositional logic and predicate logic (predicate calculus); basically, you need to know the difference between a proposition and a predicate

Definitions: Horn clause, resolution (applied to Horn clauses), instantiation, unification. Understand the concepts so if you read a question that has one of these terms you’ll know what it means.

Be able to read/interpret simple Prolog rules. Given a database of facts and a rule base (such as the family tree or talks-with example) be able to give a solution to a simple query.

Be able to write simple rules and queries, similar to those on the programming assignment.

Given facts and rules, be able to tell what the first response to a given query would be, and if there are other responses. (Knowing what the first response is shows that you understand how resolution and backtracking work..

Be familiar with basic list notation (square brackets and commas to represent the list, [X|Y] to denote the division of the list into its head and tail, etc.)

Know the difference between rules that are conjunctions and rules that are disjunctions.

Know what backtracking is, its purpose, and the way Prolog applies it.

Understand the use of simple lists in Prolog.

Download