CIT 591 First Quiz
Fall 2001, Dave Matuszek |
Name Answer
Key
|
Please keep all answers short and legible. Do not volunteer information that
was not asked for. Where appropriate, distinguish clearly between capital letters
and lowercase letters.
- What keyword tells Java that your class is a subclass of some other class?
extends
- The primitive type boolean
has exactly two values,
true and false.
- In BlueJ, what does it mean when a class is striped?
It has not been compiled in its present form
- What happens if your program is running in BlueJ and you click on the turning
red-and-white striped "candy cane" progress bar?
The Debugger window opens. (Contrary to what
many people thought, the program does not stop.)
- Rewrite the following names as they should be written in Java. Distinguish
clearly between capital letters and lowercase letters.
- The boolean variable
door_is_open doorIsOpen
- The method
openthedoor openTheDoor
- The class
garagedoor GarageDoor
- The object variable
my_garagedoor myGarageDoor
- In Java, we don't call a function, we send
a message to an object
.
- True (T) or false (F):
- F A
class inherits the fields, methods, and constructors of its superclass.
- T
The declaration
int i causes space to be allocated for an
integer variable.
- T
The declaration
String s does not cause space to be allocated
for a String variable.
- F
When indenting Java statements, you should use hard tabs instead of soft
tabs.
- F
When drawing in Java, the (0, 0) point is the bottom left-hand corner.
- T
{ } is a legal statement in Java.
- Each of the following statements contains a syntax error. Very briefly,
tell what is wrong with each statement.
if (x - 1) y = 2 * x; x
- 1 is not a boolean expression
while (x > y) { x--; y++ } missing
semicolon after y++
for (int i = 0; i++; i < 10) test
and increment are in wrong order
System.out.println(i);
If (m < 0) m = -m; keyword
if should not be capitalized