Multiple Choice
1)Which operator is used to concatenate two strings?
(a)+
(b)–
(c)*
(d)/
Answer: A (see page 35)
2)Which operator returns the remainder of integer division?
(a)%
(b)/
(c)*
(d)none of the above
Answer: A (see page 26)
3)What is the value of the variable c in the statements that follow?
String phrase = "Make hay while the sun is shining.";
char c = phrase.charAt(10);
(a)w
(b)h
(c)i
(d)None of the above
Answer: B (see page 40)
4)The escape sequence the represents the new-line character is:
(a)\r
(b)\t
(c)\n
(d)\\
Answer: C (see page 43)
5)The syntax that declares a Java named constant named SALES_TAX is:
(a)double SALES_TAX = 7.50;
(b)public double SALES_TAX = 7.50;
(c)public static double SALES_TAX = 7.50;
(d)public static final double SALES_TAX = 7.50;
Answer: D (see page 47)