


版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、第一题:(过程可以写在后面)学校的毕业话剧演出由四个小美女来出演小红帽、美羊羊、女巫和公主的角色。没人在排练时的角色与演出时的角色不同。排练时出演小红帽的人会撒谎,通过如下消息,请判断四人在演出和排练时分别出演什么角色。梅:“排练时,兰的角色是演出时竹的角色。”、人.“菊排练时扮演的是美羊羊。”竹:“演出时我演公主。”菊:“兰演出时扮演的是美羊羊。”第二题:解数独题(数独是九宫格(即3格宽x3格高)正方形状,每一格又细分为一个九宫格,在没一个小九宫格中,分别填上19个数字,让每一个大九宫格没一列,没一行的数字都不重复。8174694833852756966511831、Whichlinecon
2、tainsaconstructorinthisclassdefinition?publicclassCounter/(1)intcurrent,step;publicCounter(intstartVaue,intstepValue)/(2)set(startValue);setStepValue(steValue);publicintget()returncurrent;/(3)publicvoidset(intvalue)current=value;/(4)publicvoidsetStepValue(intstepValue)step=stepValue;/(5)Codemarkedwi
3、th(1)isaconstructor1) Codemarkedwith(2)isaconstructorCodemarkedwith(3)isaconstructor2) Codemarkedwith(4)isaconstructorCodemarkedwith(5)isaconstructor2、Aninstancemember.1) isalsocalledastaticmemberisalwaysavariable2) isneveramethodbelongstoasingleinstance,nottotheclassasawhole3) alwaysrepresentsanope
4、ration3、Giventhefollowingclass,whichstatementscanbeinsertedatpositionIwithoutcausingthecodetofailcompilation?publicclassQ6db8inta;intb=0;staticintc;publicvoidm()intd;inte=0;/Position11) a+b+2) c+d+3) e+7、Whatiswrongwiththefollowingcode?ClassMyExceptionextendsException。Publicclassqb4abPublicvoidfoo()
5、TryBar();finallyBaz();catch(MyExceptione)Publicvoidbar()throwsMyExceptionThrownewException();Publicvoidbaz()throwsRuntimeExceptionThrownewRuntimeException();4、)Sincethemethodfoo()doesnotcatchtheexceptiongeneratedbythemethodbaz(),itmustdeclaretheRuntimeExceptioninitsthrowsclause.5、)Athetryblockcannot
6、befollowedbybothacatchandafinallyblock.6、)Anemptycatchblockisnotallowed.7、)Acatchblockcannotfollowafinallyblock.8、)Afinallyblockmustalwaysfollowoneormorecatchblocks.5、WhatwillhappenwhenyouattempttocompileandrunthefollowingprogrambypassingtheTestclasstotheJavainterpreter?ClassTestPublicstaticvoidmain
7、System.out.print(“hello”);Selecttheonerightanswer.6. theprogramdoesnotcompilebecausemain()isnotdefinedcorrectly.7. Theprogramcompilesbutwhenyoutrytoruntheinterpretercompliesthatitcannotfindthemain()methoditneedstorun.C) theprogramcompilesbutyoucannotrunitbecausetheclassisnotdeclaredaspublic.D) thepr
8、ogramcompilesandrunswithoutanerrorbutdoesnotdisplayanythinginthestandardoutput.E) theprogramcompilesanddisplays“hello”inthestandardoutputwhenyouinrunit.6、Givethosecodesnippets:Booleanb1=newBoolean(true);Booleanb2=newBoolean(true);WhichexpressionsarelegalJavaexpressionsthatreturntrue?Selectallvalidan
9、swer.3. b1=b2b1.equals(b2)C) b1&b2b1|b2D) b1&&b2b1|b27、Giventhiscodesnippet:trytryThis();return;catch(IOExceptionx1)System.out.println("exception1");return;catch(Exceptionx2)System.out.println("exception2");return;finallySystem.out.println("finally");Whatwil
10、lappearinthestandardoutputiftryThis()throwsaNumberFormatException?Selecttheonerightanswer.a) Nothing"exception1",followedby"finally"b) "exception2",followedby"finally""exception1"c) "exception2"选择:C8、Givertheseclassdefinitions;classSupercla
11、ssclassSubclass1extendsSuperclassclassSubclass2extendsSuperclassandtheseobjects;Superclassa=newSuperclass。;Subclasslb=newSubclass1();Subclass2c=newSubclass2();whichofthefollowingexplainstheresultofthestatement;b=(Subclass1)c;Selectedtheonerightanswer;Illegalatcompiletimea) Legalatcompiletimebutpossi
12、blyillegalatruntimeb) Definitelylegalatruntime9、简述以下代码是在做什么事情?Publicstaticjavax.ejb.EJBHomegetEJBHome(StringJNDIName)throwsNameNotFoundException,NamingExceptionjava.util.Hashtableenv=newjava.util.Hashtable(1);NITIAI_CONTEXT_FACTORY,”);Javax.naming.ContextinitContext=newjavax.namingnitalContext(env);
13、If(initContext=null)ThrownewRuntimeException(“getEJBHomecould'tretrieveinitialcontext”);return(javax.ejb.EJBHome)initContext.lookup(JNDIName);10:请从空白处填写代码,满足以下功能:A) 从请求中得到用户名和口令(请求通过web浏览器中的HTML页面提交,页面中用户名对象名为userName,口令对象名为password)如果用户名为”admin”,口令为password,则讲登陆成功,将页面转到loginSuccess.jsp页面,并在sess
14、ion存放用户名(username)和密码(password)C(如果用户名和空灵为其他值,转到error.jspPublicclassTestServletextendsHttpServletPublicvoidservice(HttpServletRequestrequest,HttpServletResponseresopnse)throwsServletException,IOException/IncludefollowinglinsinallservletTry/请在此添写代码If(userName.equals(“admin”)&&password.equals(
15、“password”)request.getsession.”);.setAttribute("username",adminrequest.getsession.setAttribute("passwordII”",password”);Request.sendRedirect(“loginSuccess.jsp”);elseRequest.sendRedirect(“error.jsp”);catch(Exceptione)典道的笔试分A-B卷,题型有:1. 选择题30道(每道2分共60分)代码阅读题4道(每道5分共20分)2. 程序逻辑题2道(每道
16、10分共20分)不管是A-B卷,考察的范围都是基础知识,这个是和几个做B卷的同学那了解到的,主要的考点如下:考点名称考试频率难易度备注数组高易值传递与址传递高中Main函数低中线程低难Swing与awt低中Ascii码高难请务必记住常用ascii码,代码题都有考运算符优先级低中去网上百度一下Oop思想高中方法重载与重写高易包低易方法与类的命名规则低易逻辑思维高难其他的记得不是很清楚了,不过不会超过基础知识这个范围,但光靠书(accp6.0)上那些还不够,建议找些参考书学习一下,越基础越好。以下是A卷代码阅读题&建一个数组,顺序输出10位数,然后把这10位数再倒序输出publicclas
17、sTestpublicstaticvoidmain(Stringargs)intarr=newint1,2,3,4,5,6,7,8,9,10;System.out.println("顺序输出");for(inti=0;i<arr.length;i+)System.out.print(arri+",");System.out.println();System.out.println("倒叙输出");for(intj=arr.length-1;j>=0;j-)System.out.print(arrj+","
18、;);9、考的是方法重载,它是将两个方法的参数顺序颠倒了一下,看题的时候要注意。3.publicclassTest5publicstaticvoidmain(Stringargs)intarr=newint1,2,3,4,5,6,7,8;a(arr);b(arr);a(arr);staticvoida(intarr)for(inttemp:arr)System.out.println(temp);staticvoidb(intarr)for(inti=0;i<arr.length;i+)arri*=i;输出结果是:56以下是A卷手写代码题:8.请用1、2、3、4组成N个数值不重复且个十百
19、位都不重复的3位数,一共有几个?分别是什么?共有:24个分别是:123,124,132,134,142,143,213,214,231,234,241,243,312,314,321,324,341,342,412,413,421,423,431,432,参考答案:Intcount=0;For(inti=1;iv=4;i+)For(intj=1;jv=4;j+)For(intk=1;kv=4;k+)lf(i!=j&&i!=k&&j!=k)Count+;System.out.println(i*100+j*10+k);一共有24个,公式:4*3*2=24,具体数学公式请见排列算法9.查询子串在父串中出现的次数:参考答案:设:strl为父串,str2为字串,则:publicclassTest6publicstaticvoidmain(Stringargs)Stringstr1="hdsajkfhuisadhifnokfasdfdasdoksdfsdsfsok"Stringstr2="ok"Stringtemp=""intcount=0;for(temp=str1;temp!
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 矿石浮选工艺优化-石墨滑石选矿考核试卷
- 畜禽繁殖力与遗传改良研究考核试卷
- 纺织材料与纤维的研究与发展考核试卷
- 电脑系统优化与提速技巧考核试卷
- 笔的制造生产计划编制与执行考核试卷
- 嘉兴南湖学院《Python数据分析与应用》2023-2024学年第二学期期末试卷
- 昆明理工大学津桥学院《CAD制图》2023-2024学年第二学期期末试卷
- 咸阳市2025年三年级数学第二学期期末学业水平测试试题含解析
- 日照职业技术学院《国际商务创业策划案例分析》2023-2024学年第二学期期末试卷
- 宁德市周宁县2024-2025学年数学四年级第二学期期末考试试题含解析
- 2025年入团相关考试题型及答案
- 2023-2024学年北京市西城区德胜中学七年级(下)期中数学试卷
- 皮肤病靶向治疗专家共识(2025版)解读课件
- DB37-T 3274.3-2023 日光温室建造技术规范 第3部分:山东VI型
- 《四轮驱动电动汽车制动系统设计》14000字(论文)
- 郑州食品工程职业学院《中国宗教史》2023-2024学年第一学期期末试卷
- 新苏教版一年级数学下册综合实践活动1《抓抓数数》教案
- RoHS知识培训课件
- 医学课件痛风性关节炎
- 流程建设培训课件
- 水利工程冬季低温施工方案
评论
0/150
提交评论