版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
..Java基础1.Whichofthefollowingwillcompilecorrectly?A>floatf=10f;B>floatf=10.1;C>floatf=10.1f;D>byteb=10b;2.WhichdeclarationsofidentifiersarelegalA.$personsB.TwoUsersC.*pointD.thisE._endline3.WhichstatementofassigningalongtypevariabletoahexadecimalvalueiscorrectA.longnumber=345L;B.longnumber=0345;C.longnumber=0345L;D.longnumber=0x345L4.WhichofthefollowingfragmentsmightcauseerrorsA.Strings="Gonewiththewind";Stringt="good";Stringk=s+t;B.Strings="Gonewiththewind";Stringt;t=s[3]+"one";C.Strings="Gonewiththewind";Stringstandard=s.toUpperCase<>;D.Strings="homedirectory";Stringt=s-"directory";5.Whicharesyntacticallyvalidstatementat//pointxclassPerson{privateinta;publicintchange<intm>{returnm;}}publicclassTeacherextendsPerson{publicintb;publicstaticvoidmain<Stringarg[]>{Personp=newPerson<>;Teachert=newTeacher<>;inti;//pointx}}A.i=m;B.i=b;C.i=p.a;D.i=p.change<30>;E.i=t.b.6.Whichlayoutmanagerisusedwhentheframeisresizedthebuttons'spositionintheFramemightbechangedA.BorderLayoutB.FlowLayoutC.CardLayoutD.GridLayout7.Giventhefollowingcodefragment:1>publicvoidcreate<>{2}VectormyVect;3}myVect=newVector<>;4}}WhichofthefollowingstatementsaretrueA.Thedeclarationonline2doesnotallocatememoryspaceforthevariablemyVect.B.Thedeclarationonline2allocatesmemoryspaceforareferencetoaVectorobject.C.Thestatementonline2createsanobjectofclassVector.D.Thestatementonline3createsanobjectofclassVector.E.Thestatementonline3allocatesmemoryspaceforanobjectofclassVector8.Whichofthefollowingansweriscorrecttoexpressthevalue8inoctalnumberA.010B.0x10C.08D.0x89.WhicharenotJavakeywordsA.TRUEB.sizeofC.constD.superE.void10.WhichofthefollowingstatementsaretrueA.Theequals<>methoddeterminesifreferencevaluesrefertothesameobject.B.The==operatordeterminesifthecontentsandtypeoftwoseparateobjectsmatch.C.Theequals<>methodreturnstrueonlywhenthecontentsoftwoobjectsmatch.D.TheclassFileoverridesequals<>toreturntrueifthecontentsandtypeoftwoseparateobjectsmatch.11.WhichstatementsaboutinheritancearetrueA.InJavaprogramminglanguageonlyallowssingleinheritance.B.InJavaprogramminglanguageallowsaclasstoimplementonlyoneinterface.C.InJavaprogramminglanguageaclasscannotextendaclassandimplementainterfacetogether.D.InJavaprogramminglanguagesingleinheritancemakescodemorereliable.12.1>classPerson{2}publicvoidprintValue<inti,intj>{/*…*/}3}publicvoidprintValue<inti>{/*...*/}4}}5>publicclassTeacherextendsPerson{6}publicvoidprintValue<>{/*...*/}7}publicvoidprintValue<inti>{/*...*/}8}publicstaticvoidmain<Stringargs[]>{9}Persont=newTeacher<>;10}t.printValue<10>;11}}12}}Whichmethodwillthestatementonline10callA.online2B.online3C.online6D.online713.WhicharenotJavaprimitivetypesA.shortB.BooleanC.unitD.float14、Themethodresume<>isresponsibleforresumingwhichthread'sexecutionA.Thethreadwhichisstoppedbycallingmethodstop<>B.Thethreadwhichisstoppedbycallingmethodsleep<>C.Thethreadwhichisstoppedbycallingmethodwait<>\D.Thethreadwhichisstoppedbycallingmethodsuspend<>15.WhichofthefollowingrangeofintiscorrectA.-2^7–2^7-1B.0–2^32-1C.-2^15–2^15-1D.-2^31–2^31-116.WhichkeywordshouldbeusedtoenableinteractionwiththelockofanobjectTheflagallowsexclusiveaccesstothatobject.A.transientB.synchronizedC.serializeD.static17.Whichisthereturntypeofthemethodmain<>A.intB.voidC.booleanD.static18.Giventhefollowingcode:if<x>0>{System.out.println<"first">;}elseif<x>-3>{System.out.println<"second">;}else{System.out.println<"third">;}Whichrangeofxvaluewouldprintthestring"second"A.x>0B.x>-3C.x<=-3D.x<=0&x>-319、Whichofthefollowingansweriscorrecttoexpressthevalue10inhexadecimalnumberA.0xAB.0x16C.0AD.01620.WhichstatementsaboutthegarbagecollectionaretrueA.Theprogramdevelopermustcreateathreadtoberesponsibleforfreethememory.B.Thegarbagecollectionwillcheckforandfreememorynolongerneeded.C.Thegarbagecollectionallowtheprogramdevelopertoexplicityandimmediatelyfreethememory.D.Thegarbagecollectioncanfreethememoryusedjavaobjectatexpecttime.21、Giventhefollowingcode:1>publicclassTest{2}intm,n;3}publicTest<>{}4}publicTest<inta>{m=a;}5}publicstaticvoidmain<Stringarg[]>{6}Testt1,t2;7}intj,k;8}j=0;k=0;9}t1=newTest<>;10}t2=newTest<j,k>;11}}12}}WhichlinewouldcauseoneerrorduringcompilationA.line3B.line5C.line6D.line1022、Giventheuncompletedcodeofaclass:classPerson{Stringname,department;intage;publicPerson<Stringn>{name=n;}publicPerson<Stringn,inta>{name=n;age=a;}publicPerson<Stringn,Stringd,inta>{//doingthesameastwoargumentsversionofconstructor//includingassignmentname=n,age=adepartment=d;}}Whichexpressioncanbeaddedatthe"doingthesameas..."partoftheconstructorA.Person<n,a>;B.this<Person<n,a>>;C.this<n,a>;D.this<name,age>.23、WhichofthefollowingstatementsaboutvariablesandtheirscopesaretrueA.Instancevariablesaremembervariablesofaclass.B.Instancevariablesaredeclaredwiththestatickeyword.C.Localvariablesdefinedinsideamethodarecreatedwhenthemethodisexecuted.D.Localvariablesmustbeinitializedbeforetheyareused.24、publicvoidtest<>{try{oneMethod<>;System.out.println<"condition1">;}catch<ArrayIndexOutOfBoundsExceptione>{System.out.println<"condition2">;}catch<Exceptione>{System.out.println<"condition3">;}finally{System.out.println<"finally">;}}WhichwilldisplayifoneMethodrunnormallyA.condition1B.condition2C.condition3D.finally25、Giventhefollowingcode:publicclassTest{voidprintValue<intm>{do{System.out.println<"Thevalueis"+m>;}while<--m>10>}publicstaticvoidmain<Stringarg[]>{inti=10;Testt=newTest<>;t.printValue<i>;}}WhichwillbeoutputA.Thevalueis8B.Thevalueis9C.Thevalueis10D.Thevalueis1126、WhichofthefollowingstatementsaboutdeclarationaretrueA.Declarationofprimitivetypessuchasboolean,byteandsoondoesnotallocatememoryspaceforthevariable.B.Declarationofprimitivetypessuchasboolean,byteandsoonallocatesmemoryspaceforthevariable.C.DeclarationofnonprimitivetypessuchasString,Vectorandsoondoesnotallocatememoryspacefortheobject.D.DeclarationofnonprimitivetypessuchasString,Vectoranssoonallocatesmemoryspacefortheobject.27、IntheJavaAPIdocumentationwhichsectionsareincludedinaclassdocumentA.ThedescriptionoftheclassanditspurposeB.AlistofmethodsinitssuperclassC.AlistofmembervariableD.Theclasshierarchy28、Giventhefollowingcode:1>publicvoidmodify<>{2>inti,j,k;3>i=100;4>while<i>0>{5>j=i*2;6>System.out.println<"Thevalueofjis"+j>;7>k=k+1;8>i--;9>}10}}WhichlinemightcauseanerrorduringcompilationA.line4B.line6C.line7D.line829、WhichofthefollowingstatementsaboutvariablesandscopearetrueA.Localvariablesdefinedinsideamethodaredestroyedwhenthemethodisexited.B.Localvariablesarealsocalledautomaticvariables.C.Variablesdefinedoutsideamethodarecreatedwhentheobjectisconstructed.D.Amethodparametervariablecontinuestoexistforaslongastheobjectisneededinwhichthemethodisdefined.30、Aclassdesignrequiresthatamembervariablecannotbeaccessibledirectlyoutsidetheclass.WhichmodifiershouldbeusedtoobtaintheaccesscontrolA.publicB.nomodifierC.protectedD.private31、Giventhefollowingcodefragment:1>Stringstr=null;2>if<<str!=null>&&<str.length<>>10>>{3}System.out.println<"morethan10">;4}}5>elseif<<str!=null>&<str.length<><5>>{6}System.out.println<"lessthan5">;7}}8>else{System.out.println<"end">;}WhichlinewillcauseerrorA.line1B.line2C.line5D.line832、WhichstatementsaboutJavacodesecurityaretrueA.Thebytecodeverifierloadsallclassesneededfortheexecutionofaprogram.B.Executingcodeisperformedbytheruntimeinterpreter.C.Atruntimethebytecodesareloaded,checkedandruninaninterpreter.D.Theclassloaderaddssecuritybyseparatingthenamespacesfortheclassesofthelocalfilesystemfromthoseimportedfromnetworksources.33、Giventhefollowingcode:publicclassPerson{intarr[]=newint[10];publicstaticvoidmain<Stringa[]>{System.out.println<arr[1]>;}}WhichstatementiscorrectA.Whencompilationsomeerrorwilloccur.B.Itiscorrectwhencompilationbutwillcauseerrorwhenrunning.C.Theoutputiszero.D.Theoutputisnull.34、publicclassParent{publicintaddValue<inta,intb>{ints;s=a+b;returns;}}classChildextendsParent{}WhichmethodscanbeaddedintoclassChildA.intaddValue<inta,intb>{//dosomething...}B.publicvoidaddValue<>{//dosomething...}C.publicintaddValue<inta>{//dosomething...}D.publicintaddValue<inta,intb>throwsMyException{//dosomething...}35、WhichstatementsaboutthreadaretrueA.Onceathreadiscreated,itcanstarrunningimmediately.B.Tousethestart<>methodmakesathreadrunnable,butitdoesnotnecessarilystartimmediately.C.Whenathreadstopsrunningbecauseofpre-emptive,itisplacedatthefrontendoftherunnablequeue.D.Athreadmayceasetobereadyforavarietyofreasons.36、Amembervariabledefinedinaclasscanbeaccessedonlybytheclassesinthesamepackage.WhichmodifiershouldbeusedtoobtaintheaccesscontrolA.privateB.nomodifierC.publicD.protected37、ApublicmembervairablecalledMAX_LENGTHwhichisinttype,thevalueofthevariableremainsconstantvalue100.Useashortstatementtodefinethevariable.A.publicintMAX_LENGTH=100;B.finalintMAX_LENGTH=100;C.finalpublicintMAX_LENGTH=100;D.publicfinalintMAX_LENGTH=100.38、Whichexpressionsarecorrecttodeclareanarrayof10StringobjectsA.charstr[];B.charstr[][];C.Stringstr[];D.Stringstr[10];39、WhichfragmentsarecorrectinJavasourcefileA.packagetestpackage;publicclassTest{//dosomething...}B.importjava.io.*;packagetestpackage;publicclassTest{//dosomething...}C.importjava.io.*;classPerson{//dosomething...}publicclassTest{//dosomething...}D.importjava.io.*;importjava.awt.*;publicclassTest{//dosomething...}40:Strings="hello";Stringt="hello";charc[]={'h','e','l','l','o'};WhichreturntrueA.s.equals<t>;B.t.equals<c>;C.s==t;D.t.equals<newString<"hello">>;E.t==c.41.WhichofthefollowingstatementsarelegalA.longl=4990;B.inti=4L;C.floatf=1.1;D.doubled=34.4;E.doublet=0.9F.42、publicclassParent{intchange<>{…}}classChildextendsParent{}WhichmethodscanbeaddedintoclassChildA.publicintchange<>{}B.intchang<inti>{}C.privateintchange<>{}D.abstractintchang<>{}43、classParent{Stringone,two;publicParent<Stringa,Stringb>{one=a;two=b;}ntln<one>;}}publicclassChildextendsParent{publicChild<Stringa,Stringb>{super<a,b>;}publicvoidprint<>{System.out.println<one+"to"+two>;}publicstaticvoidmain<Stringarg[]>{Parentp=newParent<"south","north">;Parentt=newChild<"east","west">;p.print<>;t.print<>;}}WhichofthefollowingiscorrectA.Causeerrorduringcompilation.B.southeastC.southtonortheasttowestD.southtonortheastE.southeasttowest44、Giventheuncompletedmethod:1>2>{success=connect<>3}if<success==-1>{4}thrownewTimedOutException<>;5}}6}}TimedOutExceptionisnotaRuntimeException.Whichcancompletethemethodofdeclarationwhenaddedatline1A.publicvoidmethod<>B.publicvoidmethod<>throwsExceptionC.publicvoidmethod<>throwsTimedOutExceptionD.publicvoidmethod<>throwTimedOutExceptionE.publicthrowTimedOutExceptionvoidmethod<>45、Giventhefollowingcode:1>classParent{2}privateStringname;3}publicParent<>{}4}}5>publicclassChildextendsParent{6}privateStringdepartment;7}publicChild<>{}8}publicStringgetValue<>{returnname;}9>publicstaticvoidmain<Stringarg[]>{10}Parentp=newParent<>;11}}12>}WhichlinewillcauseerrorA.line3B.line6C.line7D.line8E.line1046、Thevariable"result"isboolean.WhichexpressionsarelegalA.result=true;B.if<result>{//dosomething...}C.if<result!=0>{//sosomething...}D.result=147、ClassTeacherandStudentaresubclassofclassPerson.Personp;Teachert;Students;p,tandsareallnon-null.if<tinstanceofPerson>{s=<Student>t;}WhatistheresultofthissentenceA.ItwillconstructaStudentobject.B.Theexpressionislegal.C.Itisillegalatcompilation.D.Itislegalatcompilationbutpossibleillegalatruntime.48、Giventhefollowingclass:publicclassSample{longlength;publicSample<longl>{length=l;}publicstaticvoidmain<Stringarg[]>{Samples1,s2,s3;s1=newSample<21L>;s2=newSample<21L>;s3=s2;longm=21L;}}WhichexpressionreturnstrueA.s1==s2;B.s2==s3;C.m==s1;D.s1.equals<m>.49、WhichclassescanbeusedastheargumentoftheconstructoroftheclassFilterInputStreamA.FilterOutputStreamB.FileC.InputStreamD.RandomAccessFile50、WhichclassescanbeusedastheargumentoftheconstructoroftheclassFileInputStreamA.InputStreamB.FileC.FileOutputStreamD.String51、WhichisnotamethodoftheclassInputStreamA.intread<byte[]>B.voidflush<>C.voidclose<>D.intavailable<>52、Giventhefollowingcode:classPerson{Stringname,department;publicvoidprintValue<>{System.out.println<"nameis"+name>;System.out.println<"departmentis"+department>;}}publicclassTeacherextendsPerson{intsalary;publicvoidprintValue<>{//doingthesameasintheparentmethodprintValue<>//includingprintthevalueofnameanddepartment.System.out.println<"salaryis"+salary>;}}Whichexpressioncanbeaddedatthe"doingthesameas..."partofthemethodprintValue<>A.printValue<>;B.this.printValue<>;C.person.printValue<>;D.super.printValue<>.53.WhichofthefollowingassignmentisnotcorrectA.floatf=11.1;B.doubled=5.3E12;C.doubled=3.14159;D.doubled=3.14D.Linux基础1.Linux文件权限一共10位长度,分成四段,第三段表示的内容是__。A文件类型B文件所有者的权限C文件所有者所在组的权限D其他用户的权限2.在使用mkdir命令创建新的目录时,在其父目录不存在时先创建父目录的选项是__。A-mB-dC-fD–p3.具有很多C语言的功能,又称过滤器的是__。AcshBtcshCawkDsed4.下列文件中,包含了主机名到IP地址的映射关系的文件是:__。A/etc/HOSTNAMEB/etc/hostsC/etc/resolv.confD/etc/networks5.命令可以从文本文件的每一行中截取指定内容的数据。__AcpBddCfmtDcut6.对名为fido的文件用chmod551fido进行了修改,则它的许可权是__。A-rwxr-xr-xB-rwxr--r--C-r--r--r--D-r-xr-x—x7.用ls–al命令列出下面的文件列表,__文件是符号连接文件。A-rw-rw-rw-2hel-susers56Sep0911:05helloB-rwxrwxrwx2hel-susers56Sep0911:05goodbeyCdrwxr--r--1helusers1024Sep1008:10zhangDlrwxr--r--1helusers2024Sep1208:12cheng8.在vi编辑器中的命令模式下,键入__可在光标当前所在行下添加一新行。A<a>;B<o>;C<I>;DA9.在vi编辑器中的命令模式下,重复上一次对编辑的文本进行的操作,可使用__命令。A上箭头B下箭头C<.>;D<*>;10.用命令ls-al显示出文件ff的描述如下所示,由此可知文件ff的类型为__。-rwxr-xr--1rootroot599Cec1017:12ffA普通文件B硬链接C目录D符号链接11.删除文件命令为:__。AmkdirBrmdirCmvDrm12.对文件进行归档的命令为__。AddBcpioCgzipDtar13.改变文件所有者的命令为__。AchmodBtouchCchownDcat14.在给定文件中查找与设定条件相符字符串的命令为:__。AgrepBgzipCfindDsort15.建立一个新文件可以使用的命令为__。AchmodBmoreCcpDtouch16在下列命令中,不能显示文本文件内容的命令是:__。AmoreBlessCtailDjoin17.文件权限读、写、执行的三种标志符号依次是__。ArwxBxrwCrdxDsrw18.在Shell脚本中,用来读取文件内各个域的内容并将其赋值给Shell变量的命令是__。AfoldBjoinCtrDread19.crontab文件由六个域组成,每个域之间用空格分割,其排列如下:__。AMINHOURDAYMONTHYEARCOMMANDBMINHOURDAYMONTHDAYOFWEEKCOMMANDCCOMMANDHOURDAYMONTHDAYOFWEEKDCOMMANDYEARMONTHDAYHOURMIN20.用ftp进行文件传输时,有两种模式:__。AWord和binaryB.txt和WordDocumentCASCII和binaryDASCII和RichTextFormat21.退出交互模式的shell,应键入__。A<Esc>;B^qCexitDquit数据库sql简答题1.用一条SQL查询出每门课目的平均值Table1:namesubjectmark
张三语文81
张三数学75张三英语87
李四语文76
李四数学90李四英语78
王五语文81
王五数学100
王五英语90
2.表student1如下:
自动编号学号姓名课程编号课程名称分数
12005001
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 科研规划岗位责任制度
- 煤矿信息共享责任制度
- 管理分配考核责任制度
- 机电队消防责任制度范本
- 校长为第一人责任制度
- 工地材料员责任制度范本
- 药师职业安全责任制度
- 站点管理工作责任制度
- 村民小组长禁毒责任制度
- 手术室护理中的细节管理与优化
- 扣件式钢管脚手架租赁合同
- JTT 1499-2024 公路水运工程临时用电技术规程(正式版)
- 西藏自治区热振国家森林公园林相改造项目实施方案
- 问题肌培训课件
- 电力系统规划与可靠性:18 电力系统可靠性研究进展
- 汉兴:从吕后到汉文帝
- 高中数学核心素养背景下GeoGebra辅助教学实践的研究报告 论文
- DB4403-T 341-2023 虚拟电厂终端授信及安全加密技术规范
- 小学六年级体育教案(表格式)
- 中药的起源和中药的发展培训课件
- 实用综合教程(第二版)外教社-第1册教案
评论
0/150
提交评论