
- •Import java.Util.*;
- •II and III only
- •I and II only
- •24) Consider the following uml class diagram.
- •25) Consider the following uml class diagram.
- •II only
- •30) Consider the following class definitions.
- •III only
- •I and II only
- •II only
- •I and III only
- •II and III only
- •I and II only
- •I and III only
- •II only
- •I and III only
1) Which of the following statements imports the entire package java.util into a Java program?
Import java.Util.*;
2) Which of the following operators can be used to concatenate two String objects in Java?
+
3) Delimiters for the class java.util.StringTokenizer can include which of the following?
,
_
"
I, II, and III
4) Which of the following streams typically correspond(s) to screen output?
System.in
System.out
System.err
II and III only
5) Consider the following Java statement.
private static java.io.PrintWriter stdOut = new java.io.PrintWriter(System.out, true);
At the end of execution of the Java statement, a call to stdOut.println() would result in which of the following?
Output of a new line character
Flushing of the output buffer
I and II
6) Consider an object stdIn instantiated by the Java statement below.
private static java.io.BufferedReader stdIn = new java.io.BufferedReader( new java.io.InputStreamReader(System.in));
Which of the following lines of code can be used to read an integer value from stdIn?
int value = Integer.parseInt(stdIn.readLine());
7) In Java, which of the following classes is (are) unchecked exceptions?
Error
Runtime
IOException
I and II only
8) Consider the following Java program fragment whose lines have been numbered.
1 2 try { 3 4 } catch (Exception e) { 5 6 }
Code that may throw exceptions should appear on line _____, while code that handles exceptions should appear on line _____.
3, 5
9) If a(n) _____ exception can occur in a method that does not have a catch block to handle that exception, then a throws clause that lists this exception must be part of the method _____.
checked, header
10) Which of the following is a Java statement that could be used to throw an IOException?
throw new IOException();
11) After a breakpoint is hit, a debugger is typically used for which of the following tasks?
I, II, and III
12) When using a debugger to step through a program, if the current line contains a method call, which of the following executes the current line and then stops execution before executing the first line in the called method?
step into
13) Which of the following is true regarding Java applications?
They are run using a Java interpreter.
14) Which of the following is (are) architecture neutral?
Java byte code
Machine code
I only
15) Which of the following identifiers follow(s) Sun's naming conventions for Java constants?
START_DATE
Serving_Size
AnnualFee
I only
16) Which of the following identifiers follow(s) Sun's naming conventions for Java variables?
myvalue
myValue
my_value
II only
17) Which of the following follow(s) Sun's naming conventions for Java methods?
getValue();
GetValue();
GET_VALUE();
I only
18) Which of the following lines follow(s) Sun's guidelines for documenting input parameters in a Javadoc comment?
* @param foo the value to be tested
* @param int foo
* @param the value to be tested
I only
19) Which of the following lines follow(s) Sun's guidelines for documenting the return value in a Javadoc comment?
* @return foo the result of the calculations
* @return the result of the calculations
* @return int foo the result of the calculations
II only
20) If a Java class contains a Boolean variable named rhodesScholar, then the name of the associated accessor method should be
isRhodesScholar
21) Which of the following can be represented in a UML class diagram?
Class name
Class attributes
Class methods
I, II, and III
22) Consider the following UML class diagram with numbered compartments.
1 |
2 |
3 |
Following UML specifications, a private method toggle() would be represented by the element _____ in compartment _____.
-toggle(), 3
23) Consider the following UML class diagram.
The diagram describes a(n) _____ association.
binary