新华信国际信息咨询JAVA工程师笔试题
选择题
1:Which statement about the garbage collection mechanism are true?
A.Garbage collection require additional programe code in cases where multiple threads are running.
B.The programmer can indicate that a reference through a local variable is no longer of interest.
C.The programmer has a mechanism that explicity and immediately frees the memory used by Java objects.
D.The garbage collection mechanism can free the memory used by Java Object at explection time.
2:
Given:
1. public class test (
2. public static void main (String args[]) {
3. int i = 0xFFFFFFF1;
上海龙凤1314 shlf 4. int j = ~i;
5.
6. }
7. )
What is the decimal value of j at line 5?
Given:
1. public class test (
2. public static void main (String args[]) {
上海龙凤1314 shlf 3. int i = 0xFFFFFFF1;
上海龙凤1314 shlf 4. int j = ~i;
5.
6. }
7. )
What is the decimal value of j at line 5?
A.0
B.1
C.14
D.-15
3:
What happens when you try to compile and run the following program?
class Mystery{
String s;
public static void main(String[] args){
Mystery m=new Mystery();
m.go();
}
上海龙凤1314 shlf void Mystery(){
s=”constructor”;
}
上海龙凤1314 shlf void go(){
System.out.println(s);
}
}
What happens when you try to compile and run the following program?
class Mystery{
String s;
public static void main(String[] args){
上海龙凤1314 shlf Mystery m=new Mystery();
m.go();
}
void Mystery(){
s=”constructor”;
}
上海龙凤1314 shlf void go(){
System.out.println(s);
}
}
A.this code compliles but throws an exception at runtime
B.this code runs but nothing appears in the standard output
C.this code runs and “constructor” in the standard output
D.this code runs and writes ”null” in the standard output
4:
上海龙凤1314 shlf public class X{
public Object m(){
Object o = new Float(3.14F);//line 3
上海龙凤1314 shlf Object [] oa = new Object[1];//line 4
上海龙凤1314 shlf oa[0] = o;//line 5
o=null;//line 6
上海龙凤1314 shlf return oa[0];//line 7
}
}
When is the Float object, created in line 3,eligible for garbage collection?
public class X{
上海龙凤1314 shlf public Object m(){
Object o = new Float(3.14F);//line 3
Object [] oa = new Object[1];//line 4
oa[0] = o;//line 5
上海龙凤1314 shlf o=null;//line 6
return oa[0];//line 7
}
}
When is the Float object, created in line 3,eligible for garbage collection?
上海龙凤1314 shlf A.just after line 5.
B.just after line 6
上海龙凤1314 shlf C.just after line 7(that is,as the method returns)
上海龙凤1314 shlf D.never in this method
5:
下述程序代码中有语法错误的行是( ),
新华信国际信息咨询JAVA工程师笔试题
,资料共享平台
《新华信国际信息咨询JAVA工程师笔试题》(http://gdyhdog.com)。上海龙凤1314 shlf int i,ia[10],ib[10]; /*第一行*/
上海龙凤1314 shlf for (i=0;i<=9;i++) /*第2行*/
ia[i]=0; /*第3行*/
ib=ia; /*第4行*/
下述程序代码中有语法错误的'行是( )。
int i,ia[10],ib[10]; /*第一行*/
上海龙凤1314 shlf for (i=0;i<=9;i++) /*第2行*/
上海龙凤1314 shlf ia[i]=0; /*第3行*/
上海龙凤1314 shlf ib=ia; /*第4行*/
A.第1行
B.第2行
C.第3行
D.第4行
6:
public class OuterClass {
private double d1 = 1.0;
上海龙凤1314 shlf //insert code here
}
You need to insert an inner class declaration at line 3. Which two inner class declarations are
valid?
public class OuterClass {
上海龙凤1314 shlf private double d1 = 1.0;
//insert code here
}
上海龙凤1314 shlf You need to insert an inner class declaration at line 3. Which two inner class declarations are
valid?
A.class InnerOne{ public static double methoda() {return d1;} }
B.public class InnerOne{ static double methoda() {return d1;} }
上海龙凤1314 shlf C.private class InnerOne{ double methoda() {return d1;} }
上海龙凤1314 shlf D.static class InnerOne{ protected double methoda() {return d1;} }
7:假定a和b为int型变量,则执行下述语句组后,b的值为
a=1;
b=10;
do
{
b-=a;
a++;
} while (b--<0);
A.9
B.-2
C.-1
上海龙凤1314 shlf【新华信国际信息咨询JAVA工程师笔试题】相关文章:
6.java笔试题
8.凯捷咨询笔经