prelim3Spring2005 - CS100J Prelim 3, Spring 2005 Name: _...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Look over the entire exam before starting. Don’t spend too much time on one problem. If you get stuck on one problem, work on the others for a while and return to the difficult problem later, if you have time. There are five pages. Use the backs of pages if you need more room. You can unstaple the pages; we have a stapler at the front of the room. 0. (2 pts.) Write your name and net id —legibly— on every page of this exam. 1. (20 pts.) Write the body of the following method, as discussed in class and in the text and in the ProgramLive CD. Remember: we do not want to see an inner loop. /** Sort array b in ascending order (smallest to largest), using selection sort */ public void selectionSort( int [] b) { } CS100J Prelim 3, Spring 2005 Name: ____________ Net ID: _____ Page 1 out of 100 out of 26 out of 20 out of 20 out of 12 out of 20 out of 02 6. 5. 4. 3. 2. 1. 0.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2. (12 pts.) Class Inmate : Study class Inmate and answer the questions given below. /** An instance is a prison inmate, with a tattoo for an id */ public class Inmate { private int tattoo; // the id of the inmate /** Constructor: an inmate with id id */ public Inmate( int id) { tattoo= id; } /** = this inmate’s id */ public int getID() { return tattoo; } /** = “a and b are not null and have the same id ” */ public static boolean compare(Inmate a, Inmate b) { return (a !=
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/01/2008 for the course CS 100 taught by Professor Fan/vanloan during the Fall '07 term at Cornell University (Engineering School).

Page1 / 5

prelim3Spring2005 - CS100J Prelim 3, Spring 2005 Name: _...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online