选择题
1:在软件生命周期中,下列哪个说法是不准确的?
A.软件生命周期分为计划、开发和运行三个阶段
B.在计划阶段要进行问题焉醛和需求分析
C.在开发后期要进行编写代码和软件测试
D.在运行阶段主要是进行软件维护
2:
Which is the most appropriate code snippet that can be inserted at line 18 in the following code? (Assume that the code is compiled and run with assertions enabled)
1. import java.util.*;
2.
3. public class AssertTest
4. {
5. private HashMap cctld;
6.
7. public AssertTest()
8. {
9. cctld = new HashMap();
10. cctld.put("in", "India");
11. cctld.put("uk", "United Kingdom");
12. cctld.put("au", "Australia");
13. //
14. }
16. public String getCountry(String countryCode)
17. {
18. // What should be inserted here?
19. String country = ((countryCode);
20. return country;
java就业课程培训21. }
22. }
Which is the most appropriate code snippet that can be inserted at line 18 in the following code? (Assume that the code is compiled and run with assertions enabled)
1. import java.util.*;
2.
3. public class AssertTest
4. {
5. private HashMap cctld;
6.
7. public AssertTest()
8. {
9. cctld = new HashMap();
10. cctld.put("in", "India");
11. cctld.put("uk", "United Kingdom");
12. cctld.put("au", "Australia");
14. }
15. // other methods ....
16. public String getCountry(String countryCode)
17. {
18. // What should be inserted here?
19. String country = ((countryCode);
20. return country;
21. }
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";
3:
Give the following code:
public class Example{
public static void main(String args[] ){
int l=0;
do{
System.out.println(“Doing it for l is:”+l);
}while(--l>0)
System.out.println(“Finish”);
}
}
Which well be output:
Give the following code:
public class Example{
public static void main(String args[] ){
int l=0;
do{
System.out.println(“Doing it for l is:”+l);
}while(--l>0)
System.out.println(“Finish”);
}
}
Which well be output:
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
4:
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 acces sible in main() method of Example.java?
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
C.Change private int x to protected int x
D.change private int x to final int x
5:Which of the following statements are not legal?
A.long l = 4990;
B.int i = 4L;
C.double d = 34.4;
D.double t = 0.9F.
6:鉴于Java的特点,它最适合的计算环境是
A.并行计算环境
B.分布式计算环境
C.高强度计算环境
D.开放式计算环境
7:What is written to the standard output given the following statement:System.out.println(4|7); Select the right answer:
A.4
B.5
C.6
D.7
8:
1. public class X {
2. public object m () {
3. object o = new float (3.14F);
4. object [] oa = new object [1];
5. oa[0]= o;
6. o = null;
7. oa[0] = null;
9. }
10.}
When is the float object created in line 3, eligible for garbage collection?
1. public class X {
2. public object m () {
3. object o = new float (3.14F);
4. object [] oa = new object [1];
5. oa[0]= o;
6. o = null;
7. oa[0] = null;
9. }
10.}
When is the float object created in line 3, eligible for garbage collection?
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论