Name: 
 

Study Guide - Chapter 1 "Creating Your First Java Classes"



True/False:  Indicate whether the sentence or statement is true or false.
 

 1. 

The Java interpreter converts source code into a binary program consisting of bytecode.
 

 2. 

Everything that you use within a Java program must be part of a class.
 

 3. 

A class name cannot be a Java reserved keyword, such as public or class.
 

 4. 

Either First.java or first.java is an appropriate file name for the First class.
 

Multiple Choice:  Identify the choice that best completes the statement or answers the question.
 

 5. 

The term ____ refers to the grammatical rules of a programming language.
a.
structure
c.
semantics
b.
logic
d.
syntax
 

 6. 

A(n) ____ translates an entire program before executing it.
a.
executor
c.
interpreter
b.
translator
d.
compiler
 

 7. 

The ____ programming language is both compiled and interpreted.
a.
C++
c.
Visual Basic
b.
Java
d.
Assembly
 

 8. 

Writing ____ programs involves creating classes.
a.
model
c.
paradigm
b.
procedural
d.
object-oriented
 

 9. 

A program written in Java is run on a standardized hypothetical computer called the ____.
a.
Java virtual machine
c.
interpreter
b.
Java hypercube
d.
translator
 

 10. 

Java ____ applications support character output to a computer screen in a DOS window.
a.
console
c.
Web-based
b.
windowed
d.
mainframe
 

 11. 

Arguments to methods appear within ____.
a.
parentheses
c.
semicolons
b.
brackets
d.
colons
 

 12. 

Within the statement System.out.println("First Java application");, out is a(n) ____.
a.
method
c.
object
b.
procedure
d.
class
 

 13. 

Which one of the following is an illegal class name in Java?
a.
Employee
c.
Budget2002
b.
Checking Account
d.
class1
 

 14. 

By convention, a Java class starts with a(n) ____.
a.
asterisk
c.
lowercase letter
b.
uppercase letter
d.
digit
 

 15. 

The reserved keyword ____ is an access modifier.
a.
continue
c.
class
b.
import
d.
public
 

 16. 

Any characters placed after two ____ at the start of a line are ignored by the compiler.
a.
asterisks
c.
ampersands
b.
backslashes
d.
forward slashes
 

 17. 

Block comments start with ____.
a.
\*
c.
//
b.
/*
d.
//*
 

 18. 

What is the output of the following program?
     public class Test {
         public static void main(String [] args) {
             System.out.println("Hello java programmers");
             //System.out.println("I am just testing!");
         }
     }
a.
Hello Java programmers
c.
I am just testing!
b.
Hello java programmers
I am just testing!
d.
Hello java programmers
 

 19. 

A Java program named Person.java will compile using which of the following commands?
a.
java Person.java
c.
javac Person.java
b.
javac Person
d.
java Person
 

 20. 

After successfully compiling Person.java, the program will run using the command ____.
a.
java Person
c.
java Person.class
b.
javac Person.java
d.
javac Person.class
 

 21. 

What is the output of the following program?
    public class JavaRules {
         public static void main(String [] args) {
              System.out.println("Java ");
              System.out.println("rules!");
        }
   }
a.
Java
rules!
b.
Java rules
c.
Java rules!
d.
No output; the program would not compile because of a syntax error
 

 22. 

Which of the following arguments to exit ( ) indicates an application ended successfully?
a.
y
c.
1
b.
s
d.
0
 

 23. 

The showMessageDialog( ) method requires ____ argument(s).
a.
0
c.
2
b.
1
d.
3
 

 24. 

The ____ is the first program to detect the violation of language rules.
a.
compiler
c.
assembler
b.
interpreter
d.
operating system
 

 25. 

If a program compiles but produces incorrect results, it has a(n) ____ error.
a.
syntax
c.
primary
b.
logic
d.
first order
 

Completion
Complete each sentence or statement.
 

 26. 

In programming, named computer memory locations are called ____________________ because they hold values that might vary.
 

 

 27. 

____________________ group individual operations in a program into logical units.
 

 

 28. 

____________________, both in the real world and in software, are made of attributes and methods.
 

 

 29. 

Programs that are embedded in a Web page are called Java ____________________.
 

 

 30. 

Program ____________________ are non-executing statements added to a program for documentation purposes.
 

 

Matching
 
 
Match each item with a statement below.
a.
Attributes
f.
static
b.
Inheritance
g.
dialog box
c.
Literal string
h.
Encapsulation
d.
Source code
i.
import
e.
Polymorphism
 

 31. 

Sequence of characters enclosed by single quotes.
 

 32. 

Statement used when you want to access a built-in Java class that is contained in a package.
 

 33. 

The interpretation of the same word by the context in which it is used.
 

 34. 

GUI object resembling a window that displays messages.
 

 35. 

Reserved keyword that indicates a method may be accessed independent of an object.
 

 36. 

The characteristics that define an object.
 

 37. 

Hiding data and methods within an object.
 

 38. 

Feature by which a new class may derive attributes and methods from an existing class.
 

 39. 

Programming statements written in a high-level language.
 

Short Answer
 

 40. 

Describe the concept of machine language. What problems are inherent to programming in machine language?
 

 41. 

Describe line comments.
 

 42. 

Describe block comments.
 

 43. 

How do you save a Java class?
 

 44. 

After writing and saving an application, what two steps must occur before you can view the application’s output?
 

 45. 

Explain that concept of a logic error.
 



 
Check Your Work     Reset Help