Sections
E-mail TA
Each week you will complete problem(s) to turn in at your section. These problems will earn you up to 2 out of your 3 section participation points for the week. The other point is awarded for being present in your section and participating in the discussion.
You will not be graded on whether you have a perfect solution, but on whether you have demonstrated effort. Therefore please show some work that demonstrates how you got the answer rather than just writing the answer by itself. We will be somewhat lenient about exactly how the work is shown.
Our intention is that these problems would take you up to 30 minutes each week. If you find yourself taking significantly more than this, you may stop your work and write that you worked for 30 minutes. If you have made significant progress, we will still give you credit for your work.
Section 9: Final practice
(Thu Mar 13)
Exercises: Solve the following one (1) Self-Check problem on paper and bring your sheet of paper to your section on Thursday:
-
Chapter 9, Self-Check Problem #16: Inheritance/Polymorphism Mystery (p640). In addition to writing the answer, also show your work by turning in a table of the methods and their output, similar to the one shown on page 603.
Note: the client code uses a for-each loop, described on page 457, to iterate over the array of objects. This is equivalent to the following for loop:
for (int i = 0; i < ponds.length; i++) {
Pond p = ponds[i];
...
}
You are NOT required to know the for-each loop syntax.
Mar 5 2014 8:30 AM
Section 8: Classes and objects
(Thu Mar 6)
Exercises: Solve the following three (3) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:
-
Chapter 8, Self-Check #2: what is an object? (p564). Answer the question in your own words.
-
Chapter 8, Self-Check #4: reference mystery (p564).
-
Chapter 8, Self-Check #18: problems with constructor (p566). Write the two problems with the constructor shown, and then show a corrected version that does not contain these two problems.
Feb 26 2014 8:30 AM
Section 7: Arrays
(Thu Feb 27)
Exercises: Solve the following two (2) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:
-
Chapter 7, Self-Check Problem #28: array simulation (p509). Write the final contents of each array after the method is finished executing. Show your work by writing the arrays' initial contents and then crossing out elements as their values change.
-
Chapter 7, Self-Check Problem #10: max
(p506). Write a method named max
as described. Find the prompt and check your answer on Practice-It.
Feb 19 2014 8:30 AM
Section 6: File input/output
(Thu Feb 20)
Exercises: Solve the following four (4) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:
-
Chapter 6, Self-Check Problems #12, #13, and #14: File processing (p429). For each of the three problems, write the output from the code shown. You do not need to show your work; just the answer.
-
Chapter 6, Self-Check Problem #16 (p430): write the method printEntireFile.
Feb 12 2014 8:30 AM
Section 5.5: midterm review
(Thu Feb 13)
Exercises: Solve the following two (2) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:
-
Chapter 5, Self-Check Problem #14: boolean
expressions (p370). Solve expressions (c), (d), and (i) - (l)
-
Chapter 5, Self-Check Problem #27: Logical Assertions (p375). Turn in a table or list with your answers. For each of the five labeled points in the program, write ALWAYS (A), NEVER (N), or SOMETIMES (S) for each of the three assertions. In addition to this, show your work by explaining very briefly why you wrote the answer you wrote for each point and assertion. (Example: You could write something like, "for Point C, assertion "k > j
", the answer is SOMETIMES because the value of k
is generated by a Random
object so it could have any value.")
Feb 5 2014 8:30 AM
Section 5: while
, Random
, boolean
(Thu Feb 6)
Exercises: Solve the following three (3) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:
-
Chapter 3, Self-Check Problem #20: String method calls (p187). This problem shows several method calls on String
variables and asks you to write the result that is returned by each call. Solve only expressions (a), (d), (e), (h), (i), (j), and (l).
-
Chapter 5, Self-Check Problem #3: while
loop mystery (p368-9). Write the output of each call. Show your work by writing each value that each variable has as the code is running. For each call, make a table showing the values that x
and y
have as you execute the while
loop for that particular call. For example, for the first two calls, the table look like this:
mystery(1); mystery(6);
x y z x y z
_____________ _____________
1 1 0 6 1 0
... ...
-
Random
: Write code that generates a random...
-
integer between 0 and 10 inclusive.
-
integer between 11 to 99 inclusive.
-
integer between -2 and 2 inclusive.
-
odd integer (not divisible by 2) between 50 and 99 inclusive.
Jan 29 2014 8:30 AM
Section 4: if/else
, Scanner
, return
(Thu 1/30)
Exercises: Solve the following problems on paper and bring
your sheet of paper to your section on Thursday:
-
Returns: list two advantages of methods that return over methods that print.
-
Programming Exercise 4.1:
fractionSum
(p305). Find the prompt and check your answer on Practice-It.
-
Programming Exercise 4.12:
printTriangleType
(p307). Find the prompt and check your answer on Practice-It.
Jan 21 2014 4:30 PM
Section 3: Parameters, graphics
(Thu 1/23)
Exercises: Solve the following two (2) problems on paper and bring your sheet of paper to your section on Thursday. Show your work, such as by writing a table of what values are passed for each parameter to each call. Circle your final answer/output so it's clear which part is the answer vs. intermediate work.
-
Chapter 3, Self-Check Problem #8:
MysteryTouch
(p184)
-
Programming Exercise 3G.1
(p223). Find the prompt and check your answer on Practice-It.
Section 2: Expressions, for
loops
(Thu 1/16)
Exercises: Solve the following three (3) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:
-
Chapter 2, Self-Check Problem #2 (p119), solve expressions (a) - (e); from
2 + 3 *
... through (18 - 7) *
...
-
Chapter 2, Self-Check Problem #3 (p120), solve expressions (a) - (c); from
4.0 / 2 *
... through 12 / 7 *
...
-
Chapter 2, Self-Check Problem #28 (p125), reading for loop code
For the first two problems, please show some work rather than just writing the answer. Write out sub-expressions as you compute their values, and circle or underline operands to show precedence, as is done on page 69-70 of the textbook. You may use a calculator if you want, though one shouldn't be necessary for these problems. For example:
2 + 19 % 5 - 11 * (5 / 2)
2 + 19 % 5 - 11 * 2
2 + 4 - 11 * 2
2 + 4 - 22
6 - 22
-16