2-java笔试题.doc_第1页
2-java笔试题.doc_第2页
2-java笔试题.doc_第3页
2-java笔试题.doc_第4页
2-java笔试题.doc_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

JAVA笔试题(一)(60分钟)一、不定项选择题(3分*20=60分)1、Whichdeclarationsofidentifiersarelegal?A.$persons B.TwoUsers C.*point D.this E._endline2、WhicharenotJavakeywords?A.TRUE B.sizeof C.const D.super E.void3、WhicharenotJavaprimitivetypes?A.short B.Boolean C.unit D.float 4、what is the return type of Java specified execution method main()?A.int B.void C.Boolean D.static5、Whichofthefollowingfragmentsmightcauseerrors?A.Strings=Gonewiththewind; B.Strings=Gonewiththewind;Stringt=good; Stringt;Stringk=s+t; t=s3+one;C.Strings=Gonewiththewind; D.Strings=homedirectory;Stringstandard=s.toUpperCase(); Stringt=s-directory.6、Whichlayoutmanagerisused whentheframeisresizedthebuttonsspositionintheFramemightbechanged?A.BorderLayout B.FlowLayout C.CardLayout D.GridLayout7、WhichwilldisplayifoneMethodrunnormally?publicvoidtest()tryoneMethod();System.out.println(condition1);catch(ArrayIndexOutOfBoundsExceptione)System.out.println(condition2);catch(Exceptione)System.out.println(condition3);finallySystem.out.println(finally);A.condition1 B.condition2 C.condition3 D.finally8、Which three are equivalent to line 2?public interface Fooint k = 4;A.final int k = 4 B.public int k = 4 C.static int k = 4D.private int k = 4 E.abstract int k = 4 F.volatile int k = 4G.transient int k = 4 H.protected int k = 49、What is the result?interface Foo int k=0; public class Test implements Foo public static void main(String args) int i; Test test =new Test(); i=test.k; i=Test.k; i=Foo.k; A. Compilation succeeds B. An error at line 2 causes compilation to failC. An error at line 9 causes compilation to fail D. An error at line 10 causes compilation to failE. An error at line 11 causes compilation to fail10、Whichstatementsaboutthreadaretrue?A.Onceathreadiscreated,itcanstarrunningimmediately.B.Tousethestart()methodmakesathreadrunnable,butitdoesnotnecessarilystartimmediately.C.Whenathreadstopsrunningbecauseofpre-emptive,itisplacedatthefrontendoftherunnablequeue.D.Athreadmayceasetobereadyforavarietyofreasons.11、WhichisnotamethodoftheclassInputStream?A.intread(byte) B.voidflush() C.voidclose() D.intavailable()12、WhichclassescanbeusedastheargumentoftheconstructoroftheclassFileInputStream?A.InputStream B.File C.FileOutputStream D.String13、Whichexpressionsarecorrecttodeclareanarrayof10Stringobjects?A.charstr=newString10 B.charstr=newString10C.Stringstr=newString10 D.Stringstr10 =newString1014、which two interfaces provide the capability to store objects using a key-value pair? A. java.util.Map B. java.util.Set C. java.util.List D. java.util.SortedSet E. java.util.SortedMap F. java.util.Collection15、下面的描述错误的是 ( )A Statement的executeQuery()方法会返回一个结果集B Statement的executeUpdate()方法会返回是否更新成功的boolean值C 使用ResultSet中的getString()可以获得一个对应于数据库中char类型的值D ResultSet中的next()方法会使结果集中的下一行成为当前行16、Giventhefollowingcode:if(x0)System.out.println(first);elseif(x-3)System.out.println(second);elseSystem.out.println(third);Whichrangeofxvaluewouldprintthestringsecond?A.x0 B.x-3 C.x=-3 D.x-317、阅读下面程序:public class Main public static void main(String args)String s1=args1; String s2=args2;String s3=args3; String s4=args4;System.out.println(“args2=”+s2);编译后执行:java Main 1 2 3 4 结果是下面哪一个?A、args2=2B、args2=nullC、args2=1D、运行出现异常18、Giventhefollowingcode:publicclassTestvoidprintValue(intm)doSystem.out.println(Thevalueis+m);while(-m10)publicstaticvoidmain(Stringarg)inti=10;Testt=newTest();t.printValue(i);Whichwillbeoutput?A、Thevalueis8 B、Thevalueis9 C、Thevalueis10 D、Thevalueis1119、Whicharesyntacticallyvalidstatementat/pointx?classPersonprivateinta;publicintchange(intm)returnm;publicclassTeacherextendsPersonpublicintb;publicstaticvoidmain(Stringarg)Personp=newPerson();Teachert=newTeacher();inti;/pointxA.i=m B.i=b C.i=p.a D.i=p.change(30) E.i=t.b20、publicclassParentpublicintaddValue(inta,intb)ints;s=a+b;returns;classChildextendsParentWhichmethodscanbeaddedintoclassChild?A.intaddValue(inta,intb)/dosomething.B.publicvoidaddValue()/dosomething.C.publicintaddValue(inta)/dosomething.D.publicintaddValue(inta,intb)throwsMyException/dosomething.二、填空题(2分*10=20分)1、JSP的内置对象有_、config、_、_、_、_、_、_、exception。2、实现线程有两种用法,分别为:_和_。3、线程同步的方法有_、_、_、_。(请至少写出三个)4、String s = new String(xyz)这个语句创建了_个String Object。5、try里有一个return语句,那么紧跟在这个try后的finally里的code_(填写“会”或者 “不会”)被执行,在return_(填写“前” 或者“后”)执行。6、Error表示_;Exception表示_。7、在Jdbc中常用的接口有_、_、_、_。(请至少写出三个)8、Struts是一种应用广泛的MVC框架,MVC是一个设计模式,它强制性地使应用程序的输入、处理和输出分开。使用MVC应用程序被分成三个核心部件:_、_、_。9、在java中一个类被声明为final类型,表示_。10、数组_(填写“有” 或者“没有”)length()这个方法,_(填写“有” 或者“没有”)length的属性。三、程序分析题(10分*2=20分)1、classTestA publicTestA() a1(); publicvoida1()System.out.println(A-a1); publicclassTest

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论