多选题The ArrayList class is part of what Java package?
A. java.lang
B. java.util
C. javax.tools
D. javax.swing
多选题下面关于外部类和内部类成员的相互访问的规则中,正确的选项是( )。 A.内部类可以直接访问外部类的成员 B.外部类可以直接访问内部类的成员 C.外部类不能访问内部类的成员 D.外部类可通过创建内部类的实例来访问内部类的成员
多选题线程对象的生命周期中,通常经历下面哪些状态( )。 A.新建 B.运行 C.就绪 D.死亡
多选题What is the output of the following code segment?
int[] testScores = {80,63,99,87,100};
System.out.println("Length: " + testScores.length);
A. Length: 4
B. Length: 5
C. Length: 100
D. A compile time error will be generated.
E. A runtime exception will be thrown.
多选题TheDrivableinterface:publicinterfaceDrivable{/**Drivabledefinitions*/}TheTractorclass:publicclassTractorimplementsDrivable{/**Tractorfunctionality*/}TheVehicleclass:publicclassVehicle{/**Vehiclefunctionality*/}TheCarclass:publicclassCarextendsVehicleimplementsDrivable{/**Carfunctionality*/}TheTruckclass:publicclassTruckextendsVehicleimplementsDrivable{/**Truckfunctionality*/}UMLforquestions
多选题Given x is declared with a valid integer, which conditional statement
will not compile?
A. if(x == 0) {System.out.println("True Statement");}
B. if(x == 0) {System.out.println("False Statement");}
C. if(x == 0) {;} elseif(x == 1){System.out.println("Valid
Statement");}
D. if(x == 0); else if(x == 1){} else {;}
多选题A switch statement works with which wrapper class/reference type(s)?
A. Character
B. Byte
C. Short
D. Int
多选题Which of the following variables are being set with the use of a
literal? (Choose all that apply.)
A. int tvChannel = 4;
B. char c = '5';
C. chard = '/u0123';
D. char e = c;
E. int oldChannel = tvChannel;
多选题You need to create an application that is used to calculate the
attendance at a baseball game. What data type would be most appropriate for
storing the attendance?
A. boolean
B. char
C. float
D. int
多选题Which package contains the Java Collections Framework?
A. java.io
B. java.net
C. java.util
D. java.utils
多选题Which statements correctly declare boolean variables?
A. Boolean isValid = true;
B. boolean isValid = TRUE;
C. boolean isValid = new Boolean(true);
D. boolean isValid = 1;
多选题What constructor is equivalent to the one listed here?
public SampleConstructor( {
System.out.println("SampleConstructor"); }
A. public SampleConstructor() { this();
System.out.println("Sample Constructor"); }
B. public SampleConstructor() { super();
System.out.println("Sample Constructor"); }
C. public SampleConstructor() { this.SampleConstructor();
System.out.println("Sample Constructor"); }
D. public SampleConstructor() {
super.SampleConstructor(); System.out.println("Sample
Constructor"); }
E. None of the above
多选题When instantiating an object with generics, should angle brackets, box
brackets, parentheses, or double-quotes be used to enclose the generic type?
Select the appropriate answer.
A. List <Integer> a = new ArrayList <Integer> ();
B. List [Integer] a = new ArrayList [Integer] ();
C. List {Integer} a = new ArrayList {Integer} ();
D. List "Integer" a = new ArrayList "Integer" ();
多选题Given: public class EqualityTests {
public static void main (String[] args) Integer value1 = new
Integer("312"); Integer value2 = new Integer ("312");
Object object1 = new Object(); Object object2 = new
Object(); Object object3 = value1; }
} Which expressions evaluate to true?
A. value1.equals (value2)
B. value1.equals (object1)
C. value1.equals (object3)
D. object1.equals (object2)
多选题What best describes the result of the following code segment? The
ArrayList sampleArrayList has already been declared and initialized.
int i = 63; sampleArrayList.add(i);
A. The int is successfully placed into the ArrayList.
B. The int is converted to an Integer via autoboxing and then placed into
the ArrayList.
C. null is placed into the ArrayList.
D. A compile time error will be generated.
E. A runtime exception will be thrown.
多选题 Use the following code example for the next four
questions: public class Client { Address
address; AccountNum[] accountNums; void
setAddress(Address newAddress) { address =
newAddress; } public Client() {
accountNums = new AccountNum[2]; accountNums[0] = new
AccountNum(); accountNums[1] = new AccountNum();
} }
多选题Given: public class ArithmeticResultsOutput
{ public static void main(String[] args) { int
i = 0; int j = 0; if(i++ == ++j)
System.out.println("True: i="+i+"'j="+j); } else
{ System.out.println("False: i="+i+"'j="+j);
} } } What will be printed to
standard out?
A. True: i=0, j=1
B. True: i=1, j=1
C. False: i=0, j=1
D. False: i=1, j=1
多选题Given the following Java code segment, what will be printed,
considering the usage of the modulus operators?
System.out.print(49 % 26 % 5 % 1);
A. 23
B. 3
C. 1
D. 0
多选题Which command-line usages appropriately set a system property value?
A. java -Dcom.ocajexam.propertyValue=003 MainClass
B. java -d com.ocajexam.propertyValue=003 MainClass
C. java -prop com.ocajexam.propertyValue=003 MainClass
D. java -D:com.ocajexam.propertyValue=003 MainClass
多选题Which statement is false about the toString method?
A. The toString method is a method of the Object class.
B. The toString method returns a string representation of the object.
C. The toString method must return the object's state information in the
form of a string.
D. The toString method is commonly overridden.
