Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
1.
|
String is not a simple data type. What
is it?
a. | a method | b. | a
class | c. | a file | d. | a statement |
|
|
2.
|
length is a method of what
class?
|
|
3.
|
What method is
contained in the driving class?
a. | the main method | b. | the math
method | c. | the util method | d. | the String
method |
|
|
4.
|
Programs should use
__________________ identifiers.
a. | class | b. | methods | c. | consistent | d. | self-commenting |
|
|
5.
|
Control structures and block structure need to use
a __________________ indentation style.
a. | consistent | b. | self-commenting | c. | methods | d. | class |
|
|
6.
|
Specific tasks should
be placed in modules called _______________.
a. | self-commenting | b. | methods | c. | consistent | d. | class |
|
|
7.
|
Similar methods
accessing the same data should be placed in a __________________.
a. | self-commenting | b. | consistent | c. | methods | d. | class |
|
|
8.
|
Which of the following is true?
a. | A method can be BOTH a void method and a
class method. | b. | A method can be
BOTH a void method and a return method. | c. | A method can be BOTH a return method and a class
method. | d. | A method can be BOTH a return method and a
return method. | e. | All of the
above |
|
|
9.
|
It is not possible to create large, reliable
programs without being very conscious of _________________.
a. | program design | b. | graphics | c. | sound | d. | coloring |
|
|
10.
|
Which one of the following is NOT a trigonometric methods of the Math
class.
|
|
11.
|
Was it possible for the designers of Java to anticipate every need for
every programmer?
|
|
12.
|
Graphical output to the monitor requires the use of a _____________________
object.
a. | Graphics | b. | System | c. | out | d. | Util |
|
|
13.
|
According to Object Oriented Design, common methods
should be placed in a ________________.
|
|
14.
|
Which one is NOT an
important rules for using methods with parameters.
a. | The number of parameters in the method call must match
the number of parameters in the method heading.
| b. | The corresponding actual parameters in the method call must be the same type
as the formal parameters in the heading.
| c. | The sequence of
the actual parameters in the method call must match the sequence of the parameters in the
heading.
| d. | The actual
parameter identifiers in the method call may be the same identifier or a different identifier as the
formal parameters in the heading.
| e. | The corresponding
actual parameters in the class must be a different type than the formal
parameters. |
|
|
15.
|
Can the actual parameter identifiers be the
different from as the formal parameter identifiers?
|
|
16.
|
Can the actual parameter identifiers be the same as
the formal parameter identifiers?
|
|
17.
|
If a method has several parameters, do they all
need to be of the same type?
|
|
18.
|
Does parameter
sequence matter?
|
|
19.
|
All method declarations have an identifier followed by
_____________________.
a. | a period | b. | parentheses | c. | quotations | d. | semicolons |
|
|
20.
|
The key difference between creating parameter
methods and non-parameter methods is the ___________________________.
a. | parameter declaration | b. | variable
declaration |
|
Matching: Match the answers with the matching definition.
|
|
|
a. | if a variable is only used by one method, it should be
declared inside that method as a local variable. | b. | Variables that are declared inside a method or block.
| c. | Variables that are only accessible inside the method or
block that they are defined | d. | They are
accessible by any method of the class. | e. | Variables that are
declared inside a class, but outside any method | f. | Attributes | g. | if a variable is
used by 2 or more methods of a class, it should be declared as a class
variable. | h. | for the program
sequence |
|
|
21.
|
What is a local variable?
|
|
22.
|
Where are local variables
accessible?
|
|
23.
|
What are class variables?
|
|
24.
|
Where are class variables
accessible?
|
|
25.
|
Class variables are also called
what?
|
|
26.
|
When should a variable be declared as a local
variable?
|
|
27.
|
When should a variable be declared as a class
variable?
|
|
28.
|
What is the driving class responsible
for?
|