北京宇信易诚科技有限公司招聘JAVA笔试真题及答案
北京宇信易诚科技有限公司招聘 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
1. What will be printed when you execute the following code?
2.
3. class X
4. {
5. Y b = new Y();
6. X()
7. {
8. System.out.print("X");
9. }
10. }
11.
12. class Y
13. {
14. Y()
15. {
16.
System.out.print("Y");
17. }
18. }
19.
20. public class Z extends X
21. {
22. Y y = new Y();
23. Z()
24. {
25. System.out.print("Z");
26. }
27. public static void main(String[] args)
28. {
29.
new Z();
30. }
31. }
32.
33. Choices:
A.Z
B.YZ
C.XYZ
D.YXYZ
6: c
1. Give the following method:
2. public void method( ){
3. String a,b;
4. a=new String(“hello world”);
5. b=new String(“game over”);
6. System.out.println(a+b+”ok”);
7. a=null;
8. a=b;
9. System.out.println(a);
10. }
11. In the absence of compiler optimization, which is the earliest point the object a refer
ed is definitely elibile to be garbage collection.
A.before line 5
B.before line 6
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 foll
owing code?
2.
3. (Assume that the code is compiled and run with assertions enabled)
4.
5. 1. import java.util.*;
6.
7. 2.
8.
9. 3. public class AssertTest
10.
11. 4. {
12.
13. 5.
private HashMap cctld;
14.
15. 6.
16.
17. 7.
public AssertTest()
18.
19. 8.
{
20.
21. 9.
cctld = new HashMap();
22.
23. 10.
cctld.put("in", "India");
24.
25. 11.
cctld.put("uk", "United Kingdom");
26.
27. 12.
cctld.put("au", "Australia");
28.
29. 13.
// more code...
30.
31. 14.
}
32.
33. 15.
// other methods ....
34.
35. 16.
public String getCountry(String countryCode)
36.
37. 17.
{
38.
39. 18.
// What should be inserted here?
40.
41. 19.
String country = (String)cctld.get(countryCode);
42.
43. 20.
return country;
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
1. What will be the result of executing the following code?
2.
3. public static void main(String args[])
4. {
5. char digit = 'a';
6.
for (int i = 0; i < 10; i++)
7. {
8.
switch (digit)
9.
{
10.
case 'x' :
11.
{
12.
int j = 0;
13.
System.out.println(j);
14.
}
15.
default :
16.
{
17.
int j = 100;
18.
System.out.println(j);
19.
}
20.
}
21. }
22. int i = j;
23. System.out.println(i);
24. }
25.
26. Choices:
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
1.
2.
3.
4.
5.
6.
Give this class outline:
class Example{
private int x;
//rest of class body…
}
Assuming that x invoked by the code java Example, which statement can made x be
directly accessible in main() method of Example.java?
A.Change private int x to public int x
B.change private int x to static int x
温馨提示:当前文档最多只能预览 5 页,此文档共10 页,请下载原文档以浏览全部内容。如果当前文档预览出现乱码或未能正常浏览,请先下载原文档进行浏览。
1 / 5 10