




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
YW2010-JavaJava软件工程师试卷B(2014)考生必读:请勿在本试卷中涂写,答案写在答题卷中考试时间90分钟1 选择题(每题2分)1.1 JAVA/JSP编程部分1、 Given:public class Pass public static void main(String args) int x = 5; Pass p = new Pass(); p.doStuff(x); System.out.print(” main x = “+ x); void doStuff(int x) System.out.print(” doStuff x = “+ x+); What is the result?A. Compilation fails.B. An exception is thrown at runtime.C. doStuffx = 6 main x = 6D. doStuffx = 5 main x = 5E. doStuffx = 5 main x = 6F. doStuffx = 6 main x = 52、 Given:class TestA public void start() System.out.println(”TestA”); public class TestB extends TestA public void start() System.out.println(”TestB”); public static void main(String args) (TestA)new TestB().start(); What is the result?A. TestAB. TestBC. Compilation fails.D. An exception is thrown at runtime.3、 Given:public class Test public static void main(String args) int x =5; boolean b1 = true; boolean b2 = false; if(x=4) & !b2) System.out.print(”l “); System.out.print(”2 “); if (b2 = true) & b1) System.out.print(”3 “); What is the result?A. 2B. 3C. 1 2D. 2 3E. 1 2 3F. Compilation fails.G. Au exceptional is thrown at runtime.4、 Which Man class properly represents the relationship “Man has a bestfriend who is a Dog”?A. class Man extends Dog B. class Man implements Dog C. class Man private BestFriend dog; D. class Man private Dog bestFriend; E. class Man private Dog F. class Man private BestFriend 5、 Given:class One public One() System.out.print(1); class Two extends One public Two() System.out.print(2); class Three extends Two public Three() System.out.print(3); public class Numbers public static void main( String argv) new Three(); What is the result when this code is executed?A. 1B. 3C. 123D. 321E. The code runs with no output.6、 Given:class Line public static class Point class Triangle / insert code hereWhich code, inserted at line 6, creates an instance of the Point class defined in Line?A. Point p = new Point();B. Line.Point p = new Line.Point();C. The Point class cannot be instatiated at line 15.D. Line 1 = new Line() ; 1.Point p = new 1.Point();7、 How can you force garbage collection of an object?a、 Garbage collection cannot be forcedb、 Call System.gc().c、 Call System.gc(), passing in a reference to the object to be garbage collected.d、 Call Runtime.gc().e、 Set all references to the object to new values(null, for example).8、 Given:public static void parse(String str) try float f= Float.parseFloat(str); catch (NumberFormatException nfe) f= 0; finally System.out.println(f); public static void main(String args) parse(”invalid”);What is the result?A. 0.0B. Compilation fails.C. A ParseException is thrown by the parse method at runtime.D. A NumberFormatException is thrown by the parse method at runtime.9、 Given:public class MyLogger private StringBuilder logger = new StringBuuilder(); public void log(String message, String user) logger.append(message); logger.append(user); The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?A. synchronize the log methodB. replace StringBuilder with StringBufferC. No change is necessary, the current MyLogger code is already thread-safe.D. replace StringBuilder with just a String object and use the string concatenation (+=) within the log method10、 Click the Exhibit button.class Person String name = “No name; public Person(String nm) name = nm; class Employee extends Person String emplD = “0000”; public Employee(String id) empID = id; public class EmployeeTest public static void main(String args) Employee e = new Employee(”4321”); System.out.println(e.empID); What is the result?A. 4321B. 0000C. An exception is thrown at runtime.D. Compilation fails because of an error in line 18.11、 Which three will compile and run without exception? (Choose three.)A. private synchronized Object o;B. void go() synchronized() /* code here */ C. public synchronized void go() /* code here */ D. private synchronized(this) void go() /* code here */ E. void go() synchronized(Object.class) /* code here */ F. void go() Object o = new Object(); synchronized(o) /* code here */ 12、 Given:public class Test public enum Dogs collie, harrier; public static void main(String args) Dogs myDog = Dogs.collie; switch (myDog) case collie: System.out.print(”collie “); case harrier: System.out.print(”harrier “); What is the result?A. CollieB. HarrierC. Compilation fails.D. collie harrierE. An exception is thrown at runtime.13、 Given:public class Base public static final String FOO = “foo”; public static void main(String args) Base b = new Base(); Sub s = new Sub(); System.out.print(Base.FOO); System.out.print(Sub.FOO); System.out.print(b.FOO); System.out.print(s.FOO); System.out.print(Base)s).FOO); class Sub extends Base public static final String FOO=bar;What is the result?A. foofoofoofoofooB. foobarfoobarbarC. foobarfoofoofooD. foobarfoobarfooE. barbarbarbarbarF. foofoofoobarbarG. foofoofoobarfoo14、 Which three statements are true? (choose three)A. A final method in class x can be abstract if and only if X is abstractB. A protected method in class x can be overridden by any subclass of x.C. A private static method can be called only within other static methods in class X.D. A non-static public final method in class X can be overridden in any subclass of X.E. A public static method in class X can be called by a subclass of X without explicitly referencing the class x.F. A method with the same signature as a private final method in class X can be implemented in a subclass of X.15、 Given:public class Test public static void go(Long n) System.out.print(Long ); public static void go(Short n) System.out.print(Short ); public static void go(int n) System.out.print(int ); public static void main(String args) short y = 6; long z = 7; go(y); go(z); What is the result?A. int LongB. Short LongC. Compilation failsD. An exception is thrown at runtime.16、 Given:class ClassA class ClassB extends ClassA class ClassC extends ClassA and:ClassA p0 = new ClassA();ClassB p1 = new ClassB();ClassC p2 = new ClassC();ClassA p3 = new ClassB();ClassA p4 = new ClassC();Which three are valid? (Choose three.)A. p0 = p1;B. p1 =p2;C. p2 = p4;D. p2 = (ClassC)p1;E. p1 = (ClassB)p3;F. p2 = (ClassC)p4;17、 Given:public class TestSeven extends Thread private static int x; public synchronized void doThings() int current = x; current+; x = current; public void run() doThings(); Which is true?A. Compilation fails.B. An exception is thrown at runtime.C. Synchronizing the run() method would make the class thread-safe.D. The data in variable “x” are protected from concurrent access problems.E. Declaring the doThings() method as static would make the class thread-safe.F. Wrapping the statements within doThings() in a synchronized(new Object() block would make the class thread-safe.18、 使用jsp:forward 同使用响应重定向相比:A. jsp:forward 减少一次客户-服务器往返B. 重定向减少一次客户-服务器往返C. jsp:forward 可以向客户转发任意URL 的页面内容D. 重定向可以向客户转发任意URL 的页面内容19、 关于使用URL 重写技术来维护会话,同其他几种会话维护技术相比,以下说法哪些是正确的?A. URL 重写技术是Servlet 规范规定的缺省会话维护技术B. URL 重写技术在Web 服务器实现上得到普遍的支持C. 使用URL 重写技术维护的会话安全系数比较高D. 需要对所有动态生成的URL 进行URL 重写,比较麻烦20、 Servlet API 2.3 提供的HttpSession 会话跟踪机制,是建立在_的基础之上的。A. Cookie 技术B. URL 重写技术C. 隐藏表单技术1.2 数据库相关编程部分21、 存在一张表table_a,表结构定义如下:create table table_a( a int, b varchar(32) );create index idx_b on table_a(b);请问,以下那条SQL能够通过索引idx_b访问记录(提示:可能存在多选):a、select * from table_a where b like first%b、select * from table_a where b like %second%c、select * from table_a where a=3 and b like first%d、select * from table_a where b like first%second%22、 设有图书管理数据库: 图书(总编号C(6),分类号C(8),书名C(16),作者C(6),出版单位C(20),单价N(6,2) 读者(借书证号C(4),单位C(8),姓名C(6),性别C(2),职称C(6),地址C(20) 借阅(借书证号C(4),总编号C(6),借书日期D(8) 对于图书管理数据库,求CIE单位借阅图书的读者的人数。 下面SQL语句正确的是_。 SELECT _ FROM 借阅 WHERE; 借书证号 _ a、COUNT (DISTINCT 借书证号) IN (SELECT 借书证号 FROM 读者 WHERE 单位=CIE) b、COUNT (DISTINCT 借书证号) IN (SELECT 借书证号 FROM 借阅 WHERE 单位=CIE) c、SUM (DISTINCT 借书证号) IN (SELECT 借书证号 FROM 读者 WHERE 单位=CIE) d、SUM (DISTINCT 借书证号) IN (SELECT 借书证号 FOR 借阅 WHERE 单位=CIE) 23、 设有图书管理数据库: 图书(总编号C(6),分类号C(8),书名C(16),作者C(6),出版单位C(20),单价N(6,2) 读者(借书证号C(4),单位C(8),姓名C(6),性别C(2),职称C(6),地址C(20) 借阅(借书证号C(4),总编号C(6),借书日期D(8) 对于图书管理数据库,要查询所藏图书中,各个出版社的图书最高单价、平均单价和册数,下面SQL语句正确的是_。 SELECT 出版单位,_,_,_; FROM 图书管理!图书 _ 出版单位 a、MIN(单价) AVGAGE(单价) COUNT(*) GROUP BY b、MAX(单价) AVG(单价) COUNT(*) ORDER BY c、MAX(单价) AVG(单价) SUM(*) ORDER BY d、MAX(单价) AVG(单价) COUNT(*) GROUP BY 24、 SQL语句中删除表的命令是:a、DELETE TABLEb、REMOVE TABLEc、DROP TABLEd、ERASE TABLE1.3 Web部份25、 Choose the correct HTML tag to make a text italic A、 B、 C、 26、 Is this a well formed XML document? ToveJani A、No B、Yes 27、 How can you make a list that lists the items with bullets? A、 B、 C、 D、 28、 What is the correct HTML for making a drop-down list? A、 B、 C、 D、29、 How do you change the font of an element? A、font-family:B、f:C、font=30、 Which CSS property controls the text size? A、text-styleB、text-sizeC、font-sizeD、font-style31、 How do you create a function? A、function myFunction() B、function=myFunction() C、function:myFunction() 32、 How do you write a conditional statement for executing some statements only if i is NOT equal to 5? A、if (i != 5) B、if (i 5) C、if =! 5 then D、if 5 33、 What is the correct JavaScript syntax to insert a comment that has more than one line? A、 B、/*This comment hasmore than one line*/ C、/This comment hasmore than one line/34、 How do you put a message in the browsers status bar? A、window.status = put your message here B、status(put your message here) C、statusbar = put your message here D、window.status(put your message here) 35、 Where is the correct place to insert a JavaScript? A、The section B、The section C、Both the section and the section are correct 2 逻辑题部分(41题8分,42题12分)36、 甲乙两人都是瞎子,某天甲和乙不约而同的都各买了双袜子,而且都是双黑为了估计当前人们对管理基本知识掌握的水平,管理者杂志在读者中开展了一次管理知识有奖问答活动。答卷评分后发现,60%的参加者对于管理基本知识掌握的水平很高,30%左右的参加者也表现出了一定的水平。管理者杂志因此得出结论,目前社会群众对于管理基本知识的掌握还是不错的。以下哪项如果为真,最能削弱以上结论?A 并不是所有人都那么认真,有少数人照抄了别人的答卷,还获了奖。B 管理基本知识的范围很广,仅凭一次答卷就得出结论未免过于草率。C 并非所有管理者的读者都参加了此次答卷活动。其信度值得商榷。D 掌握了管理基本知识与管理水平的真正提高还有相当的距离。E 从发行渠道看,管理者的读者主要是高学历者和实际的经营管理者。37、 在上个打猎季节,在人行道上行走时被汽车撞伤的人数是在树林中的打猎事故中受伤的人数的2倍。因此,在上个打猎季节,人们在树林里比在人行道上行走时安全。为了评价上述论证,以下哪项是必须知道的?A 上个打猎季节,马路上的行人和树林中人数的比例B 如果汽车司机和开枪的猎手都小心点儿,有多少事故可以免于发生。C 下个打猎季节,在树林中打猎受伤的人数较上个季节减少的可能性。D 平均来讲,在非狩猎季节,有多少人在打猎事故中受伤。E 在上个打猎季节中,打猎事故中受伤的人中有多少在过去类似的事故中也受过伤。38、 十年前癌症病人在发现疾病后平均生存5.4年,现在已经达到6.7年。这说明,治疗水平的提高使癌症病人存活的时间延长了。上述结论依赖于下述哪一假设?A 十年前接受治疗的病人数目与现在相近。B 十年来癌症病人的职业类型没有什么变化。C 不同类型的癌症病人存活时间差别不大。D 十年前癌症诊断技术水平与现在相近。E 十年前购买医疗保险的人不如现在多。39、 为什么是政府,而不是企业或大学为超级计算机网络的实现出资?这是因为仅仅对超级计算机网络庞大的数据管理能力来说,就有一系列被抨击的问题。没有任何一个企业或大学自身具有购买整个网络的机器的足够财力,并且没有企业
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 医疗废物处理设施建设方案
- 住宅项目施工期间的气候适应性方案
- xx镇天然气管线及附属设施建设项目施工方案
- 医药产业园整体规划设计方案
- 大豆蛋白产品质量检测与控制管理方案
- 温室育苗区设计方案
- 可再生能源耦合热力系统集成方案
- 大型商业建筑建设方案
- 管理咨询成果推广方案
- 压力容器应急救援预案
- TSZUAVIA 009.7-2019 多旋翼无人机系统实验室环境试验方法 第7部分:温度变化试验
- 不对称高压脉冲轨道电路讲义课件
- 国家自然科学基金申请讲座培训课件
- 会诊-联络精神病学-课件
- 市级科研课题智慧教育课题现场结题汇报PPT
- 教师资格证(高中英语)学科知识点归纳总结
- 入团考试试题及答案
- 2022注册安全工程师考试题库(含答案)
- 面瘫(面神经炎)课件
- 城市道路工程质量事故
- 铁路路基大维修规则
评论
0/150
提交评论