版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、第一題:(過程可以寫在后面)學(xué)校的畢業(yè)話劇演出由四個小美女來出演小紅帽、美羊羊、女巫和公主的角色。沒人在排練時的角色與演出時的角色不同。排練時出演小紅帽的人會撒謊,通過如下消息,請判斷四人在演出和排練時分別出演什么角色。梅:“排練時,蘭的角色是演出時竹的角色?!薄⑷?“菊排練時扮演的是美羊羊?!敝?“演出時我演公主?!本?“蘭演出時扮演的是美羊羊。”第二題:解數(shù)獨題(數(shù)獨是九宮格(即3格寬x3格高)正方形狀,每一格又細分為一個九宮格,在沒一個小九宮格中,分別填上19個數(shù)字,讓每一個大九宮格沒一列,沒一行的數(shù)字都不重復(fù)。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,則講登陸成功,將頁面轉(zhuǎn)到loginSuccess.jsp頁面,并在sess
14、ion存放用戶名(username)和密碼(password)C(如果用戶名和空靈為其他值,轉(zhuǎn)到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(“l(fā)oginSuccess.jsp”);elseRequest.sendRedirect(“error.jsp”);catch(Exceptione)典道的筆試分A-B卷,題型有:1. 選擇題30道(每道2分共60分)代碼閱讀題4道(每道5分共20分)2. 程序邏輯題2道(每道
16、10分共20分)不管是A-B卷,考察的范圍都是基礎(chǔ)知識,這個是和幾個做B卷的同學(xué)那了解到的,主要的考點如下:考點名稱考試頻率難易度備注數(shù)組高易值傳遞與址傳遞高中Main函數(shù)低中線程低難Swing與awt低中Ascii碼高難請務(wù)必記住常用ascii碼,代碼題都有考運算符優(yōu)先級低中去網(wǎng)上百度一下Oop思想高中方法重載與重寫高易包低易方法與類的命名規(guī)則低易邏輯思維高難其他的記得不是很清楚了,不過不會超過基礎(chǔ)知識這個范圍,但光靠書(accp6.0)上那些還不夠,建議找些參考書學(xué)習(xí)一下,越基礎(chǔ)越好。以下是A卷代碼閱讀題&建一個數(shù)組,順序輸出10位數(shù),然后把這10位數(shù)再倒序輸出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、考的是方法重載,它是將兩個方法的參數(shù)順序顛倒了一下,看題的時候要注意。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;輸出結(jié)果是:56以下是A卷手寫代碼題:8.請用1、2、3、4組成N個數(shù)值不重復(fù)且個十百
19、位都不重復(fù)的3位數(shù),一共有幾個?分別是什么?共有: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,具體數(shù)學(xué)公式請見排列算法9.查詢子串在父串中出現(xiàn)的次數(shù):參考答案:設(shè):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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025版智慧社區(qū)物業(yè)管理委托合同模板3篇
- 2025年度鋼材回收利用合同
- 2025年全球及中國放射性標記服務(wù)行業(yè)頭部企業(yè)市場占有率及排名調(diào)研報告
- 2025-2030全球氮化鎵半導(dǎo)體激光器行業(yè)調(diào)研及趨勢分析報告
- 2025年度個人知識產(chǎn)權(quán)侵權(quán)糾紛調(diào)解協(xié)議3篇
- 2025年度個人房產(chǎn)過戶貸款過橋合同3篇
- 2025版建筑起重機械施工安全協(xié)議書3篇
- 2025年度個人股權(quán)收購與整合服務(wù)合同4篇
- 2025年度個人牧場與乳制品企業(yè)合作合同3篇
- 2025年度鋼管工程建設(shè)項目材料供應(yīng)合同2篇
- 勞務(wù)協(xié)議范本模板
- 2024年全國職業(yè)院校技能大賽高職組(生產(chǎn)事故應(yīng)急救援賽項)考試題庫(含答案)
- 2025大巴車租車合同范文
- 老年上消化道出血急診診療專家共識2024
- 廣東省廣州黃埔區(qū)2023-2024學(xué)年八年級上學(xué)期期末物理試卷(含答案)
- 2024年國家保密培訓(xùn)
- 2024年公務(wù)員職務(wù)任命書3篇
- 《GMP基礎(chǔ)知識培訓(xùn)》課件
- CFM56-3發(fā)動機構(gòu)造課件
- 會議讀書交流分享匯報課件-《殺死一只知更鳥》
- 2025屆撫州市高一上數(shù)學(xué)期末綜合測試試題含解析
評論
0/150
提交評論