Review/Discussion Questions
Review questions may become the source of a discussion in class.
Even if no discussion is planned, if you have any questions about
the Review/Discussion questions be sure to bring them up in class.
If you have questions, probably other people do too!
Syllabus Questions:
Chapter 1, part 1:
- Review Exercises R1.10 and R1.12
Chapter 2:
- Review Exercises R2.10 - R.2.11
Chapter 1, part 2:
Boolean (true/false) expressions and If Statements:
Chapter 5:
- R5.5 - R5.6, R5.8 - R.11, R5.13, and R5.14 (pp. 194 - 195)
Chapter 6:
Probability:
- One can simulate the movement of a fish in an aquarium by
repeatedly flipping a coin. When "heads" is flipped, the fish moves
one foot to the right; when "tails" is flipped, it moves one foot to
the left. (We are assuming a long, narrow aquarium.) Assume that the
fish's initial location is labeled 0 and that locations to the right
are positive while locations to the left are negative. For example,
the fish in its initial location has left and right neighbors at
locations -1 and +1, respectively. What are the possible positions of
the fish, relative to its starting position, at the end of a
simulation with six coin flips? Explain. (Don't worry about the tank
being too short.)
- Conduct several such simulations, each with six coin flips as
described in the exercise above, and keep track of where the
fish ends up after each simulation. Is the fish more likely to
end up in one position than another? Explain why or why not.
Chapter 7:
- R7.7 - R7.9 (Substituting ArrayLists for Arrays where
appropriate)
More If Practice:
Chapter 3:
- R3.2 - R3.6
- Completed Object Diagrams
AquaFish class:
- Look over the implementation for the
AquaFish
class in
AquaFish.java
. You do not need to read all the method
implementations, but you should be able to find and identify the main
pieces of the class -- the declarations of instance variables, the constructors,
the public methods, and the private methods that are available only within
the class.
- Where is an object's state reprepresented in the
AquaFish
class?
- How many constructors does the class have?
- How many public methods does the class have? Does this correspond
to the class
documentation for AquaFish? Why, or why not?
- What private methods does the class have? Are they represented
in the class documentation? Why, or why not?
Method Visibility:
Chapter 7, part b:
Chapter 6, part b:
Chapter 9:
Binary Search:
- Conduct a binary search on the arrray a given in the book on page
568 looking for the number 6. Which positions in the array would you
check using the algorithm on page 569-570?
- List an example when you would use a binary search and give an
example when a linear search would be better.
Chapter 10:
- R10.4, R10.6, R10.7, R10.10, R10.14
Chapter 8:
More from Chapter 8:
Chapter 14: