Computer Science 61B - Summer 1999 - Midterm 1

Computer Science 61B - Summer 1999 - Midterm 1 - CS 61B CS...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 61B CS 61B, Summer 99 Midterm 1 1.0 Putting your login on every page (1pt, 3mins) Write your login using CAPITAL LETTERS on the upper left-hand corner of every page. 2.0 Short Answer (3pts, 10mins) The following section contains several short questions. Answer them as concisely as you can. Why doesn't this compile and how can you fix it (make one change only)? public class Something { static int a; public static void foo() { a = 5; } } Something.java:5: Can't make a static reference to nonstatic variable a in class Something. a = 5; Can a private instance variable belonging to the current object ever be accessible by another object that is not the current object. If so, describe a situation when this can occur. What effect does the public and private modifiers have when placed in front of methods. 3.0 Object Oriented Design (4pts, 10mins) file:///C|/Documents%20and%20Settings/Jason%20Raf...e%2061B%20-%20Summer%201999%20-%20Midterm%201.htm (1 of 6)1/27/2007 6:33:02 PM CS 61B Han has designed two classes for the purposes of the first project, Board and MineSweeper. The Board classes uses two 2-d arrays to maintain the state of the game. These two arrays are: covered - keeps track of which cells are covered, which cells are uncovered, and which cells have been marked by the user. mineField - a representation of the actual board-state. If a cell is a mine, its value is -1 (or Board. BOMB), otherwise its value is equal to the number of mines surrounding it. The MineSweeper class collects initial information from the user about a new game and then starts the game using the Board class to maintain state. To allow the MineSweeper class to access information game using the Board class to maintain state....
View Full Document

This test prep was uploaded on 04/20/2008 for the course CS 61B taught by Professor Canny during the Spring '01 term at University of California, Berkeley.

Page1 / 6

Computer Science 61B - Summer 1999 - Midterm 1 - CS 61B CS...

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