CP2003 Lecture Notes - Review for Exam
On Programming
- You will have to learn many languages
- Programming is hard, is a creative art
- Higher-level languages should make it easy
Exam
- Tuesday 10/11/98 1:45 pm, at EN126
- The final exam is 45% of mark
- 20+ questions
- 3hrs, plus 10 minutes reading time
- Have exam booklets
- Almost all are short answer
Resources
- 1996-CP2003 tests
- Tutorials
- Text book
- Lecture notes
Kind of Question
- Examine program, assume X, what is output of program
- Examine program, identify X in program
- Programs are mostly Java, some Scheme, C, Pascal
Types
- Primitive and composite
- Type notation, cardinality
- Type checking, strong vs. weak, dynamic vs. static
- Type inference/coercion
- Polymorphic types
Commands
- Flow-of-control
- for statement
- Assignment, different kinds
Names
- Declarations: new type vs. type, new variable vs. variable
- Binding (dynamic vs. static), scoping (dynamic vs. static), dereferencing
- Abstractions: procedure, function, selector
Storage
- Stack frames pushed on function call, popped on exit
- Heap vs. stack
- Garbage collection
- Dangling references
Parameter Passing
- call-by-value, call-by-reference, call-by-copy
- in/copy out, call-by-pointer
- lazy vs. eager evaluation
Encapsulation (Chapter 6-7)
- ADTs, Objects, Classes
- Overloading
- Polymorphism vs monomorphism
- Subtype and Inheritance
- Coercions
- Type inference
- Object-oriented terminology
Sequencers (Chapter 8)
- Jumps
- Escapes
- Exception handlers, Examples in Java.
Concurrency (Chapter 9)
- Programs and processes
- Problems with concurrency
- Process interactions such as all types of the processes.
- Process creation and control in Java
- Monitors in Java
Object-Oriented Programming
- Objects and Classes in Java
- Class and subclass definitions
- Inheritance in OO paradigm
- Variables and Methods
Paradigms
- Imperative, Functional (higher-order functions), Object-Oriented, Logic Programming
- Which language belongs to which paradigm
- Characteristic features of paradigm
Jinli Cao 1998