北京宇信易诚科技有限公司招聘 JAVA 笔试真题及答案
选择题
1:鉴于 Java 的特点,它最适合的计算环境是 b
A.并行计算环境
B.分布式计算环境
C.高强度计算环境
D.开放式计算环境
2:Which method you define as the starting point of new thread in a class from which new the thread
can be excution? b
A.public void start()
B.public void run()
C.public void runnable()
D.public static void main(String args[])
3:Which statement about listener is true? A 什么是 Listener
A.Most component allow multiple listeners to be added.
B.If multiple listener be add to a single component, the event only affected one listener.
C.Component don?t allow multiple listeners to be add.
D.none
4:软件生命周期的瀑布模型把软件项目分为 3 个阶段、8 个子阶段,以下哪一个是正常的开发顺序? a
A.计划阶段、开发阶段、运行阶段
B.设计阶段、开发阶段、编码阶段
C.设计阶段、编码阶段、维护阶段
D.计划阶段、编码阶段、测试阶段
5: b
be
printed
when
you
execute
the following
code?
new Y();
=
System.out.print("X");
{
}
X
Y
b
X()
1. What will
2.
3. class
4. {
5.
6.
7.
8.
9.
10. }
11.
12. class
13. {
14.
15.
16.
Y
Y()
{
System.out.print("Y");
{
}
Y
Z()
17.
18. }
19.
20. public
21. {
22.
23.
24.
25.
26.
27.
28.
29.
30.
31. }
32.
33. Choices:
}
{
}
class
Z
extends
X
y
=
new
Y();
System.out.print("Z");
public
static
void
main(String[]
args)
new
Z();
A.Z
B.YZ
C.XYZ
D.YXYZ
6: c
world”);
){
method(
method:
following
void
a,b;
String(“hello
String(“game
1. Give the
public
2.
String
3.
a=new
4.
b=new
5.
System.out.println(a+b+”ok”);
6.
a=null;
7.
a=b;
8.
System.out.println(a);
9.
10.
}
11. In
absence of
compiler
over”);
the
object
a
refered
is
definitely
elibile
A.before line 5
B.before line 6
optimization,
which
be
to
the
is
garbage collection.
earliest
point
the
C.before line 7
D.before line 9
7: c
1. Which
is
the
most appropriate
code
snippet that
can
be
inserted
at
line
18
in
the
following
code?
that
the
code is
compiled
and
run with
assertions
enabled)
import
public
{
2.
3. (Assume
4.
5. 1.
6.
7. 2.
8.
9. 3.
10.
11. 4.
12.
13. 5.
14.
15. 6.
16.
17. 7.
18.
19. 8.
20.
21. 9.
22.
23. 10.
24.
25. 11.
26.
27. 12.
28.
29. 13.
30.
31. 14.
32.
33. 15.
34.
35. 16.
36.
37. 17.
java.util.*;
class
AssertTest
private
HashMap
cctld;
public
AssertTest()
{
}
cctld
=
new
HashMap();
cctld.put("in", "India");
cctld.put("uk", "United
Kingdom");
cctld.put("au", "Australia");
//
more
code...
//
other
methods
....
public
String
getCountry(String
countryCode)
{
//
What
should
be
inserted
here?
String
country =
(String)cctld.get(countryCode);
return
country;
38.
39. 18.
40.
41. 19.
42.
43. 20.
44.
45. 21.
46.
47. 22.
}
}
A.assert countryCode != null;
B.assert countryCode != null : "Country code can not be null" ;
C.assert cctld != null : "No country code data is available";
D.assert cctld : "No country code data is available";
8:Which declares for native method in a java class corrected? b
A.public native void method(){}
B.public native void method();
C.public native method();
D.public void native method();
9: d
be
the
result
of
executing
the
following
code?
char
for
{
1. What will
2.
3. public
4. {
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
static
void main(String
args[])
digit
=
'a';
(int
i
=
0;
i
<
10;
i++)
(digit)
switch
{
'x'
:
case
{
j
=
int
System.out.println(j);
0;
}
default
:
{
int
100;
System.out.println(j);
j
=
16.
17.
18.
19.
20.
21.
22.
23.
24. }
25.
26. Choices:
}
}
}
int
System.out.println(i);
j;
i
=
A.100 will be printed 11 times.
B.The code will not compile because the variable i cannot be declared twice within the main()
method.
C.The code will not compile because the variable j cannot be declared twice within the switch
statement.
D.None of these.
10:Which modifier should be applied to a method for the lock of object this to be obtained prior
to excution any of the method body? a
A.synchronized
B.abstract
C.final
D.static
11: b
class
Example{
int x;
1. Give this
2. class
3. private
4. //rest
5. }
6. Assuming that
of
class
x
e
x
be
directly
outline:
body…
invoked
by
accessible
the
in
code
main()
java
Example,
which
statement
can mad
method
of
Example.java?
A.Change private int x to public int x
B.change private int x to static int x
C.Change private int x to protected int x
D.change private int x to final int x
12: d
code:
Example{
following
class
static
1. Give the
2. public
3. public
4. int
5. do{
6. System.out.println(“Doing
7. }while(--l>0)
8. System.out.println(“Finish”);
9. }
10. }
11. Which
well
be
output:
void main(String
args[]
){
l=0;
it
for
l
is:”+l);
A.Doing it for l is 3
B.Doing it for l is 1
C.Doing it for l is 2
D.Doing it for l is 0
13:Use the operator “>>” and “>>>”. Which statement is true? b
A.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 0000 1010 0000 0000 0000 0000 0000 0000
B.1010 0000 0000 0000 0000 0000 0000 0000 >> 4 give 1111 1010 0000 0000 0000 0000 0000 0000
C.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 0000 0000 0000 0000 0000 0000 0000 0000
D.1010 0000 0000 0000 0000 0000 0000 0000 >>> 4 give 1111 1010 0000 0000 0000 0000 0000 0000
14:Which statements about Java code security are not true? a
A.The bytecode verifier loads all classes needed for the execution of a program.
B.Executing code is performed by the runtime interpreter.
C.At runtime the bytecodes are loaded, checked and run in an interpreter.
D.The class loader adds security by separating the namespaces for the classes of the local
file system from those imported from network sources.
15: b
1. What will
happen
when you
attempt
to
compile
and run
the
following
code?
Base
=
99;
void amethod()
System.out.println("Base.amethod()");
}
Base()
amethod();
}
class
Derived
extends
Base
=
-1;
static
void main(String
argv[])
i
2.
3. class
4.
5. {
6.
7. int
8.
9. public
10.
11. {
12.
13.
14.
15.
16.
17.
18.
19. {
20.
21.
22.
23.
24.
25. }
26.
27. public
28.
29. {
30.
31. int
32.
33.
34.
35. public
36.
37. {
38.
i
Base
b
=
new
Derived();
System.out.println(b.i);
b.amethod();
}
public
void
amethod()
System.out.println("Derived.amethod()");
}
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49. {
50.
51.
52.
53.
54.
55. }
56.
57. Choices:
A.Derived.amethod() -1 Derived.amethod()
B.Derived.amethod() 99
C.Compile time error
D.Derived.amethod()
简答题
16:写 clone()方法时,通常都有一行代码,是什么?
Super.clone()
17:整数转换为字符串。
int MyInt = 1234;
String MyString = "" + MyInt;
18:不用中间变量,实现 int a,b 的交换。
Int a , b ;
a = a+b;
b = a-b;
a = a-b;