True/False Indicate whether the
statement is true or false.
|
|
|
1.
|
Unlike natural languages, programming languages do not have semantics.
|
|
|
2.
|
In an expression, the arithmetic operators for multiply and divide must not be
adjacent.
|
|
|
3.
|
Programming languages have large vocabularies and complex syntax compared to
natural languages.
|
|
|
4.
|
In a programming language, one must get the syntax absolutely correct.
|
|
|
5.
|
Java’s syntax for manipulating primitive data types differs from the
syntax for manipulating objects.
|
|
|
6.
|
Literals are restricted to the primitive data types and strings.
|
|
|
7.
|
A variable’s data type can change while a program is running.
|
|
|
8.
|
It is customary to write the names of constants in lowercase.
|
|
|
9.
|
The semantics of division are different for integer and floating-point
operands.
|
|
|
10.
|
Strings can be concatenated to numbers.
|
|
|
11.
|
An object can respond to a message even if its class does not implement a
corresponding method.
|
|
|
12.
|
It is common practice to precede major segments of code with brief comments that
explain their purpose.
|
|
|
13.
|
Programming environments are able to detect logic errors automatically.
|
|
|
14.
|
Incorrect output is the most obvious indication that there is a logic error in a
program.
|
|
|
15.
|
When a window opens, the JVM sends the message paintComponent to each object contained in the window.
|
Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
|
16.
|
____ consists of the rules for combining words into
sentences.
a. | Vocabulary | c. | Syntax | b. | Semantics | d. | Logic |
|
|
|
17.
|
____ data types include numbers (both integer and floating-point),
characters, and Booleans.
a. | Primitive | c. | Complex | b. | Object | d. | Basic |
|
|
|
18.
|
Java includes ____ numeric data types.
|
|
|
19.
|
A variable of data type double uses ____ bytes of memory for storage.
|
|
|
20.
|
A variable declared with the keyword ____ will be a constant.
a. | const | c. | final | b. | static | d. | constant |
|
|
|
21.
|
An assignment statement has the form ____.
a. | <expression> = <variable>; | c. | <expression> ==
<variable>; | b. | <variable> =
<expression>; | d. | <variable> == <expression>; |
|
|
|
22.
|
____ have higher precedence than ____.
a. | Addition and subtraction; multiplication and division | b. | Subtraction and
division; addition and multiplication | c. | Multiplication and addition; subtraction and
division | d. | Multiplication and division; addition and subtraction |
|
|
|
23.
|
Which of the following operators has the highest precedence?
a. | addition | c. | multiplication | b. | unary minus | d. | assignment |
|
|
|
24.
|
Intermixing integers and floating-point numbers in an arithmetic expression is
referred to as ____ arithmetic.
a. | multitype | c. | mixed-mode | b. | mixed-type | d. | intertype |
|
|
|
25.
|
The escape sequence ____ indicates a newline character.
|
|
|
26.
|
Which of the following is a valid variable name?
a. | 3rdPayment | c. | pay.rate | b. | _$_$$$ | d. | final |
|
|
|
27.
|
Comments that appear between the symbols /* and */ are referred to as ____
comments.
a. | end of line | c. | javadoc | b. | multiline | d. | standard |
|
|
|
28.
|
____ errors occur when a program asks the computer to do something that it
considers illegal, such as dividing by 0.
a. | Logic | c. | Syntax | b. | System | d. | Run-time |
|
|
|
29.
|
Adding extra lines of code to a program that print the values of selected
variables in the terminal window in order to identify a logic error is an example of a(n) ____
technique.
a. | desk checking | c. | debugging | b. | compiling | d. | instantiating |
|
|
|
30.
|
In a screen coordinate system, the origin (0,0) is located at the ____ of a
window.
a. | center | c. | upper-right | b. | lower-left | d. | upper-left |
|
Completion Complete each
statement.
|
|
|
31.
|
____________________ is the set of all of the words and symbols in the
language.
|
|
|
32.
|
____________________ define the rules for interpreting the meaning of
statements.
|
|
|
33.
|
____________________ are items in a program whose values do not change.
|
|
|
34.
|
A(n) ____________________ is an item whose value can change during the execution
of a program.
|
|
|
35.
|
Before using a variable for the first time, the program must declare its type in
a(n) ____________________ statement.
|
|
|
36.
|
A(n) ____________________ consists of operands and operators combined in a
manner familiar from algebra.
|
|
|
37.
|
When evaluating an expression, Java applies operators of higher precedence
before those of lower precedence, unless overridden by ____________________.
|
|
|
38.
|
If a program tried to add 1 to the maximum integer value, it would result in a
condition known as ____________________.
|
|
|
39.
|
A technique called ____________________ allows one data type to be explicitly
converted to another.
|
|
|
40.
|
The string concatenation operator uses the ____________________ symbol.
|
|
|
41.
|
A method’s name and the types and number of its parameters are called the
method’s ____________________.
|
|
|
42.
|
Words that cannot be employed as user-defined symbols are called
____________________ because they have special meaning in Java.
|
|
|
43.
|
When using a package, a programmer ____________________ the desired class or
classes.
|
|
|
44.
|
The Scanner class’s ____________________ method
returns an entire line of input, including leading and trailing white space.
|
|
|
45.
|
____________________ are explanatory sentences inserted in a program in such a
manner that the compiler ignores them.
|
|
|
46.
|
____________________ errors (also called design errors or bugs) occur when a
programmer fails to express himself or herself accurately.
|
|
|
47.
|
When a program attempts to perform an illegal operation, the JVM will throw a(n)
____________________.
|
|
|
48.
|
Sending a message to a variable before the corresponding object has been
instantiated causes a(n) ____________________ exception.
|
|
|
49.
|
To provide a panel with additional capabilities, you can define a new type of
panel by ____________________ the JPanel class.
|
|
|
50.
|
Every panel maintains an instance of the
java.awt.Graphics class, known as the panel’s graphics ____________________.
|