CPSC 124 |
Introduction to Programming |
Fall 2004 |
Exam 2 Review Guide
While the main focus of the exam will be on the topics covered since the
last exam (listed below), it will by necessity not ignore topics from earlier
in the semester - you can't just forget about writing loops or subroutines,
for example.
Topics
The focus of the exam will be topics from sections 3.7, 4.5-4.6, 5.1-5.6,
and 6.2.
These topics include (but aren't limited to):
Applets and Graphics
- basic graphics (how to change the color, how to create a new custom
color, how to draw and fill basic shapes like rectangles)
- basic applets (how to write down the class, what import statements are
needed, how to write the init and paint methods and what they are for)
- animation using SimpleAnimationApplet2 (how to write down the class,
what import statements are needed, what methods to define and how to write
them down, what methods are available for use)
Packages and Toolboxes
- packages (what a package is, why they are useful, how to use [import
statements])
Classes and Objects
- using objects (declaring variables, creating new instances, accessing
instance variables, using methods, figuring out how to use an object given a
class, objects as function parameters or return values, objects in assignment
statements)
- writing classes (instance variables, constructors, methods, and what
each is for)
- when to use public, private, static
- when a constructor is invoked and what happens when it is
- inheritance (what it is, how to declare a subclass, the semantics of
inheritance, how to determine what version of a method is called, why it is
useful)
- polymorphism (what it is, how it is used, why it is useful)
- abstract classes (what they are, what they are useful for, how to write
them)
- interfaces (what they are, what they are useful for, how to write them,
how to implement them)
- this and super (what they mean, how they are used)
Program Design
- top-down design
- design including subroutines
- design including classes
Program Style
- what to comment (programs, functions/methods, classes, variables, ...)
and how
- pre- and postconditions (what they are, when to write them, what to
include)
You should also know all of terms that have been introduced.
You should be familiar with the classes used in the book and in lab
(e.g. Card, Deck, Hand, MovingBall, etc) but you would be provided with a
description of them for reference if you are asked to use them. Being
familiar with their operations, however, will save you valuable time!
Sample Questions
Possible types of questions included (but aren't limited to):
- defining terms
- explaining why something is useful (e.g. inheritance or polymorphism)
- writing code to use a class you are given
- implementing part or all of a class given a description of what to
implement
- tracing a program or some lines of code to determine the output
- reading a section of code and explaining what it does
- writing pre- and postconditions for a function
The end-of-chapter quizzes and programming exercises for chapters 4 and 5
are excellent practice.