COMP 1020 Final: COMP1020 Final Exam 2006 Fall Answers

644 views40 pages
lavenderbeaver188 and 10 others unlocked
COMP 1020 Full Course Notes
12
COMP 1020 Full Course Notes
Verified Note
12 documents

Document Summary

_______: _______, _______, _______, _______, _______, _______, _______, ________ No calculators, cell phones, or other electronic devices are permitted either: _______, ________ [1 mark] is, if they were accessed row-by-row above, provide code to have them accessed column-by-column, and if they were accessed column-by-column, provide code to have them accessed row-by-row instead. [5 marks: rewrite this code segment to access the pixels in this picture in the other order. [4 marks] int sum = 0; for (int i = 0; i <= intarray. length; i++) return sum/intarray. length; sum = sum + intarray[i]: rewrite the above method to avoid generating the exceptions identified and circled above. Line 5: choose values for the integer variables a, b, c and d and the boolean variable bb to make the following expression evaluate to true. [10 marks: based on this result, write a new instance method for the picture class called countnonwhitepixels that determines the number of pixels that are not white in a picture.