Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
Which of the following are Java program keyword
categories?
a. | Reserved words, pre-defined identifiers and user-defined
identifiers
| c. | void, static,
println | b. | Reserved pre-defined identifiers, reserved user-defined
identifiers and library identifiers
| d. | None of the
above |
|
|
2.
|
Consider the two program segments below.
Segment A
Segment B
int a;
int a = 100; int
b;
int b =
200; a = 100; b =
200;
What is true about the comparison of these two
segments?
a. | Segment A is correct and segment B is not
correct.
| c. | Segment A and segment B are both correct. | b. | Segment A is incorrect and segment B is
correct.
| d. | segment A and segment B are both incorrect.
|
|
|
3.
|
Consider the two program segments below.
Segment A
Segment B
int a;
int a = 100; int
b;
int b =
200; System.out.println(a);
System.out.println(a);
System.out.println(b);
System.out.println(b);
What is true about the
comparison of these two segments?
a. | Segment A is correct and segment B is not
correct. | c. | Segment A and segment B are both correct.
| b. | Segment A is incorrect and segment B is
correct. | d. | segment A and segment B are both
incorrect.
|
|
|
4.
|
A
sentence in English compares to a __________ in Java.
a. | class
| c. | keyword | b. | method
| d. | program
statement
|
|
|
5.
|
Class and method containers start and end with
a. | braces
{ }
| c. | a pound sign
#
| b. | the keyword
public
| d. | the keyword
class
|
|
|
6.
|
What value is stored in number by executing the statement
number = 10 % 3; ? Assume that number is
declared to be a integer number data type.
|
|
7.
|
What is the value of result in the following
statement?
double result =
Math.floor(9.999999);
a. | 10.0 | c. | 9.0 | b. | 9.999999 | d. | 9.9 |
|
|
8.
|
Which of the following program statements uses a unary
operator?
a. | num = num + 1; | c. | num--; | b. | num++; | d. | Both B & C |
|
|
9.
|
What is the value of result in the following
statement?
int result =
Math.pow(2,5);
|
|
10.
|
The program statement num++; is identical to which of the following
statements?
a. | num = num + 1; | c. | num = num + num; | b. | num = num +
0.1; | d. | None of the above |
|
|
11.
|
What is the value of result in the following
statement?
int result =
Math.min(4,3);
|
|
12.
|
The statement num += 10 is the same as the
statement
a. | num = num + 10; | c. | num + 10 = num; | b. | num =
10 | d. | A and C |
|
|
13.
|
What is true about comparing the computer graphics coordinate system
and the mathematical Cartesian coordinate system?
a. | The (0,0) coordinate is in the same
location. | c. | The Y-value increases
differently. | b. | The X-value
increases differently. | d. | Both the X-value and the Y-value increase
differently. |
|
|
14.
|
What is the output of the program segment
below?
char c1 =
'A'; char c2 =
'B'; char c3 =
'C'; System.out.println(c1 + c2 +
c3); c1 = c2 = c3 =
'Q'; System.out.println(c1 + c2 +
c3);
a. | ABC ABQ | c. | ABC QQQ | b. | QQQ QQQ | d. | Error Message |
|
|
15.
|
What is drawn by the drawPoint method?
a. | A point of one pixel | c. | A 4 by 4 square of sixteen pixels | b. | A 3 by 3 square of nine pixels | d. | A point with a
specified number of pixels based on the g value |
|
|
16.
|
Consider executing
the following program statement:
Expo.drawLine(g,100,100,200,100);
What
type of line will be drawn?
a. | A diagonal line sloping up to the
right
| c. | A horizontal line | b. | A diagonal line sloping down to the right | d. | A vertical
line |
|
|
17.
|
Consider executing
the following program statement:
Expo.drawLine(g,100,600,600,100);
What
type of line will be drawn?
a. | A diagonal line sloping up to the
right | c. | A horizontal line | b. | A diagonal line sloping down to the right | d. | A vertical
line |
|
|
18.
|
Consider executing
the following program statement:
Expo.drawOval(g,500,300,100,100);
What
type of oval will be drawn?
a. | A horizontal oval | c. | A
diagonal oval | b. | A vertical
oval | d. | A circle |
|
|
19.
|
What is Java's Boolean data type?
a. | Boolean | c. | bool | b. | boolean | d. | truefalse |
|
|
20.
|
Consider executing
the following program statement:
Expo.drawArc(g,500,400,200,50,90,270);
What
type of arc will be drawn?
a. | The top half of an oval | c. | The bottom-right corner of an oval | b. | The bottom half of an oval | d. | A complete
oval |
|
|
21.
|
Which of the following methods can draw a circle?
a. | drawOval | c. | drawArc | b. | fillOval | d. | All of the above |
|
|
22.
|
What is the output of the program segment
below?
int number = (5 + 8) * (3 +
2); System.out.println(number);
|
|
23.
|
What do the initials GUI stand for
a. | Graphical User Interface | c. | Graphics User Internet | b. | Graphical User
Internet | d. | Graphed Used Interface |
|
|
24.
|
Which of the following is a Java integer data type?
a. | integer | c. | Int | b. | double | d. | int |
|
|
25.
|
What value is stored by the statement int number = 100 / 3;
?
|
|
26.
|
What value is stored in number by executing the statement
number = 7.0 / 2.0; ? Assume that number is
declared to be a real number data type.
|
|
27.
|
Which of the following is not a binary arithmetic operator for real
numbers?
|
|
28.
|
The statement num = num * 100; is the same as the
statement
a. | num *= 100; | c. | num
* num = 100; | b. | num * 100 =
num; | d. | num =* 100; |
|
|
29.
|
a. | must all be lower-case. | c. | are case-sensitive. | b. | must all be
upper-case. | d. | are not case-sensitive. |
|
|
30.
|
What is the value of result in the following
statement?
double result =
Math.ceil(9.000001);
a. | 10.0 | c. | 9.0 | b. | 9.000001 | d. | 9.1 |
|
|
31.
|
What is the value of result in the following
statement?
int result =
Math.max(4,3);
|
|
32.
|
What is the value of result in the following
statement?
int result =
Math.pow(4,3);
|