CPSC 120 -- Test #3 Review Topics
- Loops (Sections 4.5 (while - this was on the last test
but you still need to know how to do them!), 4.7 (do...while),
4.8 (for loops),
Labs 7 - 10, class notes, quizzes)
- Know the three basic loop structures and the differences
among them; given a loop of one type (for example, while) be able to
write an equivalent loop of another type.
- Be able to trace a loop to determine what it does - this includes
showing values of variables as it executes, showing what it prints,
or giving a verbal high-level description (such as finds the product
of the multiples of 3 from 1 to n).
- Be able to write loops -- be able to correctly control
the loop (write the appropriate boolean expression for the loop control
condition, initialize any variables in that expression (loop control
variables) before the loop, update those variables correctly
inside the loop).
- Know what is meant by a count-controlled loop (and how to write one
especially using a for statement)
and a sentinel controlled loop (and how to write one).
- Be able to perform common looping subtasks -- summing, counting,
finding averages, finding products,
finding max and min values. Be able to use a loop
to go through a string character by character and do something such
as count a particular type of character or find the first character
after a blank. Be able to use a loop to ensure valid input (keep
making the user enter values until the value is in the correct
range).
- Be able to write and understand complex loops containing method calls,
conditions, and other loops (nested loops).
- Objects and Classes (Sections 3.1, 5.1 - 5.8, Labs
3 and 8 - 10,
class notes and handouts - All Self-Review Questions in Chapter 5,
except 5.5 on page 224 are good review.)
- Understand the difference between objects and primitive values, including
the difference in how they are stored (directly vs. references).
- Be able to create (instantiate) an object given the type signature
of one or more constructors of the appropriate class.
- Be able to use an object appropriately given the type signatures and
reasonable documentation for its methods.
- Understand the meaning of the public and private modifiers
and when each is appropriate.
- Understand the meaning of encapsulation (related to the
idea that an object should be self-governing) and how visibility
modifiers are used to enforce it (specifically understand what parts
of the class should be private and what should be public and how
doing that enforces encapsulation).
- Understand the concepts of attributes and behaviors
(or operations) of objects and how these relate to
instance variables and methods in the classes we write.
- Understand the difference between instance data (variables)
and local data (variables).
- Be able to write a class given a description of the capabilities required
of it.
- Understand the difference between static and instance variables, and
when each should be used. Understand why we often make constants in a class
public and static and how a client program can access them.
- Know what the reserved word this is.
- Methods (Chapter 5 but especially sections 5.4,
Labs 3, and 8 - 10, class notes
and handouts)
- Be able to write a method to perform a given task.
- Know what a constructor is and how a constructor differs from other
methods (when a constructor is executed and other differences). Be
able to write constructors.
- Understand the role of the toString method - what it does
and how it is used implicitly when an object is included in a print
statement. Understand what happens if you try to print an object
for a class that does not have a toString method.
- Understand all components of a method's signature -- public/private,
static/instance, return type, method name, formal parameters.
- Understand what it means for a method to return a value, and be able
to both write and use such methods. In particular, understand the
difference between a method that has void return type and one that
returns a value.
- Understand the difference between formal and actual
parameters.
- Understand the scope of identifiers - where formal parameters
can be referenced, where local variables can be referenced,
where instance variables can be referenced. (pp. 170-1, 188-190)
- Understand the difference between static and instance methods, how each
is accessed, and when each should be used. (Section 3.6, the Math class,
Self Review Question SR 5.11 on page 224)
- Understand what it means to say a method is overloaded. Be able
to explain how overloaded methods can be distinguished from each other.