CPSC 124 |
Introduction to Programming |
Fall 2004 |
Final Exam Review Guide
The exam will be cumulative. (It is hard to avoid, anyway.)
Topics
You are responsible for everything in the assigned reading, even if it
wasn't covered in class and isn't listed below. However, the major topics
covered will be drawn from the following list.
Program Structure
- how to write a standalone application (how to write the class, what
subroutines are needed, the flow of execution, how to run the program)
- how to write a Swing-based applet (how to write the class, what
subroutines are needed, the flow of execution, how to run the program)
Programming in the Small
- types (what a type is, primitive types vs. user-defined types,
identifying the type of an expression)
- variables (what they are, how to declare, how to use)
- expressions (what they are, operators: arithmetic, relational,
logical/boolean)
- input and output (using System.out and TextIO)
- statements (the syntax and semantics of each, when each is appropriate)
- while loop
- do-while loop
- for loop
- if statement
- switch statement
Programming in the Large
- subroutines/functions (how to create a subroutine, how to call a
subroutine, the semantics of calling a subroutine, when to create a subroutine)
- parameters (how to declare parameters, how parameter-passing works, how
to call a subroutine with parameters, why you'd create a parameterized
subroutine)
- return values (what a return value is, how to declare a return value,
how to actually return the value, how to use the returned value in the
program, why you'd create a function with a return value)
- 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)
- packages (what a package is, why they are useful, how to use [import
statements])
Program Design
- writing pseudocode
- top-down design
- design including subroutines
- design including classes
- design of a GUI program
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)
GUIs
- what GUI stands for
- custom components (how to create one)
- events (what an event is, what kinds of events are generated for
different things [know about mouse events, keyboard events, and events
generated by timers and buttons])
- event listeners (what one is, how to create one, what listener interface
goes with a particular kind of event, what methods are required for each
listener interface)
- applets with GUIs (how to create the GUI, how to use BorderLayout)
Arrays
- what an array is
- declaring, allocating, and using an array
- arrays as parameters
- programming with arrays (inserting into an array, removing from an
array, growing/shrinking arrays, searching, sorting, shuffling - including how
to do these things without using System.arraycopy)
- multi-dimensional arrays
You should know how to use the most common classes used in the course, such
as TextIO and String. You will not be provided with copies of TextIO and
String if you need to use them. In particular, you should know how to read
input using TextIO and should know how to get the length of a string and how
to extract individual characters from a string.
You should be familiar with the other 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 include (but aren't limited to):
Short Answer
- defining terms
- explaining why something is useful (e.g. inheritance or polymorphism)
- identifying the type of expressions
- other short answer (many of the end-of-chapter quiz questions fall into
this category)
Reading Code
- tracing a program or some lines of code to determine the output
- reading a section of code and explaining what it does
Writing Code
- translating pseudocode into actual code
- write a section of code, a subroutine, or an entire program to accomplish
a task given only a specification of what the code should accomplish
- implementing part or all of a class given a description of what to
implement
The end-of-chapter quizzes and programming exercises
are excellent practice.