Name: 
 

Chapter2



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

 1. 

Java is the fastest growing programming language in the world.
 

 2. 

Java programs cannot be run on different types of computers unless code changes are made.
 

 3. 

Compared to C++, Java is more difficult to use and learn, more error prone, and less portable.
 

 4. 

A JVM is a program that behaves like a computer.
 

 5. 

Any computer can run an interpreter.
 

 6. 

Java applets are inherently insecure.
 

 7. 

Terminal-oriented programs are similar in structure to programs that process files of sequentially organized data.
 

 8. 

Sending messages to objects always takes the form <name of object>(<parameters>).
 

 9. 

Java programs cannot be written using a simple text editor, such as Notepad.
 

 10. 

When a syntax error is found by the Java compiler, the error message that is provided yields no information about the type of error that occurred or where it occurred.
 

 11. 

The main factor affecting a program’s readability is its layout.
 

 12. 

During the course of a program, a variable’s value cannot change.
 

 13. 

It is required that variable names begin with a lowercase letter.
 

 14. 

There is a limit to the number of variables that you can declare in a program.
 

 15. 

The default layout manager for frames is an instance of the class BorderLayout.
 

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

 16. 

Java is a modern ____ programming language.
a.
first-generation
c.
procedural
b.
object-oriented
d.
second-generation
 

 17. 

Java bears a superficial resemblance to ____, which is currently the world’s most popular industrial-strength programming language.
a.
C
c.
COBOL
b.
BASIC
d.
C++
 

 18. 

The Java compiler translates Java into ____.
a.
natural language
c.
byte code
b.
machine language
d.
bit code
 

 19. 

A(n) ____ user interface uses the Java console and the command prompt to display data, prompt the user for data, and read data into a program.
a.
terminal I/O
c.
graphical
b.
text
d.
illustrative
 

 20. 

____ is the name of an object that knows how to display or print characters in a terminal window.
a.
System
c.
System.out
b.
System.terminal
d.
Out.System
 

 21. 

The end of a statement in a Java program is denoted by a ____.
a.
:
c.
;
b.
.
d.
}
 

 22. 

Which of the following Java statements would print the text “Hello” in a terminal window?
a.
System.println(“Hello”);
c.
System.printLine(“Hello”);
b.
System.out.println(Hello);
d.
System.out.println(“Hello”);
 

 23. 

The file extension for a Java source code file must be ____.
a.
.java
c.
.jav
b.
.j
d.
.sun
 

 24. 

The file extension for a byte code file is always ____.
a.
.cla
c.
.java
b.
.class
d.
.jav
 

 25. 

Using a simple text editor in Windows to write Java programs, plus running the Java compiler and the JVM from the command line in Windows is known as the ____ development environment.
a.
simple
c.
integrated
b.
DOS
d.
Windows
 

 26. 

A(n) ____ statement, found at the beginning of a Java source code file, tells the compiler where to find complete specifications for a class that will be used in the Java source code.
a.
include
c.
use
b.
export
d.
import
 

 27. 

In general, instantiation takes the form ____.
a.
SomeClass someObject = new SomeClass(some parameters);
b.
SomeClass someObject = SomeClass(some parameters);
c.
someObject = new SomeClass(some parameters);
d.
SomeClass = new SomeClass(some parameters);
 

 28. 

The assignment operator is represented in Java by the symbol ____.
a.
>
c.
==
b.
=
d.
!=
 

 29. 

The multiplication operator is represented in Java by the symbol ____.
a.
x
c.
*
b.
/
d.
%
 

 30. 

The code for application windows in Java is located in the class ____.
a.
JApp
c.
JWindow
b.
JFrame
d.
WindowFrame
 

Completion
Complete each sentence or statement.
 

 31. 

Java is secure, robust, and ____________________.
 

 

 32. 

A(n) ____________________ is a process that can run concurrently with other processes.
 

 

 33. 

Java runs more slowly than most modern programming languages because it is ____________________.
 

 

 34. 

To run Java byte code on a particular computer, you must install a(n) ____________________ unless it comes with the operating system.
 

 

 35. 

Some JVMs translate byte code instructions into machine language when they are first encountered, which is a process called ____________________.
 

 

 36. 

A(n) ____________________ is a sequence of instructions for a computer.
 

 

 37. 

The string of characters that appears between the parentheses following a System.out.println message is called a(n) ____________________.
 

 

 38. 

When sending a message to an object, the period between the object’s name and the message’s name is called a(n) ____________________.
 

 

 39. 

Metrowerks’ Code Warrior, Microsoft’s Visual J++, and Borland’s JBuilder are examples of ____________________.
 

 

 40. 

To compile a Java program stored in the file Hello.java from the command line, you would use the command ____________________.
 

 

 41. 

Once the Java program contained in the file Hello.java has been compiled, you can run it from the command line using the command ____________________.
 

 

 42. 

Mistakes detected by the compiler are called ____________________.
 

 

 43. 

____________________ are used to share information between objects.
 

 

 44. 

A numeric ____________________ names a location in RAM in which a number can be stored.
 

 

 45. 

Variables of type double are used to store ____________________ numbers.
 

 

 46. 

Statements utilizing an assignment operator are called ____________________ statements.
 

 

 47. 

In Java, as in algebra, multiplication and division are done before addition and subtraction unless ____________________ are used to change the order of the computations.
 

 

 48. 

After the statement Scanner reader = new Scanner(System.in); has been executed in a program, the variable reader stores a(n) ____________________ to a Scanner object.
 

 

 49. 

A(n) ____________________ is a flat, rectangular area suitable for displaying other objects, such as geometric shapes and images.
 

 

 50. 

In Java, each container object, such as a frame or a panel, uses an object called a(n) ____________________ to coordinate the organization and layout of items within the container.
 

 



 
Check Your Work     Reset Help