阿里巴巴(中国)网络技术有限公司 面试 笔试
更新时间:2023-08-29 18:34:01 阅读量: 教育文库 文档下载
选择题
1: 1. What will happen when you attempt to compile and run the following code?
2.
3. class Base
4.
5. {
6.
7. int i = 99;
8.
9. public void amethod()
10.
11. {
12.
13. System.out.println("Base.amethod()");
14.
15. }
16.
17. Base()
18.
19. {
20.
21. amethod();
22.
23. }
24.
25. }
26.
27. public class Derived extends Base
28.
29. {
30.
31. int i = -1;
32.
33.
34.
35. public static void main(String argv[])
36.
37. {
38.
39. Base b = new Derived();
40.
41. System.out.println(b.i);
43. b.amethod();
44. 45. } 46.
47. public void amethod()
48.
49. {
50.
51. System.out.println("Derived.amethod()");
52.
53. }
54.
55. }
56.
57. Choices:
A.Derived.amethod() -1 Derived.amethod()
B.Derived.amethod() 99
http://www.77cn.com.cnpile time error
D.Derived.amethod()
2: 1. Which is the most appropriate code snippet that can be inserted at line 18 in the follo
wing 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()
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";
3:
1. What will be the result of executing the following code?
2. boolean a = true;
3. boolean b = false;
4. boolean c = true;
5. if (a == true) 6. if (b == true)
7. if (c == true) System.out.println("Some things are true in this world");
8. else System.out.println("Nothing is true in this world!");
9. else if (a && (b = c)) System.out.println("It's too confusing to tell what is true and what is false");
10. else System.out.println("Hey this won't compile");
11.
12. Choices: A.The code won't compile
B."Some things are true in this world" will be printed
C."Hey this won't compile" will be printed
D.None of these
4:A class design requires that a member variable should be accessible only by same package, which modifer word should be used?
A.protected
B.public
C.no modifer
D.private
5:Which is the main() method return of a application?
A.String
B.byte
C.char
D.void
6:在软件生命周期中,下列哪个说法是不准确的?
A.软件生命周期分为计划、开发和运行三个阶段
B.在计划阶段要进行问题焉醛和需求分析
C.在开发后期要进行编写代码和软件测试
D.在运行阶段主要是进行软件维护
7: 1. Given the following class definition: 2. class A{
3. protected int i;
4. A(int i){
5. this.i=i; 6. }
7. }
8. which of the following would be a valid inner class for this class?
9. Select valid answer:
A.class B{ }
B.class B extends A{ }
C.class B extends A{ B(){System.out.println(“i=”+i);} }
D.class B{ class A{} }
8: 1. String s=”Example String”;Which operation is not legal? A.int i=s.length();
B.s[3]=”x”;
C.String short_s=s.trim();
D.String t=”root”+s;
9:Which fragments are not correct in Java source file?
A.package testpackage; public class Test{//do something...}
B.import java.io.*; package testpackage; public class Test{// do something...}
C.import java.io.*; class Person{// do something...} public class Test{// do something...}
D.import java.io.*; import java.awt.*; public class Test{// do something...}
10: Which of the following statements are true?
A.The automatic garbage collection of the JVM prevents programs from ever running out of memory
B.A program can suggest that garbage collection be performed and force it
C.Garbage collection is platform independent
D.An object becomes eligible for garbage collection when all references denoting it are set to null.
11: 1. What results from attempting to compile and run the following code? 2.
3. public class Ternary
4. 5. {
6.
7. public static void main(String args[])
8.
9. {
10. 11. int a = 5;
12.
13. System.out.println("Value is - " + ((a < 5) ? 9.9 : 9));
14.
15. }
16.
17. }
18.
19. Choices:
A.prints: Value is - 9
http://www.77cn.com.cnpilation error
C. prints: Value is - 5
D.None of these
12:
1. Give the following java source fragement:
2. //point x
3. public class Interesting{
4. //do something 5. }
6. Which statement is correctly Java syntax at point x? A.public class MyClass{//do other thing…}
B.static int PI=3.14
C.class MyClass{//do something…}
D.none
13: 1. What will happen when you attempt to compile and run the following code?
2.
3. (Assume that the code is compiled and run with assertions enabled.)
4.
5. public class AssertTest{
6.
7. public void methodA(int i){
8.
9. assert i >= 0 : methodB();
10.
11. System.out.println(i);
12.
13. }
14.
15. public void methodB(){
16.
17. System.out.println("The value must not be negative");
18.
19. }
20.
21. public static void main(String args[]){
22.
23. AssertTest test = new AssertTest();
24.
25. test.methodA(-10);
26.
27. }
28.
29. }
A.it will print -10
B.it will result in AssertionError showing the message-“the value must not be negative”.
C.the code will not compile.
D.None of these.
14: 1. Give the code fragment:
2. if(x>4){ 3. System.out.println(“Test 1”);}
4. else if (x>9){ 5. System.out.println(“Test 2”);}
6. else {
7. System.out.println(“Test 3”);}
8. Which range of value x would produce of output “Test 2”?
A.x<4
B.x>4
C.x>9
D.None
简答题 15:将某个文件从一个目录拷贝到另一个目录下(不能用C/C++中的函数或类)。
16:集群的优点和缺点?
17:编一个程序求质数的和例如F(7)=1+3+5+7+11+13+17=58
18:假设现有一个单向的链表,但是只知道只有一个指向该节点的指针p,并且假设这个节点不是尾节点,试编程实现删除此节点。
19:建立一个链表,每个结点包括:学号、姓名、性别、年龄,输入一个学号,如果链表中的结点包括该学号,则输出该结点内容后,并将其结点删去。
20:C/C++源代码中,检查花括弧“(”与 “)”,“{”与“}”)是否匹配,若不匹配,则输出不匹配花括弧所在的行与列。
21:请设计一个Java程序,程序中要进行数组操作和除法操作,要求对所设计的程序可能出现的异常进行处理。
22:Hashtable和HashMap的异同。
23:Write the function strend(s,t) , which returns 1 if the string t occurs at the end of the string s , and zero otherwise.
24:请说出你所知道的线程同步的方法。
25:Is Tomcat faster than serving static HTML pages than Apache httpd?
正在阅读:
《光纤通信》试卷题及答案04-17
合肥市滨湖新区建设管理委员会04-15
2015造价案例真题 - 图文11-05
2013年江苏省苏州市中考语文试题及答案解析(word)08-25
毕业论文:第三方支付机构商业模式比较研究05-12
软件编程实训1 指导书05-13
基于双模板协同共组装新策略的纳米仿生骨材料的可控制备研究04-28
仁爱英语八年级阅读理解测试题和答案08-26
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- 阿里巴巴
- 笔试
- 中国
- 网络技术
- 面试
- 有限公司
- 2016-2022年中国金针菇行业市场分析及发展策略研究报告
- 东大导师介绍及联系方式
- 学生党员个人总结
- 2009_深圳_最佳策划项目比赛_三湘海尚
- Excel在财务管理中的应用实验报告
- 第四章 输入输出与顺序程序设计练习题
- 2016年对外经济贸易大学金融硕士金砖考研真题396经济类联考综合考研全真模拟考研分数线考研参考书1
- QCT203-1995 矿用自卸汽车驾驶室噪声测量方法及限值
- 中医外科学三基试题
- 德克萨斯
- 语篇翻译中的衔接与连贯
- 2014年04月04日浙江省今日生猪价格行情
- 中国农村可再生能源发展背景研究报告
- 广西壮族自治区政府非税收入管理条例
- 2010年会计实务问题解答汇编
- 中国历史朝代
- 酒店部门英语名称
- 电功率_电动机效率_输电
- 奢侈品品牌等级划分
- 三亚会计培训低值易耗品五五摊销法完整的账务处理