版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
(圖片大小可自由調(diào)整)2024年計(jì)算機(jī)考試-Java認(rèn)證考試近5年真題薈萃附答案第I卷一.參考題庫(共100題)1.Which?three?statements?are?true?()A、?The?default?constructor?initializes?method?variables.B、?The?default?constructor?has?the?same?access?as?its?class.C、?The?default?constructor?invoked?the?no-arg?constructor?of?the?superclass.D、?If?a?class?lacks?a?no-arg?constructor,?the?compiler?always?creates?a?default?constructor.?E、?The?compiler?creates?a?default?constructor?only?when?there?are?no?other?constructors?for?theclass.2.哪兩個(gè)是同步的?()A、?java.util.TreeSetB、?java.util.HashtableC、?java.util.VectorD、?java.util.LinkedList3.多態(tài)應(yīng)用于()A、重載B、覆蓋C、實(shí)現(xiàn)D、組合4.以下哪個(gè)類與Swing?GUI菜單類無關(guān)?()?A、JMenuB、JMenuBarC、JMenuItemD、以上皆是5.現(xiàn)有:? class??Test4??{? public?static?void?main?(String??[]??args)??{??? boolean?X=true;?? boolean?y=false;??? short?Z=42;??? if((z++==42)??&&??(y=true))z++;??? if((x=false)??||????(++z==45))??z++;??? System.?out.println(¨z=”+z);??? ?}??? }? 結(jié)果為:()?A、??Z=42B、??z=44C、??Z=?45D、??z=?466.已知: 則下面哪段代碼是合法的()A、B、C、D、7.什么是多態(tài)?面向?qū)ο蟪绦蛟O(shè)計(jì)為什么要引人多態(tài)的特性?使用多態(tài)有什么優(yōu)點(diǎn)?8.You?need?to?create?a?JavaBean?object?that?is?used?only?within?the?current?JSP?page.?It?must?NOT?beaccessible?to?any?other?page?including?those?that?this?page?might?import. Which?JSP?standard?action?canaccomplish?this?goal?()A、B、C、D、9.this()和super()只能位于構(gòu)造函數(shù)中的第一句10.Socket通常也稱為套接字,用于描述()和()11.Which?two?are?characteristics?of?the?Service?Locator?pattern?()A、It?encapsulates?component?lookup?procedures.B、It?increases?source?code?duplication?and?decreases?reuse.C、It?improves?client?performance?by?caching?context?and?factory?objects.D、It?degrades?network?performance?due?to?increased?access?to?distributed?lookup?services.12.1.publicclassGC{ 2.privateObjecto; 3.privatevoiddoSomethingElse(Objectobj){o=obj;} 4.publicvoiddoSomething(){ 5.Objecto=newObject(); 6.doSomethingElse(o); 7.o=newObject(); 8.doSomethingElse(null); 9.o=null; 10.} 11.} WhenthedoSomethingmethodiscalled,afterwhichlinedoestheObjectcreatedinline5becomeavailableforgarbagecollection?()A、Line5B、Line6C、Line7D、Line8E、Line9F、Line1013. What?is?the?result?()A、?baz?has?a?value?of?0.B、?baz?has?a?value?of?1.C、?baz?has?the?value?of?2.D、?An?exception?is?thrown.E、?The?code?will?not?compile.14.涉及類MyClass的方法簽名足public?void??find(MyClass?a),那么該方法可接收的實(shí)際參數(shù)的類型可以是哪些?()??A、MyClass類的類型B、MyClass子類的類型C、Object類型D、所有接口15.In?which?two?cases?does?the?compiler?supply?a?default?constructor?for?class?A?()??A、?class?A{}B、?class?A?{?public?A(){}?}C、?class?A?{?public?A(int?x){}?}D、?class?Z?{}?class?A?extends?Z?{?void?A(){}?}16.下面正確的創(chuàng)建Socket的語句是()A、?Socket?a??=??new?Soeket(80):B、?Socket?b??=??new?Socket("130.?3.?4.?5",?80):C、?ServerSocket?c??=??new?Socket(80)D、?ServerSocket?d?=??new?Socket?("130.?3.?4,?5",?80)17.Assume?the?scoped?attribute?priority?does?NOT?yet?exist.?Which?two?create?and?set?new?request-scoped?attribute?priority?to?the?value?“medium”?()?A、?${priority?=?‘medium’?}?B、?${requestScope[?‘priority’?]?=?‘medium’?}?C、??D、?medium?E、??F、?medium?G、?18.中間容器,原子組件,菜單欄,工具欄等都直接放在頂級容器下。19.What?is?the?result?() A、Compilation?succeeds.B、Exactly?one?class?does?NOT?compile.C、Exactly?two?classes?do?NOT?compile.D、Exactly?four?classes?do?NOT?compile.E、Exactly?three?classes?do?NOT?compile.20.多線程之間怎樣進(jìn)行同步?21.What?is?the?result?() A、hi?hiB、hi?worldC、world?worldD、Compilation?fails.E、An?exception?is?thrown?at?runtime.22.下面哪些說法是正確的()A、靜態(tài)方法不能被覆蓋B、私有方法不能被重載C、實(shí)例變量能夠被隱藏D、靜態(tài)方法能夠被重載23.猴子摘桃問題猴子第1天摘下若干桃子,當(dāng)即吃掉一半,又多吃一個(gè),第二天將剩余的部分吃掉一半還多一個(gè);以此類推,到第10天只剩余1個(gè)。問第1天共摘了多少桃子24.現(xiàn)有如下類型:?? a?-?java.util.Hashtable? b?-?java.util.List? c?-?java.util.ArrayList? d?-?java.util.SortedSet? 和定義:? 1?–?使用本接口,允許用戶控制集合中每個(gè)元素的插入位置。?? 2?–?使用本集合,確保用戶可以按照遞增或元素的自然順序遍歷集合。?? 3?–?本具體類型允許空元素及基于索引的訪問。??? 4?–?本集合是同步的。?? 哪一組匹配是對的?()?A、?1?描述?b;?3?描述?c。B、?2?描述?d;?3?描述?b。C、?3?描述?a;?4?描述?b。D、?4?描述?a;?2?描述?c。25.public?class?Plant?{? private?String?name;? public?Plant(String?name)?{??=?name;?}? public?String?getName()?{?return?name;?}? }? public?class?Tree?extends?Plant?{? public?void?growFruit()?{?}? public?void?dropLeaves()?{?}? }? Which?is?true?()?A、?The?code?will?compile?without?changes.B、?The?code?will?compile?if?public?Tree()?{?Plant();?}?is?added?to?the?Tree?class.C、?The?code?will?compile?if?public?Plant()?{?Tree();?}?is?added?to?the?Plant?class.D、?The?code?will?compile?if?public?Plant()?{?this(”fern”);?}?is?added?to?the?Plant?class.E、?The?code?will?compile?if?public?Plant()?{?Plant(”fern”);?}?is?added?to?the?Plant?class.26.Which?two?create?an?instance?of?an?array?()?A、?int?ia?=?new?int?[15];B、?float?fa?=?new?float?[20];C、?char?ca?=?“Some?String”;D、?Object?oa?=?new?float[20];E、?Int?ia?=?(4,?5,?6)?(1,?2,?3)27.public?abstract?class?Shape?{? int?x;? int?y;? public?abstract?void?draw();? public?void?setAnchor(int?x,?int?y)?{? this.x?=?x;? this.y?=?y;? }? }? and?a?class?Circle?that?extends?and?fully?implements?the?Shape?class.?Which?is?correct?()?A、?Shape?s?=?new?Shape();?s.setAnchor(10,10);?s.draw();B、?Circle?c?=?new?Shape();?c.setAnchor(10,10);?c.draw();C、?Shape?s?=?new?Circle();?s.setAnchor(10,10);?s.draw();D、?Shape?s?=?new?Circle();?s->setAnchor(10,10);?s->draw();E、?Circle?c?=?new?Circle();?c.Shape.setAnchor(10,10);?c.Shape.draw();28.ArraryList?a?=?new?ArrayList();? a.add(“Alpha”);? a.add(“Bravo”):? a.add(“Charlie”);? a.add(“Delta”);? Iterator?iter?=?a.iterator(); Which?two,?added?at?line?17,?print?the?names?in?the?ArrayList?in?alphabetical?order?()A、?for?(int?i=0;?i29.class?java?{? public?static?void?main(String?[]?java)?{?? for?(int?Java?=?1;?Java?〈?java.length;?Java++)?? System.out.print("java?");?? }?? }?? 和命令行:? java?java?java?java?java?? 結(jié)果為:()??A、javaB、java?javaC、java?java?javaD、編譯失敗30.Click?the?’Select?and?Place’?button. Place?the?events?in?the?order?they?occur. 31.Which?thetwo?are?true?about?the?JSTL?core?iteration?custom?tags?()A、?It?may?iterate?over?arrays,?collections,?maps?and?strings.B、?The?body?of?the?tag?may?contain?EL?code,?but?not?scripting?code.C、?When?looping?over?collections,?a?loop?status?object?may?be?used?in?the?tag?body.D、?It?may?iterate?over?a?map,?but?only?the?key?of?the?mapping?may?be?used?in?the?tag?body.E、?When?looping?over?integers?(for?example?begin1=’1’?end=’10’),?a?loop?status?object?may?not?beused?in?the?tag?body.32.在Swing中,一下列出的面板的作用中,錯(cuò)誤的是()A、?放置并排列組件B、?顯示背景圖案C、?接收事件D、?顯示面板的邊框33.package?test;? class?Target?{? public?String?name?=?“hello”;? }? What?can?directly?access?and?change?the?value?of?the?variable?name?()?A、?any?classB、?only?the?Target?classC、?any?class?in?the?test?packageD、?any?class?that?extends?Target34.Which?statements?concerning?the?effect?of?the?statement?gfx.drawRect(5,?5,?10,?10)?are?true,?given?that?gfx?is?a?reference?to?a?valid?Graphics?object?()??A、The?rectangle?drawn?will?have?a?total?width?of?5?pixels.B、The?rectangle?drawn?will?have?a?total?height?of?6?pixels.C、The?rectangle?drawn?will?have?a?total?width?of?10?pixels.D、The?rectangle?drawn?will?have?a?total?height?of?11?pixels.35.1)?class?Person?{? 2)?public?void?printValue(int?i,?int?j)?{/*…*/?}???? 3)?public?void?printValue(int?i){/*...*/?}???? 4)?}? 5)?public?class?Teacher?extends?Person?{???? 6)?public?void?printValue()?{/*...*/?}???? 7)?public?void?printValue(int?i)?{/*...*/}???? 8)?public?static?void?main(String?args[]){???? 9)?Person?t?=?new?Teacher();???? 10)?t.printValue(10);???? 11)?}??? 12)?}? Which?method?will?the?statement?on?line?10?call??()??A、?on?line?2B、?on?line?3C、?on?line?6D、?on?line?736.public?class?Person?{? private?String?name,?comment;? private?int?age;? public?Person(String?n,?int?a,?String?c)?{? name?=?n;?age?=?a;?comment?=?c;? }? public?boolean?equals(Object?o)?{? if(!?(o?instanceof?Person))?return?false;? Person?p?=?(Person)o;? return?age?==?p.age?&&?name.equals();? }? }? What?is?the?appropriate?definition?of?the?hashCode?method?in?class?Person?()?A、?return?super.hashCode();B、?return?name.hashCode()?+?age?*?7;C、?return?name.hashCode()?+?comment.hashCode()?/2;D、?return?name.hashCode()?+?comment.hashCode()?/?2?-?age?*?3;37.class?Account?{?? private?int?balance;?? public?void?setBalance(int?b)?{?balance?=?b;?}? public?int?getBalance()?{?return?balance;?}?? public?void?clearBalance()?{?balance?=?0;?}?? }?? 哪一個(gè)改變可以使?Account?類線程安全?()?A、在第2行加?synchronized?修飾符。B、在第3行加?synchronized?修飾符。C、在第3行、第4行和第6行加?synchronized?修飾符。D、在第4行、第6行和第8行加?synchronized?修飾符。38.Which?statement?is?true?()??A、?A?flow?layout?can?be?used?to?position?a?component?that?should?resize?horizontally?when?the??container?is?resized.B、?A?grid?layout?can?be?used?to?position?a?component?tat?should?maintain?a?constant?size?even?when??the?container?is?resized.C、?A?border?layout?can?be?used?to?position?component?that?should?maintain?a?constant?size?even?when??the?container?is?resized.D、?The?grid?bag?layout?can?be?used?to?give?a?grid-like?layout?which?differs?from?the?normal?grid?in?that?individual?rows?and?columns?can?have?unique?sizes.E、?If?two?components?are?placed?in?the?same?column?of?a?grid?bag?layout,?and?one?component?resizes?horizontally,?then?the?other?component?must?resize?horizontally.39. What?is?the?value?of?the?variable?output?at?line?24???40.public?static?void?main(String[]?args)?{? try?{? args=null;? args[0]?=?“test”;? System.out.println(args[0]);? }?catch?(Exception?ex)?{? System.out.println(”Exception”);? }?catch?(NullPointerException?npe)?{? System.out.println(”NullPointerException”);? }? }? What?is?the?result?()?A、?testB、?ExceptionC、?Compilation?fails.D、?NullPointerException41.In?which?two?web?application?directories?can?dependent?classes?and?libraries?be?located??()A、?/WEB-INF/lib?as?a?JAR?fileB、?/META-INF/lib?as?a?JAR?fileC、?/classes?as?compiled?class?filesD、?/WEB-INF/lib?as?compiled?class?filesE、?/WEB-INF/classes?as?compiled?class?filesF、?/META-INF/classes?as?compiled?class?files42.以下關(guān)于Swing容器敘述,哪項(xiàng)錯(cuò)誤?()?A、容器是一種特殊的組件,它可用來放置其它組件B、容器是組成GUI所必需的元素C、容器是一種特殊的組件,它可被放置在其它容器中D、容器是一種特殊的組件,它可被放置在任何組件中43.A?RequestDispatcher?can?be?obtained?from?which?two?objects??()A、?ServletConfigB、?ServletContextC、?HttpServletRequestD、?HttpServletResponse44.javax.swing.JPopMenu類可用于()?A、?創(chuàng)建菜單項(xiàng)B、?創(chuàng)建按鈕C、?創(chuàng)建菜單欄D、?創(chuàng)建彈出式菜單45.內(nèi)部類與外部類的使用有何不同?46.public?class?Person?{? private?name;? public?Person(String?name)?{? ?=?name;? }? public?boolean?equals(Object?o)?{? if(?!o?instanceof?Person?)?return?false;? Person?p?=?(Person)?o;? return?.equals();? }? }? Which?is?true?()?A、?Compilation?fails?because?the?hashCode?method?is?not?overridden.B、?A?HashSet?could?contain?multiple?Person?objects?with?the?same?name.C、?All?Person?objects?will?have?the?same?hash?code?because?the?hashCode?method?is?not?overridden.D、?If?a?HashSet?contains?more?than?one?Person?object?with?name=”Fred”,?then?removing?anotherperson,?also?with?name=”Fred”,?will?remove?them?all.47.What?is?the?result?() A、Compilation?fails.B、atom?graniteC、granite?graniteD、atom?granite?graniteE、An?exception?is?thrown?at?runtime.F、atom?granite?atom?granite48.按鈕的事件處理類的主要作用是什么?()A、根據(jù)用戶點(diǎn)擊及時(shí)修改按鈕的外觀B、監(jiān)聽用戶對按鈕的點(diǎn)擊,及時(shí)作出響應(yīng)C、展示按鈕點(diǎn)擊時(shí)的動(dòng)畫效果D、設(shè)置按鈕對哪一類事件有反應(yīng)49.下面有關(guān)JVM內(nèi)存,說法錯(cuò)誤的是()。A、程序計(jì)數(shù)器是一個(gè)比較小的內(nèi)存區(qū)域,用于指示當(dāng)前線程所執(zhí)行的字節(jié)碼執(zhí)行到了第幾行,是線程隔離的B、Java方法執(zhí)行內(nèi)存模型,用于存儲局部變量,操作數(shù)棧,動(dòng)態(tài)鏈接,方法出口等信息,是線程隔離的C、方法區(qū)用于存儲JVM加載的類信息、常量、靜態(tài)變量、即使編譯器編譯后的代碼等數(shù)據(jù),是線程隔離的D、原則上講,所有的對象都在堆區(qū)上分配內(nèi)存,是線程之間共享的50.For?a?given?ServletResponse?response,which?two?retrieve?an?object?for?writing?text?data?()A、response.getWriter()B、response.getOutputStream()C、response.getOutputWriter()D、response.getWriter().getOutputStream()E、response.getWriter(Writer.OUTPUT_TEXT)51.下列敘述正確的是哪項(xiàng)?()A、事件繼承模型取代事件委托模型B、事件繼承模型比事件委托模型更加高效C、事件委托模型使用事件監(jiān)聽器來定義事件處理類的方法D、事件委托模型使用handleEvent()方法來支持事件處理52.類中不允許定義私有的構(gòu)造函數(shù)53.public?class?test?(?? public?static?void?main(string?args)?{?? int?1=?0;?? while?(i)?{?? if?(i==4)?{?? break;? }?? ++i;? }?? }?? )?? What?is?the?value?of?i?at?line?10?()A、?0B、?3C、?4D、?5E、?The?code?will?not?compile.54.以下關(guān)于Java文件名的敘述,正確的有?()A、Java源文件的擴(kuò)展名應(yīng)為.javaB、Java源文件的文件名應(yīng)與文件中的類名一致C、Java字節(jié)碼文件的擴(kuò)展名應(yīng)為.javaD、一個(gè)Java源文件中只能包含一個(gè)Java類55.關(guān)于object類,以下描述中正確的有()A、object類中定義了一些重要的成員函數(shù)和變量,以方便JAVA類的使用B、object類是所有其他JAVA類的直接或間接父類C、object類是一個(gè)非常特殊的“虛擬”類,也就是說,你只能叢object類中派生出其他類,但不能創(chuàng)建一個(gè)object類的對象。D、如果一個(gè)類已經(jīng)有了父類,那么這個(gè)類同時(shí)繼承了object類,也就是說,這時(shí)候這個(gè)類實(shí)際上有2個(gè)父類E、由于JAVA中的類是單繼承的,因此所有的類以object類為根形成了一棵繼承樹56.A?developer?is?designing?a?web?application?that?makes?many?fine-grained?remote?data?requests?for?eachclient?request.?During?testing,?the?developer?discovers?that?the?volume?of?remote?requests?significantlydegrades?performance?of?the?application. Which?design?pattern?provides?a?solution?for?this?problem?()A、FlyweightB、Transfer?ObjectC、Service?LocatorD、Dispatcher?ViewE、Business?DelegateF、Model-View-Controller57.有一個(gè)三位數(shù)滿足下列條件:? (1)三位數(shù)字各不相同;? (2)此數(shù)等于它的各位數(shù)字的立方和。求這種三位數(shù)的個(gè)數(shù)58.程序員正在進(jìn)行一個(gè)項(xiàng)目,必須實(shí)現(xiàn)equals方法與所給的hashCode方法協(xié)調(diào)運(yùn)行:? public?int?hashCode()?{??? return?(size.hashCode()?+?color.hashCode())?*?17;??? }??? 哪一個(gè)equals方法支持此目標(biāo)?()?A、?無法確定B、?public?boolean?equals(Object?o)?{??Sock?s?=?(Sock)?o;?return?size.equals(s.size);}C、?public?boolean?equals(Object?o)?{??Sock?s?=?(Sock)?o;?return?color.equals(s.color);}D、?public?boolean?equals(Object?o)?{??Sock?s?=?(Sock)?o;?return?size.equals(s.size)?&&color.equals(s.color);??}59.11.publicclassCommander{ 12.publicstaticvoidmain(String[]args){ 13.StringmyProp=/*insertcodehere*/ 14.System.out.println(myProp); 15.} 16.} andthecommandline: java-Dprop.custom=gobstopperCommander Whichtwo,placedonline13,willproducetheoutputgobstopper?()A、System.load("prop.custom");B、System.getenv("prop.custom");C、Sperty("prop.custom");D、System.getProperty("prop.custom");E、System.getProperties().getProperty("prop.custom");60.在一個(gè)彈性布局的面板中,如果有10個(gè)組件的話,最少需要多少條約束?()??A、10條B、22條C、2條D、40條61.byte?[]?arry1,?array2[];? byte?array3?[][];? byte[][]?array4;?? If?each?array?has?been?initialized,?which?statement?will?cause?a?compiler?error?()??A、?Array2?=?array1;B、?Array2?=?array3;C、?Array2?=?array4;D、?Both?A?and?BE、?Both?A?and?CF、?Both?B?and?C62.Click?the?Exhibit?button. The?h:highlight?tag?renders?its?body,?highlighting?an?arbitrary?number?of?words,?each?of?which?is?passed?asan?attribute?(word1,?word2,?...).?For?example,?a?JSP?page?can?invoke?theh:highlight?tag?as?follows: 11.? 12.?high?medium?low 13.? Given?that?HighlightTag?extends?SimpleTagSupport,which?three?steps?are?necessary?to?implement?the?taghandler?for?the?highlight?tag?()A、Add?a?doTag?methodB、Add?a?doStartTag?methodC、Add?a?getter?and?setter?for?the?color?attributeD、Create?and?implement?a?TagExtraInfo?classE、Implement?the?DynamicAttributes?interfaceF、Add?a?getter?and?setter?for?the?word1?and?word2?attributes63.CLASSPATH中的“.”的含義是哪項(xiàng)?()????A、省略號B、當(dāng)前目錄C、所有目錄D、上級目錄64.String?a?=?null;? a.concat(“abc”);? a.concat(“def”);? System.out.println(a);?? What?is?the?result?()??A、?abcB、?nullC、?abcdefD、?Compilation?fails.E、?The?code?runs?with?no?output.F、?An?exception?is?thrown?at?runtime.65.程序員想要?jiǎng)?chuàng)建一個(gè)名為MyThread的類以便在main方法中用Thread實(shí)例化。對于下面三行:? MyThread必須繼承Thread。????? MyThread必須實(shí)現(xiàn)Thread。? MyThread必須覆蓋public?void?run()。 有幾行是正確的()?A、?0B、?1C、?2D、?366.A?web?application?contains?a?tag?file?called?beta.tag?in?/WEB-INF/tags/alpha.?A?JSP?page?called?sort.jspexists?in?the?web?application?and?contains?only?this?JSP?code: 1. 3. The?sort.jsp?page?is?requested. Which?two?are?true?()A、Tag?files?can?only?be?accessed?using?a?tagdir?attribute.B、The?sort.jsp?page?translates?successfully?and?invokes?the?tag?defined?by?beta.tag.C、The?sort.jsp?page?produces?a?translation?error?because?a?taglib?directive?must?always?have?a?uriattribute.D、Tag?files?can?only?be?placed?in?/WEB-INF/tags,?and?NOT?in?any?subdirectories?of?/WEB-?INF/tags.E、The?tagdir?attribute?in?line?2?can?be?replaced?by?a?uri?attribute?if?a?TLD?referring?to?beta.tag?is?createdand?added?to?the?web?application.67.以下變量類型中,不屬于簡單變量類型的是()A、一串字符串;B、一個(gè)邏輯值;C、一個(gè)字符;D、雙精度浮點(diǎn)數(shù);68.interface?Altitude?{? //insert?code?here?? }?? 和4個(gè)聲明:?? int?HIGH?=?7;? public?int?HIGH?=?7;??? abstract?int?HIGH?=?7;?? interface?int?HIGH?=?7;? 分別插入到第2行,有多少行可以編譯?()??A、?0B、?1C、?2D、?3E、?469.class?BaseClass{?? private?float?x=?1.0f;?? protected?void?setVar?(float?f)?{x?=?f;}?? }?? class?SubClass?exyends?BaseClass?{?? private?float?x?=?2.0f;?? //insert?code?here??8.?}?? Which?two?are?valid?examples?of?method?overriding?()A、?Void?setVar(float?f)?{x?=?f;}B、?Public?void?setVar(int?f)?{x?=?f;}C、?Public?void?setVar(float?f)?{x?=?f;}D、?Public?double?setVar(float?f)?{x?=?f;}E、?Public?final?void?setVar(float?f)?{x?=?f;}F、?Protected?float?setVar()?{x=3.0f;?return?3.0f;?}70.55.int[]x={1,2,3,4,5}; 56.inty[]=x; 57.System.out.println(y[2]); Whichistrue?() A、Line57willprintthevalue2.B、Line57willprintthevalue3.C、Compilationwillfailbecauseofanerrorinline55.D、Compilationwillfailbecauseofanerrorinline56.71.publicclassYippee2{ staticpublicvoidmain(String[]yahoo){ for(intx=1;xA、abB、bcC、abcD、Compilationfails.E、Anexceptionisthrownatruntime.72.A?programmer?iterates?over?the?TreeSet?and?prints?the?name?of?each?Drink?object.??What?is?the?result?() A、TeaB、CoffeeC、Coffee?TeaD、Compilation?fails.E、The?code?runs?with?no?output.F、An?exception?is?thrown?at?runtime.73.現(xiàn)有:?? 1.?class?Book?{?? 2.?private?final?void?read()?{?System.out.print("book?");?}?? 3.?}?? 4.?class?Page?extends?Book?{?? 5.?public?static?void?main(String?[]?args)?{?? 6.?//?insert?code?here?? 7.?}?? 8.?private?final?void?read()?{?System.out.print("page?");?}?? 9.?}?? 和如下三個(gè)代碼片段(?x,?y,?z?):?? x.?//?just?a?comment?? y.?new?Page().read();? z.?new?Book().read();?? 分別插入到第6行,有幾個(gè)允許代碼通過編譯并可以運(yùn)行且無異常?()?A、?0B、?1C、?2D、?374.在正方體上任取三個(gè)頂點(diǎn)連成三角形,則所得的三角形是直角非等腰三角形的概率為()。A、1/14B、4/7C、2/7D、3/775.以下哪些包是Java標(biāo)準(zhǔn)庫中常用的包?()???A、java.langB、javax.servlet?.httpC、j?ava.?ioD、java.sql76.public?class?Test?{? public?static?void?main(String?Args[])?{? int?i?=1,?j?=?0;? switch(i)?{? case?2:?j?+=6;? case?4:?j?+=1;? default:?j?+=2;? case?0:?j?+=4;? }? System.out.println(“j?=”?+j);? }? }? What?is?the?result??()?A、?0B、?2C、?4D、?6E、?9F、?1377.Click?the?’Select?and?Place’?button. Place?the?events?in?the?order?they?occur. 78. A?session-scoped?attribute,?product,?is?stored?by?a?servlet.?That?servlet?then?forwards?to?a?JSP?page.?This?attribute?holds?an?instance?of?the?com.Company.?? Product?class?with?a?name?property?of?“The?Matrix”?and?price?property?of?39.95.?Given?the?JSP?page?code?snippet: What?is?the?response?output?of?this?JSP?page?code?snippet??()A、?Default?costs?0.0B、?Default?costs?49.95C、?Default?costs?39.95D、?The?Matrix?costs?0.0E、?The?Matrix?costs?49.95F、?The?Matrix?costs?39.9579.請談?wù)剬ibernate的理解,并簡要敘述Hibernate的一級緩存和二級緩存。80.A?developer?has?created?a?special?servlet?that?is?responsible?for?generating?XML?content?that?is?sent?to?adata?warehousing?subsystem.?This?subsystem?uses?HTTP?to?request?these?large?data?files,?which?arecompressed?by?the?servlet?to?save?internal?network?bandwidth.?The?developer?has?received?a?request?frommanagement?to?create?several?more?of?these?data?warehousing?servlets.?The?developer?is?about?to?copyand?paste?the?compression?code?into?each?new?servlet. Which?design?pattern?can?consolidate?thiscompression?code?to?be?used?by?all?of?the?data?warehousing?servlets?()A、FacadeB、View?HelperC、Transfer?ObjectD、Intercepting?FilterE、Composite?Facade81.Float?pi?=?new?Float(3.14f);? if(pi>3)?{? System.out.print(”pi?is?bigger?than?3.?“);? }? else?{? System.out.print(”pi?is?not?bigger?than?3.?“); }? finally?{? System.out.println(”Have?a?nice?day.”);? }? What?is?the?result?()?A、?Compilation?fails.B、?pi?is?bigger?than?3.C、?An?exception?occurs?at?runtime.D、?pi?is?bigger?than?3.?Have?a?nice?day.E、?pi?is?not?bigger?than?3.?Have?a?nice?day.82.package?foo;? import?java.util.Vector; private?class?MyVector?extends?Vector?{? int?i?=?1;? public?MyVector()?{? i?=?2; } }? public?class?MyNewVector?extends?MyVector?{? public?MyNewVector()?{? i?=?4;? }? public?static?void?main(String?args[])?{? MyVector?v?=?new?MyNewVector();? }? }? What?is?the?result?()A、?Compilation?succeeds.B、?Compilation?fails?because?of?an?error?at?line?5.C、?Compilation?fails?because?of?an?error?at?line?6.D、?Compilation?fails?because?of?an?error?at?line?14.E、?Compilation?fails?because?of?an?error?at?line?17.83.Which?statement?is?true?() A、The?equals?method?does?NOT?properly?override?the?Object.equals?method.B、Compilation?fails?because?the?private?attribute??cannot?be?accessed?in?line?5.C、To?work?correctly?with?hash-based?data?structures,?this?class?must?also?implement?the?hashCode?method.D、When?adding?Person?objects?to?a?java.util.Set?collection,?the?equals?method?in?line?4?will?prevent?duplicates.84.What?will?be?written?to?the?standard?output?when?the?following?program?is?run?()? public?class?Qd803?{?? public?static?void?main(String?args[])?{?? String?word?=?"restructure";?? System.out.println(word.substring(2,?3));?? }?? }??A、estB、esC、strD、stE、s85.建立Sochet類的服務(wù)器端需要哪些步驟?()A、服務(wù)器端對任意指定的IP地址和端口號進(jìn)行監(jiān)聽B、監(jiān)聽端口,等待客戶端的連接C、建立一個(gè)服務(wù)器端對象,提供監(jiān)聽的端口號D、當(dāng)獲得其它客戶端的連接后,停止監(jiān)聽,創(chuàng)建一個(gè)Socket類,用于通訊E、服務(wù)器端在此端口繼續(xù)進(jìn)行監(jiān)聽86.public?class?MethodOver?{? private?int?x,?y;? private?float?z;? public?void?setVar(int?a,?int?b,?float?c){? x?=?a;? y?=?b;? z?=?c;? }? }?? Which?two?overload?the?setVar?method?()???A、??void?setVar?(int?a,?int?b,?float?c){?x?=?a;?y?=?b;?z?=?c;?}B、?public?void?setVar(int?a,?float?c,?int?b)?{?setVar(a,?b,?c);?}C、?public?void?setVar(int?a,?float?c,?int?b)?{?this(a,?b,?c);?}D、?public?void?setVar(int?a,?float?b){?x?=?a;?z?=?b;?}E、?public?void?setVar(int?ax,?int?by,?float?cz)?{?x?=?ax;?y?=?by;?z?=?cz;?}87.public?class?OuterClass?{? private?double?d1??1.0;? //insert?code?here?? }?? You?need?to?insert?an?inner?class?declaration?at?line2.?Which?two?inner?class?declarations?are?valid?()?A、?static?class?InnerOne?{??public?double?methoda()?{return?d1;}??}B、?static?class?InnerOne?{??static?double?methoda()?{return?d1;}?}C、?private?class?InnerOne?{??public?double?methoda()?{return?d1;}?}D、?protected?class?InnerOne?{??static?double?methoda()?{return?d1;}?}E、?public?abstract?class?InnerOne?{??public?abstract?double?methoda();??}88.Which?will?declare?a?method?that?forces?a?subclass?to?implement?it?()?A、?Public?double?methoda();B、?Static?void?methoda?(double?d1)?{}C、?Public?native?double?methoda();D、?Abstract?public?void?methoda();E、?Protected?void?methoda?(double?d1){}89.1.?class?TestA?{? 2.?TestB?b;? 3.?TestA()?{? 4.?b?=?new?TestB(this);? 5.?}? 6.?}? 7.?class?TestB?{? 8.?TestA?a;? 9.?TestB(TestA?a)?{? 10.?this.a?=?a;? 11.?}? 12.?}? 13.?class?TestAll?{? 14.?public?static?void?main?(String?args[])?{? 15.?new?TestAll().makeThings(); 16.?//?...code?continues?on? 17.?}? 18.?void?makeThings()?{? 19.?TestA?test?=?new?TestA(); 20.?}? 21.?}? Which?two?statements?are?true?after?line?15,?before?main?completes?()A、?Line?15?causes?a?stack?overflow.B、?An?exception?is?thrown?at?runtime.C、?The?object?referenced?by?a?is?eligible?for?garbage?collection.D、?The?object?referenced?by?b?is?eligible?for?garbage?collection.E、?The?object?referenced?by?a?is?not?eligible?for?garbage?collection.F、?The?object?referenced?by?b?is?not?eligible?for?garbage?collection.90.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、?foofoofoobarfoo91.Which?JSTL?code?snippet?can?be?used?to?perform?URL?rewriting?()A、’?/>B、’?/>C、’?/>D、’?/>92.What?is?the?result?() A、0,?0,?0B、150,?60,?0C、Compilation?fails.D、150,?150,?150E、An?exception?is?thrown?at?runtime.93.為將數(shù)組myArray的長度由6改為10,現(xiàn)采取以下編碼:? int[]?myArray?=?new?int[6];?? myArray?=?new?int[10];?(覆蓋)?? 代碼執(zhí)行后,以下敘述哪項(xiàng)是正確的?()??A、?數(shù)組myArray的長度已由6改為10,其中前6個(gè)元素的值不變,后四個(gè)元素的值為空。B、?數(shù)組myArray的長度已由6改為10,其中前6個(gè)元素的值不變,后四個(gè)元素需再經(jīng)過初始化后才能使用。C、?數(shù)組myArray的長度已由6改為10,原來6個(gè)元素的值全部丟失。D、?數(shù)組myArray的長度沒有變化。94.public?class?Drink?implements?Comparable?{? public?String?name;? public?int?compareTo(Object?o)?{? return?0;? }? }? and:? Drink?one?=?new?Drink();? Drink?two?=?new?Drink();? =?“Coffee”;? =?“Tea”;? TreeSet?set?=?new?TreeSet();? set.add(one);? set.add(two);? A?programmer?iterates?over?the?TreeSet?and?prints?the?name?of?each?Drink?object.?What?is?the?result?()?A、?TeaB、?CoffeeC、?Coffee
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二手房出租合同范文2024年
- 業(yè)務(wù)委托合同協(xié)議書樣本
- 2024年集裝箱出租合同書
- 講師與教育平臺合作合同
- 買賣房屋定金協(xié)議書
- 房屋租賃合同的違約責(zé)任解析
- 中小學(xué)信息技術(shù)教師應(yīng)具備哪些能力與素質(zhì)
- 簡單卷閘門合同書樣本2024年
- 2024年國際快遞合作協(xié)議書
- 客戶服務(wù)協(xié)議書
- 副總經(jīng)理招聘面試題及回答建議(某大型國企)
- 期中測試卷(試題)-2024-2025學(xué)年統(tǒng)編版語文五年級上冊
- 建筑工地臺風(fēng)過后復(fù)工復(fù)產(chǎn)工作方案
- 借款協(xié)議(父母借款給子女買房協(xié)議)(二篇)
- 稅務(wù)師涉稅服務(wù)相關(guān)法律真題2021年
- 2024年太倉市城市建設(shè)投資集團(tuán)限公司公開招聘3人高頻難、易錯(cuò)點(diǎn)500題模擬試題附帶答案詳解
- 琴行培訓(xùn)機(jī)構(gòu)合同協(xié)議書
- 少兒趣味編程Scratch綜合實(shí)戰(zhàn)《小車巡線》教學(xué)設(shè)計(jì)
- 中國融通集團(tuán)招聘筆試題庫2024
- 期中測試卷(1-4單元)(試題)2024-2025學(xué)年人教版數(shù)學(xué)六年級上冊
- ICU譫妄患者的護(hù)理
評論
0/150
提交評論