spring06prelim1 - Cornell net id _ Name _ CS 100J Prelim 1...

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

View Full Document Right Arrow Icon
Cornell net id ____________________ Name ________________________________ CS 100J Prelim 1 23 February 2006 This 90-minute exam has 6 questions (numbered 0. .5) worth a total of 100 points. Spend a few minutes looking at all questions before begin- ning so that you can see what is expected. Budget your time wisely. Use the back of the pages if you need more space. Question 0 (2 points). Write your netid and your name, legibly, at the top of each page (Hint: do it now). Gries’s netid is djg17. Question 1 (16 points). (a) What is the difference between a static method and a non-static method? (b) Name three types of variables and their scopes. (c) What is a parameter? (d) For each of the following expressions, write its value beside the expression. If the evaluation leads to an error, write “error” instead. false (“5” + 9)/2 0 ___________ out of 02 1 ___________ out of 16 2 ___________ out of 18 3 ___________ out of 22 4 ___________ out of 22 5 ___________ out of 20 Total ________ out of 100
Background image of page 1

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

View Full DocumentRight Arrow Icon
Cornell net id ____________________ Name ________________________________ Question 2 (18 points): At the bottom of the page are two class definitions. Draw one folder (object, instance) of class Politican and then a folder of class Governor. You need not include the partition for superclass Object. public class Politician { private String name= null ; // politician’s name /** = “p1 and p2 are the same folder” */ public static boolean areEqual (Politician p1, Politi- cian p2) { return p1 == p2; } /** Constructor: politician named n */ public Politician (String n) { name= n; } /** Set this politician’s name to n */
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 / 7

spring06prelim1 - Cornell net id _ Name _ CS 100J Prelim 1...

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