Java Reference
In-Depth Information
Short Answer (continued)
5. Adding the Java code, _______________, t o the end of the main() method
header gives a program a way to acknowledge and handle potential input or
output errors and still compile correctly.
6 . _______________ listens for events in an applet.
7. Examples of applet component objects include _______________,
_______________, and _______________.
8. The actionPerformed() method is an example of a(n) _______________.
9. The main reason for using a consistent set of _______________ i s t o standard-
ize the structure and coding style of an application, so that you and others
can read and understand the code easily.
10. Make a list of the primitive data types in Java. Give three different literal
examples of each.
11. Evaluate each of the following expressions:
a. 4 * 3 / 6 - 4 + Math.pow(7,2)
b. (3 + 4 ) * 7 - 3
c. 9 * 2 / 4 + 5 % 3 + 3
d. 55 = = 55
12. For each of the situations below, explain which type of division (regular,
integer, or modular) will result in the more appropriate answer. Your answer
may include more than one type of division.
a. calculating how many busses will be needed for 350 students
b. figuring an average grade
c. determining how many quarters are in 685 cents
d. testing user input for an even number
e. rounding down
13. Which arithmetic or comparison operation is performed first in the follow-
ing expressions?
a. 144 / (6 * 2)
b. 25<57 != false
c. answerA + answerB * answerC
d. 125 / (result * 4)
e. true = = true != false
f. 5 * 3 % 2 + 7 / 2 - 7
14. Which of the following expressions are valid and do not require the Java
compiler to cast?
a. double answerA = 12.0 / 4.0;
b. int answerB = 12 / 7;
c. int answerC = 3 + 4 + “subtotal”;
d. boolean answerD = 9 * 6;
e. double answerE = 3answerB;
f.
double answerF = 15 % 5;
Search WWH ::




Custom Search