多选题下面关于进程、线程的说法正确的是______。 A.进程是程序的一次动态执行过程。一个进程在其执行过程中,可以产生多个线程——多线程,形成多条执行线索。 B.线程是比进程更小的执行单位,是在一个进程中独立的控制流,即程序内部的控制流。线程本身不能自动运行,栖身于某个进程之中,由进程启动执行。 C.Java多线程的运行与平台相关。 D.对于单处理器系统,多个线程分时间片获取CPU或其他系统资源来运行。对于多处理器系统,线程可以分配到多个处理器中,从而真正的并发执行多任务。
多选题What line will produce a compiler error?
A. double[][] numbers;
B. double[][][] numbers;
C. double[][] numbers = {{1,2,3},{7,8,9},{4,5,6}};
D. double[][] numbers = {{1,2,3},{7,8},{4,5,6,9}};
E. double[][][] numbers = new double[7][][];
F. double[][][] numbers = new double[][][];
G. double[][][] numbers = new double[7][3][2];
多选题Given: String tenCharString = "AAAAAAAAAA";
System.out.println(tenCharString.replace("AAA", "LLL"));
What is printed to the standard out?
A. AAAAAAAAAA
B. LLLAAAAAAA
C. LLLLLLLLLA
D. LLLLLLLLLL
多选题Given the SampleClass, what is the output of this code
segment? SampleClass s = new SampleClass();
SampleClass.sampleMethodOne(); public class SampleClass
{ public static void sampleMethodOne() {
sampleMethodTwo();
System.out.println("sampleMethodOne"); }
public void sampleMethodTwo() {
System.out.println("sampleMethodTwo"); } }
A. sampleMethodOne
B. sampleMethodTwo
C. sampleMethodOne sampleMethodTwo
D. sampleMethodTwo sampleMethodOne
E. Compiler error
多选题What is the value of the size variable at the completion of this code
segment? ArrayList <Object> sampleArrayList = new ArrayList
<Object>(); sampleArrayList.add(new Object());
sampleArrayList.ensureCapacity(15); sampleArrayList.add(new
Object()); int size = sampleArrayList.size();
A. 0
B. 1
C. 2
D. 10
E. 15
F. A compile time error will be generated.
G. A runtime exception will be thrown.
多选题Which is not a type of statement?
A. Conditional statement
B. Assignment statement
C. Iteration statement
D. Propagation statement
多选题What is the correct way to create an array with five int data types?
(Choose all that apply.)
A. int intArray = new int[5];
B. int intArray = new int(5);
C. int[] intArray = new int[5];
D. int intArray[] = new int [5];
多选题Which two command-line invocations of the Java interpreter return the
version of the interpreter?
A. java -version
B. java --version
C. java -version ProgramName
D. java ProgramName -version
多选题What is the output of the following code segment?
Integer[] integerArray1 = {new Integer(100), new Integer(1), new Integer(30), new Integer (50)};
Integer[] integerArray2 = new Integer[2];
integerArray2[0] = new Integer(100);
System.arraycopy(integerArray1, 2, integerArray2, 1, 1);
for(Integer i : integerArray2) {
System.out.print(i+" ");
}
A. 100 1 30 50
B. 100 1
C. 100 30
D. 100 1 30
E. 600 1
F. 600 30
G. 600 1 30
H. A compile time error will be generated.
I. A runtime exception will be thrown.
多选题Which indexOf method declaration is invalid?
A. indexOf(int ch)
B. indexOf(int ch, int fromlndex)
C. indexOf(String str, int fromlndex)
D. indexOf(CharSequence str, int fromlndex)
多选题The JCheckBox and JComboBox classes belong to which package?
A. java.awt
B. javax.awt
C. java.swing
D. javax.swing
多选题What is the output of the following code segment?
String[] numbers = {"One" "'Two", "Three"}; for(String s :
numbers){ System.out.print(s+" "); }
A. One Two Three
B. Three Two One
C. A compile time error will be generated.
D. A runtime exception will be thrown.
多选题Given the following line of code, what lines below are valid? (Choose
all that apply.) enum Sports {FOOTBALL, BASKETBALL, BASEBALL,
TRACK}
A. Sports sport = FOOTBALL;
B. Sports sport = Sports.FOOTBALL;
C. Sports sport = Sports.HOCKEY;
D. Sports sport = 'TRACK'
多选题Which of the following statements will not compile?
A. if(true);
B. if(true) {}
C. if(true) {;}
D. if(true) {;;}
E. if(true); {};
F. All statements will compile.
多选题What is the value of the variable sum at the end of this code segment?
int[][] square=new int[3][3];
for(int i=0;i<3;i++) {
square[i][i]=5;
}
int sum=0;
for(int i=0;i<3;i++) {
for(int j=0;j<3;j++) {
sum+=square [i][j];
}
}
A. 0
B. 5
C. 10
D. 15
E. 20
F. 25
G. 30
H. 35
I. 40
J. 45
K. 50
L. It will generate a compiler error.
多选题What is the result of using a method of an uninitialized object?
A. Null is returned.
B. The object is automatically initialized and an appropriate value is
returned.
C. A NullPointerException is thrown from the Java Virtual Machine.
多选题Given: System.out.print(3+3+"3");
System.out.print("and"); System.out.println("3"+3+3);
What will be printed to standard out?
A. 333 and 333
B. 63 and 63
C. 333 and 63
D. 63 and 333
多选题What lines will compile without errors? (Choose all that apply.)
A. Object obj = new Object();
B. Object[] obj = new Object();
C. Object obj[] = new Object();
D. Object[] obj = new Object[];
E. Object[] obj = new Object[3]();
F. Object[] obj = new Object[7];
G. Object obj[] = new Object[];
H. Object obj[] = new Object[3]();
I. Object obj[] = new Object[7];
J. Object[8] obj = new Object[];
K. Object[3] obj = new Object[3]();
L. Object[7] obj = new Object[7];
M. Object obj[] = new {new Object(), new Object()};
N. Object obj[] = {new Object(), new Object()};
O. Object obj[] = {new Object[1], new Object[2]};
多选题Static methods have access to which of the following? (Choose all that
apply.)
A. Static variables
B. Instance variables
C. Standard methods
D. Static Methods
E. None of the above
多选题When apply naming conventions, which Java elements should start with a
capital letter and continue on using the camel case convention?
A. Class names
B. Interface names
C. Constant names
D. Package names
E. All of the above
