多选题What type of statement is the following equation: y = (m*x)+b?
A. Conditional statement
B. Assignment statement
C. Assertion statement
D. Transfer of control statement
多选题Given: System.out.print(true | false System.out.println(false What will be printed to standard out?
A. true, true
B. true, false
C. false, true
D. false, false
E. Compilation error
多选题Given: public class BooleanResultsOutput {
public static void main(String[] args) { boolean
booleanValue1 = true; boolean booleanValue2 = false;
System.out.print(!(booleanValue1
System.out.print(!(booleanValue1 | !booleanValue2)+" ");
System.out.print(!(booleanValue1 ^ !booleanValue2));
} } What will be printed, considering the
usage of the logical Boolean operators?
A. false, false, true
B. false, true, true
C. true, false, true
D. true, true, true
多选题 Refer to this class for the following two
questions. public class Account { private int
money; public int getMoney() { return
this.money; } public void setMoney(int money)
{ this.money = money; }
}
多选题Given the class FloatNumber and method addHalf, what is the output if
the following code segment is executed? public class
FloatNumber { float number; public
FloatNumber(float number { this.number = number;
} floatgetNumber( { retum
number; } void setNumber(float number)
{ this.number = number; }
} void addHalf(FloatNumber value) {
value.setNumber(value.getNumber()+(value.getNumber()/2f));
} /* CODE SEGMENT */ FloatNumber value = new
FloatNumber(1f); addHalf(value);
System.out.println("value ="+value.getNumber());
A. value = 1
B. value = 1.5
C. value = 2
D. value = 0
多选题You are writing a class that will store the status of an on/off
switch. Which data type is most appropriate for storing this value?
A. boolean
B. char
C. short
D. int
多选题What is the output of the following code segment?
ArrayList <String> sampleArrayList = new ArrayList <String>();
sampleArrayList.add ("One"); sampleArrayList.add
("Two"); sampleArrayList.add (1, "Three");
for(String s : sampleArrayList) { System.out.print(s+"
"); }
A. One Two Three
B. One Three Two
C. Three One Two
D. One Three
E. Three Two
F. A compile time error will be generated.
G. A runtime exception will be thrown.
多选题Which API provides a lightweight solution for GUI components?
A. AWT
B. Abstract Window Toolkit
C. Swing
D. AWT and Swing
多选题Given the SampleClass, what is the value of currentCount for the
instance of object x after the code segment had be executed?
SampleClass x = new SampleClass(); SampleClass y = new
SampleClass(); x.increaseCount(); public class
SampleClass { private static int currentCount=();
public SampleClass() { currentCount++;
} public void increaseCount() {
currentCount++; } }
A. 0
B. 1
C. 2
D. 3
E. Compiler error
F. Runtime error
多选题When the void keyword is used, which of the following statements are true? (Choose all that apply.)
A. A return statement with a value following it must be used.
B. A return statement with a value following it can optionally be used.
C. A return statement with a value following it should never be used.
D. A return statement by itself must be used.
E. A return statement by itself can optionally be used.
F. A return statement by itself should never be used.
G. A return statement must be omitted.
H. A return statement can optionally be omitted.
I. A return statement should never be omitted.
多选题Given: public class Dinner { public
static void main (String[] args) { boolean
isKeeperFish = false; if (isKeeperFish = true) {
System.out.println("Fish for dinner"); } else
{ System.out.println("Take out for dinner");
} } } What will be the result
of the application's execution?
A. Fish for dinner will be printed.
B. Take out for dinner will be printed.
C. A compilation error will occur.
多选题Which set of operators represents the complete set of valid Java
assignment operators?
A. %=, &=, *=, $=, :=, /=, ^=, |=, +=, <<=, =, -=, >>=, >>>=
B. %=, &=, *=, /=, ^=, |=, +=, <<=, <<<=, =, -=, >>=, >>>=
C. %=, &=, *=, /=, ^=, |, +=, <<=, =, -=, >>=, >>>=
D. %=, &=, *=, $=, /=, ^=, |=, +=, <<=, <<<=, =, -=, >>=, >>>=
多选题What is wrong with the following method? public
double interestDue(double currentBalance, float interestRate) {
double interestDue = currentBalance * interestRate; return
interestDue; }
A. It should use all float primitives.
B. It should use all Float objects.
C. It should use all double primitives.
D. It should use all Double objects.
E. It should use BigDecimal objects.
F. Nothing is wrong with this method.
G. It does not compile because you cannot do math operations with primitives
that are not the same type.
多选题For standard situations what is typically the best type of array to
use?
A. ArrayList
B. One-dimensional array
C. Multi-dimensional array
多选题What is the best data type to use when storing a status code that may
have one of the following values: success, failed, success with errors, or
undetermined?
A. Object
B. Class
C. boolean
D. enum
E. int
多选题You need to update a value of a hash table (that is, HashMap) where
the primary key must equal a specified string. Which statements would you need
to use in the implementation of this algorithm?
A. Iteration statement
B. Expression statement
C. Conditional statement
D. Transfer of control statement
多选题下面关于java中输入/输出流的说法正确的是______。 A.FileInputStream与FileOutputStream类用读、写字节流。 B.Reader与Writer类用来读、写字符流。 C.RandomAccessFile既可以用来读文件,也可以用来写文件。 D.File类用来处理与文件相关的操作。
填空题线程的优先级在______至______之间,数值越大______。
填空题创建一个名为 MyPackage 的包的语句是______,该语句应该放在程序的位置为:______。
填空题在一个时间只能由一个线程访问的资源称为______。访问临界资源的代码______。
