Practice Questions
Exercises on the new topics since the last exam:
- SR 7.6-7.9, 7.21-7.24
- EX 7.1, 7.2, 7.10, 7.11
Writing and programming exercises (to get the most out of these, you should
write out the solutions on paper first rather than typing it up):
- EX 2.2, 2.4, 2.5, 2.11
- PP 2.2, 2.3, 2.4 2.5, 2.8, 2.9
- EX 3.1, 3.2, 3.4, 3.6, 3.8, 3.9
- PP 3.1, 3.3
- EX 4.1-4.5
- PP 4.1, 4.4, 4.6
- EX 5.2-5.5, 5.7-5.10, 5.12, 5.14
- PP 5.1, 5.4, 5.7
- EX 6.1-6.4, 6.6-6.8, 6.10, 6.11, 6.14
- PP 6.1, 6.2, 6.3, 6.7
- EX 8.1, 8.4-8.10
- PP 8.1, 8.2, 8.5
- Review Listing 8.7-8.8. Explain what the purpose of the method
increaseSize() is. Where is this method called? In what situations will this
method get called? Why is such a method necessary for an array of information?
- Modify SR 8.24 so that your class does the following:
- Design your 2D array so that it has
one column for assignment scores (out of 49 marks),
one column for midterm 1 scores called MT1 (out of 47 marks),
one column for midterm 2 scores called MT2 (out of 50 marks),
and
one column for lab scores (out of 90 marks).
Make your array to hold scores for 150 students, and fill in all the marks
randomly (but within the meaningful ranges).
- Add a method to modify MT1 scores such that: for any student, if
his/her MT2 score is greater than his/her MT1 score, replace the MT1 score
with that of MT2. Note that these scores are in marks, not percentages. So
becareful in your comparison.
- Add a method that calculates the highest score and the average score
achieved on each portion of the course (that is, for each column of the
grades). Once it's been calculated, print it out on the screen.
- Add a method that calculates the weighted total of the student marks
and returns these marks in an array. Note that assignments are worth
15%, labs are worth 20% labs,
midterm 1 is worth 10%, and
midterm 1 is worth 20%.
Since these percentages only total up to 65% of the course, your calculation
needs to figure out how each student does out of 65%.
Additional items to review:
- Midterm 1, 2
- Lecture notes
- Class examples
- Lab activities
- Assignment 1 and 2 solutions
- Do Assignment 3 if you didn't attempt it