版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、1:what is written to the standard output given the following statement:system.out.println(4|7);select the right answer:a.4b.5c.6d.72:what will happen when you attempt to compile and run the following code? public class staticstaticint x = 5; static int x,y;public static void main(string args) x-; my
2、method(); system.out.println(x + y + +x); public static void mymethod()y = x+ + +x; choices:a.prints : 2b.prints : 3c.prints : 7d.prints : 83:which statements about java code security are not true?a.the bytecode verifier loads all classes needed for the execution of a program.b.executing code is per
3、formed 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.4:select valid identifier of java:a.%passwdb.3d_g
4、amec.$charged.this5:the following code is entire contents of a file called example.java,causes precisely one error during compilation: class subclass extends baseclass class baseclass() string str; public baseclass() system.out.println(“ok”); public baseclass(string s) str=s; public class example pu
5、blic void method() subclass s=new subclass(“hello”); baseclass b=new baseclass(“world”); which line would be cause the error? a.9b.10c.11d.126:use the operator “” and “”. which statement is true?a.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 1010 0000 0000 0000 0000 0000 0000b.1010 0000 0000
6、0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000c.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 0000 0000 0000 0000 0000 0000 0000d.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 00007:what results from attempting to compile and run the
7、 following code? public class ternarypublic static void main(string args)int a = 5;system.out.println(value is - + (a = 0 : methodb();system.out.println(i);public void methodb() system.out.println(the value must not be negative);public static void main(string args)asserttest test = new asserttest();
8、test.methoda(-10); a.it will print -10b.it will result in assertionerror showing the message-“the value must not be negative”.c.the code will not compile.d.none of these.13:what is the result when you compile and run the following code? public class test public void method()for(int i = 0; i 3; i+) s
9、ystem.out.print(i); system.out.print(i); choices:a.0122b.0123c.compilation errord.none of these14:what will be the result of executing the following code? public static void main(string args) char digit = a; for (int i = 0; i 100) break; b.for (;);c.int k=1000; do +k; while(k=10000);d.int s=36; whil
10、e (s);-s;简答题16:说说你对面向切面编程(aop)的理解。17:已知abc+cba=1333,其中a,b,c均为一位数,编程求出满足条件的a,b,c所有组合。18:描述一下jvm加载class文件的原理机制?19:struts2中转换器的实现原理?20:公元4046年,人类科学高度发达,绝大部分人都已经移居至浩瀚的宇宙,在上千颗可居住的星球上留下了人类的印记。然而,此时人类却分裂成了两个联盟:正义联盟和邪恶联盟。两个联盟之间仇恨难解,时有战争。现在,邪恶联盟通过不正当贸易积聚了大量宇宙财富。因此,正义联盟计划要破坏邪恶联盟的非法贸易网络,从而影响邪恶联盟的经济状况,为下一次战争作好准
11、备。邪恶联盟由数百颗星球组成,贸易通过星球间的运输航道来完成。一条运输航道是双向的且仅连接两个星球,但两个星球之间可以有多条航道,也可能没有。两个星球之间只要有运输航道直接或间接的相连就可以进行贸易。正义联盟计划破坏邪恶联盟中的一些运输航道,使得邪恶联盟的星球分成两部分,任一部分的星球都不能与另一部分的星球进行贸易。但是为了节省破坏行动所需的开支,正义联盟希望破坏尽量少的运输航道来达成目标。请问正义联盟最少需要破坏多少条运输航道呢?21:在一个正整数序列中求和最大的非相邻子序列(序列任两元素在原序列里都不相邻)22:how to use final to class,method and da
12、ta?23:硬盘上保存有一个密码表,文本文件格式,文件名为“code.txt”,内容如下:abcdefghijklmnopqrstuvwxyzushecginpaywdqmlxbozrtfvjk试编写程序实现一个简单的加密程序,循环读取用户输入,按此密码表将字符进行替换,并直接打印输出;例如“baidu”将被替换成“super”。1:what will happen when you attempt to compile and run the following code? public class staticstaticint x = 5; static int x,y;public s
13、tatic void main(string args) x-; mymethod(); system.out.println(x + y + +x); public static void mymethod()y = x+ + +x; choices:a.prints : 2b.prints : 3c.prints : 7d.prints : 82:what will happen when you attempt to compile and run the following code? int output = 10;boolean b1 = false; if(b1 = true)
14、& (output += 10) = 20) system.out.println(we are equal + output); else system.out.println(not equal! + output); choices:a.compilation error, attempting to perform binary comparison on logical data typeb.compilation and output of we are equal 10.c.compilation and output of not equal! 20.d.compilation
15、 and output of not equal! 10.3:consider the class hierarchy shown below:-class fourwheeler implements drivingutilitiesclass car extends fourwheelerclass truck extends fourwheelerclass bus extends fourwheelerclass crane extends fourwheeler-consider the following code below:1.drivingutilities du;2.fou
16、rwheeler fw;3.truck mytruck = new truck();4.du = (drivingutilities)mytruck;5.fw = new crane();6.fw = du;which of the statements below are true?choices:a.line 4 will not compile because an interface cannot refer to an object.b.the code will compile and run.c.the code will not compile without an expli
17、cit cast at line 6, because going down the hierarchy without casting is not allowed.d.the code will compile if we put an explicit cast at line 6 but will throw an exception at runtime.4:public class x public object m() object o = new float(3.14f);/line 3 object oa = new object1;/line 4 oa0 = o;/line
18、 5 o=null;/line 6 return oa0;/line 7 when is the float object, created in line 3,eligible for garbage collection?a.just after line 5.b.just after line 6c.just after line 7(that is,as the method returns)d.never in this method5: 1. public class x 2. public object m () 3. object o = new float (3.14f);
19、4. object oa = new object 1; 5. oa0= o; 6. o = null; 7. oa0 = null; 8.return o; 9. 10. when is the float object created in line 3, eligible for garbage collection? a.just after line 5b.just after line 6c.just after line 7d.just after line 8(that is, as the method returns)6:在下述选项时,没有构成死循环的程序是a.int i=
20、100 while (1) i=i%100+1; if (i100) break; b.for (;);c.int k=1000; do +k; while(k=10000);d.int s=36; while (s);-s;7:public class outerclass private double d1 = 1.0;/insert code hereyou need to insert an inner class declaration at line 3. which two inner class declarations arevalid?a.class innerone pu
21、blic static double methoda() return d1; b.public class innerone static double methoda() return d1; c.private class innerone double methoda() return d1; d.static class innerone protected double methoda() return d1; 8:关于垃圾收集的哪些叙述是对的。a.程序开发者必须自己创建一个线程进行内存释放的工作。b.垃圾收集将检查并释放不再使用的内存。c.垃圾收集允许程序开发者明确指定并立即释放
22、该内存。d.垃圾收集能够在期望的时间释放被java对象使用的内存。9:give the following java class:public class examplestatic int x=new int15;public static void main(string args)system.out.println(x5);which statement is corrected?a.when compile, some error will occur.b.when run, some error will occur.c.output is zero.d.output is nul
23、l.10:设有变量说明语句int a=1,b=0;则执行以下程序段的输出结果为( )。switch (a)case 1:switch (b)case 0:printf(*0*);break;case 1:printf(*1*);break;case 2:printf(*2*);break;printf(n);a.*0*b.*0*2*c.*0*1*2*d.有语法错误11:以下的c程序代码片段运行后c和d的值分别是多少int a =1,b =2;int c,d;c =(a&b)&a;d =(a&b)&a;a.0,0b.0,1c.1,0d.1,112:给出下面的代码片断。下面的哪些陈述为错误的?1)
24、 public void create() 2) vector myvect;3) myvect = new vector();4) a.第二行的声明不会为变量myvect分配内存空间。b.第二行语句创建一个vector类对象。c.第三行语句创建一个vector类对象。d.第三行语句为一个vector类对象分配内存空间13:give the following code:public class examplepublic static void main(string args )int l=0;dosystem.out.println(“doing it for l is:”+l);whi
25、le(-l0)system.out.println(“finish”);which well be output: a.doing it for l is 3b.doing it for l is 1c.doing it for l is 2d.doing it for l is 014:give the code fragment:if(x4)system.out.println(“test 1”);else if (x9)system.out.println(“test 2”);else system.out.println(“test 3”);which range of value x
26、 would produce of output “test 2”? a.x4c.x9d.none15: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.简答题16:请设计一个java程序,程序中要进行数组操作和除法操作,要求对所设计的程序可能出现的异常进行处理。17:char型变量中能不能存贮一个中文汉字?为什么?18:tomcat中,什么是defaultservlet?他的功能是什么?19:下面的代码在绝大部分时间内
27、都运行得很正常,请问在什么情况下会出现问题?问题的根源在哪里?import java.util.linkedlist;public class stack linkedlist list = new linkedlist();public synchronized void push(object x) synchronized(list) list.addlast( x );notify();public synchronized object pop()throws exception synchronized(list) if( list.size() ” and “”. which s
28、tatement is true?a.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 1010 0000 0000 0000 0000 0000 0000b.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000c.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 0000 0000 0000 0000 0000 0000 0000d.1010 0000 0000 00
29、00 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 00003:what will happen when you attempt to compile and run the following code? public class staticstaticint x = 5; static int x,y;public static void main(string args) x-; mymethod(); system.out.println(x + y + +x); public static void m
30、ymethod()y = x+ + +x; choices:a.prints : 2b.prints : 3c.prints : 7d.prints : 84:软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开发顺序?a.计划阶段、开发阶段、运行阶段b.设计阶段、开发阶段、编码阶段c.设计阶段、编码阶段、维护阶段d.计划阶段、编码阶段、测试阶段5:在软件生命周期中,下列哪个说法是不准确的?a.软件生命周期分为计划、开发和运行三个阶段b.在计划阶段要进行问题焉醛和需求分析c.在开发后期要进行编写代码和软件测试d.在运行阶段主要是进行软件维护6:what will be
31、 the result of executing the following code? public static void main(string args) char digit = a; for (int i = 0; i 10; i+) switch (digit) case x : int j = 0; system.out.println(j); default : int j = 100;system.out.println(j); int i = j; system.out.println(i); choices:a.100 will be printed 11 times.
32、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.7: 1. public class x 2. public object m () 3. object o = new float (3.14f); 4.
33、object oa = new object 1; 5. oa0= o; 6. o = null; 7. oa0 = null; 8.return o; 9. 10. when is the float object created in line 3, eligible for garbage collection? a.just after line 5b.just after line 6c.just after line 7d.just after line 8(that is, as the method returns)8:what happens when you try to
34、compile and run the following program?class mysterystring s;public static void main(string args)mystery m=new mystery();m.go();void mystery()s=”constructor”;void go()system.out.println(s);a.this code compliles but throws an exception at runtimeb.this code runs but nothing appears in the standard out
35、putc.this code runs and “constructor” in the standard outputd.this code runs and writes ”null” in the standard output9:consider the class hierarchy shown below:-class fourwheeler implements drivingutilitiesclass car extends fourwheelerclass truck extends fourwheelerclass bus extends fourwheelerclass
36、 crane extends fourwheeler-consider the following code below:1.drivingutilities du;2.fourwheeler fw;3.truck mytruck = new truck();4.du = (drivingutilities)mytruck;5.fw = new crane();6.fw = du;which of the statements below are true?choices:a.line 4 will not compile because an interface cannot refer t
37、o an object.b.the code will compile and run.c.the code will not compile without an explicit cast at line 6, because going down the hierarchy without casting is not allowed.d.the code will compile if we put an explicit cast at line 6 but will throw an exception at runtime.10:what results from attempt
38、ing to compile and run the following code? public class ternarypublic static void main(string args)int a = 5;system.out.println(value is - + (a 5) ? 9.9 : 9); choices:a.prints: value is - 9b.compilation errorc. prints: value is - 5d.none of these11:which of the following answer is correct to express
39、 the value 8 in octal number?a.010b.0x10c.08d.0x812:使用 jdbc 可以做到的是a.把二进制代码传送到任何关系数据库中b.把 java 源代码传送到任何关系数据库中c.把表单信息传送到任何关系数据库中d.很容易地把 sql 语句传送到任何关系数据库中13:以下的c程序代码片段运行后c和d的值分别是多少int a =1,b =2;int c,d;c =(a&b)&a;d =(a&b)&a;a.0,0b.0,1c.1,0d.1,114:which is the most appropriate code snippet that can be i
40、nserted 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 asserttest4. 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. / more code. 14. 15. / other methods . 16. publ
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 四年级语文下册 6第6课《飞向蓝天的恐龙》知识点(部编版)
- 成都中医药大学《自然辩证法概论》2023-2024学年第一学期期末试卷
- 成都中医药大学《文献检索与应用》2022-2023学年第一学期期末试卷
- 样机展示租赁合同书(3篇)
- Kahukuene-A-生命科学试剂-MCE
- 旧电梯拆除施工方案
- 开荒保洁投标书合同 方案
- 住宅水电维修合同
- 农药化肥配送服务合同
- 早教中心元宵节活动方案
- 新人教版小学数学六年级上第六单元备课方案教学设计教案
- 爱惜学习用品 完整版课件
- 广东省普通高等学校毕业生就业推荐表
- 啤酒销售表格明细模板
- 黄鹤楼初中古诗词教案PPT课件讲义
- 电大中级财务会计二形考任务1-4答案
- 2022年数据结构大作业题目
- T-CAMET 04017.1-2019 城市轨道交通 全自动运行系统规范 第1部分:需求
- 人教版九年级 Unit7 Teenagers should be allowed to choose their own clothes.教学设计
- 数据中心施工组织设计
- 危险废物综合处置场改扩建工程安全预评价报告
评论
0/150
提交评论