




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
“人人文庫”水印下載源文件后可一鍵去除,請放心下載!(圖片大小可任意調節)2024年計算機考試-Java認證筆試參考題庫含答案“人人文庫”水印下載源文件后可一鍵去除,請放心下載!第1卷一.參考題庫(共75題)1.現有:? 1.class?SuperFoo{? 2.SuperFoo?doStuff?(int?x)??{????? 3.return?new?SuperFoo();????? 4.????}????? 5.??}????? 6.? 7.?class?Foo?extends?SuperFoo??{???? 8.????//insert?code?here???? 9.??}? 和四個聲明:?? Foo?doStuff?(int?x)??{??return?new?Foo();??}? Foo?doStuff?(int?x)??{??return?new?SuperFoo();??}????? SuperFoo?doStuff(int?x)??{??return?new?Foo();??}? SuperFoo?doStuff(int?y)??{??return?new?SuperFoo();??}??? 分別插入到第8行,有幾個可以通過編澤?()????A、?1B、?2C、?3D、?42.When?line?14?is?reached,?how?many?objects?are?eligible?for?the?garbage?collector?() A、0B、1C、2D、3E、4F、63.Which?methods?from?the?String?and?StringBuffer?classes?modify?the?object?on?which?they?are?called?()??A、The?charAt()?method?of?the?String?class.B、The?toUpperCase()?method?of?the?String?class.C、The?replace()?method?of?the?String?class.D、The?reverse()?method?of?the?StringBuffer?class.E、The?length()?method?of?the?StringBuffer?class.4.11.?public?class?Commander?{? 12.?public?static?void?main(String[]?args)?{? 13.?String?myProp?=?/*?insert?code?here?*/? 14.?System.out.println(myProp);? 15.?}? 16.?}? and?the?command?line:? java?-Dprop.custom=gobstopper?Commander? Which?two,?placed?on?line?13,?will?produce?the?output?gobstopper?()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”);5.定義一個表示學生信息的類Student,要求如下:?? (1)類Student的成員變量:? sNO?表示學號;sName表示姓名;sSex表示性別;sAge表示年齡;sJava:表示Java課程成績。? (2)類Student帶參數的構造方法:?? 在構造方法中通過形參完成對成員變量的賦值操作。? (3)類Student的方法成員:? getNo():獲得學號;?? getName():獲得姓名;?? getSex():獲得性別;? getAge()獲得年齡;? getJava():獲得Java?課程成績? (4)根據類Student的定義,創建五個該類的對象,輸出每個學生的信息,計算并輸出這五個學生Java語言成績的平均值,以及計算并輸出他們Java語言成績的最大值和最小值。6.現有如下類型:?? a?-?java.util.Hashtable? b?-?java.util.List? c?-?java.util.ArrayList? d?-?java.util.SortedSet? 和定義:? 1?–?使用本接口,允許用戶控制集合中每個元素的插入位置。?? 2?–?使用本集合,確保用戶可以按照遞增或元素的自然順序遍歷集合。?? 3?–?本具體類型允許空元素及基于索引的訪問。??? 4?–?本集合是同步的。?? 哪一組匹配是對的?()?A、?1?描述?b;?3?描述?c。B、?2?描述?d;?3?描述?b。C、?3?描述?a;?4?描述?b。D、?4?描述?a;?2?描述?c。7. Which?statement?at?Point?X?on?line?1?allows?this?code?to?compile?and?run?()A、?import?java.io.*.;B、?include?java.io.*;C、?import?java.io.PrintWriter;D、?include?java.io.PrintWRiter;E、?No?statement?in?needed.8.如果不使用布局管理器,會出現哪些問題?()A、當界面縮放時,會失去原有的外觀;B、當界面最小化時,組件不會最小化;C、當界面縮放時,組件會隨機地移動;D、高分辨率下設計的界面,在低分辨率下可能會超出桌面范圍,從面無法看到;E、對每一個組件,都需要指定它的坐標位置;9.Java?SE?JDK中類庫java.text的用途是哪項?()A、工具類B、輸出輸入支持類C、文本處理和格式化類D、結構化查詢語言(SQL)支持類10.下列敘述正確的是哪項?()A、事件繼承模型取代事件委托模型B、事件繼承模型比事件委托模型更加高效C、事件委托模型使用事件監聽器來定義事件處理類的方法D、事件委托模型使用handleEvent()方法來支持事件處理11.Which?two?are?true?()A、?An?encapsulated,?public?class?promotes?re-use.B、?Classes?that?share?the?same?interface?are?always?tightly?encapsulated.C、?An?encapsulated?class?allows?subclasses?to?overload?methods,?but?does?NOT?allow?overriding?methods.D、?An?encapsulated?class?allows?a?programmer?to?change?an?implementation?without?affecting?outside?code.12.A?programmer?needs?to?create?a?logging?method?that?can?accept?an?arbitrary?number?of?arguments.?For?example,?it?may?be?called?in?these?ways:? logIt(”log?message?1?“);? logIt(”log?message2”,”log?message3”);? logIt(”log?message4”,?“log?message5”,?“log?message6);? Which?declaration?satisfies?this?requirement?()A、?public?void?logIt(String?*?msgs)B、?public?void?logIt(String?[]?msgs)C、?public?void?logIt(String...?msgs)D、?public?void?logIt(String?msg1,?String?msg2,?String?msg3)13.輸入一個字符串,其中包含數字、特殊符號(像:¥、&、(、>等)、大小寫字母等,然后輸出每個字符串或符號的ASCII碼的和;例如:輸入“@#$%^&*():"|”,則打印出643。14.Given?the?following?code: What?is?the?result()。A、The?program?prints”0”B、The?program?prints”4”C、The?program?prints”8”D、The?program?prints”12”E、The?code?does?not?complete.15.程序員已經創建了一個類,該類的實例可以用做Hashtable?的鍵(key)。哪兩項是對的?()????A、該類有一個返回類型為?int?的?equals?方法。B、該類有一個返回類型為?boolean?的?equals?方法。C、該類有一個接收一個參數的?equals?方法。D、該類有一個接收兩個參數的?equals?方法。16.System.out.println(Math.sqrt(-4D));??What?is?the?result?()??A、?–2B、?NaNC、?InfinityD、?Compilation?fails.E、?An?exception?is?thrown?at?runtime.17.Which?three?code?fragments,?added?individually?at?line?29,?produce?the?output?100?() A、n?=?100;B、i.setX(100);C、o.getY().setX(100);D、i?=?new?Inner();?i.setX(100);E、o.setY(i);?i?=?new?Inner();?i.setX(100);F、i?=?new?Inner();?i.setX(100);?o.setY(i);18.愛因斯坦曾出過這樣一道有趣的數學題:有一個長階梯,每步上2階,最后剩1階;若每步上3階,最后剩2階;若每步上5階,最后剩4階;若每步上6階,最后剩5階;只有每步上7階,最后一階也不剩。請問該階梯至少有多少階。編寫一個Java程序解決該問題。19.內存垃圾回收將刪除無法訪問的對象20.為了從文本文件中逐行讀取內容,應該使用哪個處理流對象?()?????A、?BufferedReaderB、?BufferedWriterC、?BufferedInputStreamD、?BufferedOutputStream21.現有:? public??class??TestDemo{???? private?int?X-2;????? static?int?y=3;? public??void?method(){????? final?int?i=100;????? int?j??=10;???? class?Cinner?{? public?void?mymethod(){????? //Here?????}?????}?????}?????} 在Here處可以訪問的變量是哪些?()?A、XB、yC、jD、i22.現有:? package?mypack;? import?javax.swing.JButton;????? import?javax.swing.JFrame;? public?class?Butt?extends??JFrame??{???? public?static?v.id?main(string[]??args)??{????? //??TODO?Auto-generated?method?stub????? Butt?butt=new?Butt();?????}? Butt(){? JButton??jbl=new?JButton("Hello");????? JButton?jb2=new?JButton("World");????? add(jbl);????? add(jb2);? setSize(300,300);????? setVisible(true);?????}????} 下列關于代碼運行效果的敘述正確的是哪項??()???A、2個按鈕緊靠著排列,Hello在World的左側B、?Hello占據Frame的整個區域C、?World占據Frame的整個區域D、2個按鈕都在Frame的頂部23.小程序的起始執行函數是什么?()???A、?init函數,用于初始化小程序B、?start函數,用于啟動小程序C、?main函數,是入口函數D、?run函數,使小程序線程的啟動函數24.什么是單例模式(Singleton)?請在下面寫出一個單例模式類,并支持多線程調用。25.猴子吃桃問題:猴子第一天摘下若干個桃子,當即吃了一半,還不癮,又多吃了一個第二天早上又將剩下的桃子吃掉一半,又多吃了一個。以后每天早上都吃了前一天剩下的一半零一個。到第10天早上想再吃時,見只剩下一個桃子了。求第一天共摘了多少。26.class?super?(?? public?int?I?=?0;?? public?super?(string?text)?(?? I?=?1?? )?? )?? public?class?sub?extends?super?(?? public?sub?(string?text)?(?? i=?2?? )?? public?static?void?main?(straing?args)?(? sub?sub?=?new?sub?(“Hello”);?? system.out.?PrintIn(sub.i);? )?? )?? What?is?the?result?()A、?Compilation?will?fail.B、?Compilation?will?succeed?and?the?program?will?print?“0”C、?Compilation?will?succeed?and?the?program?will?print?“1”D、?Compilation?will?succeed?and?the?program?will?print?“2”27.求能被3整除且至少有一位數字為5的三位數的個數28.import語句的作用是()A、導入包中成員B、創建包C、既可導入包成員,也可創建包D、訪問控制29.public?class?Mycircle?{?? public?double?radius;?? public?double?diameter;?? public?void?setRadius(double?radius)?? this.radius?=?radius;?? this.diameter=?radius?*?2;?? }?? public?double?getRadius()?{? return?radius;?? }?? Which?statement?is?true?()??A、?The?Mycircle?class?is?fully?encapsulated.B、?The?diameter?of?a?given?MyCircle?is?guaranteed?to?be?twice?its?radius.C、?Lines?6?and?7?should?be?in?a?synchronized?block?to?ensure?encapsulation.D、?The?radius?of?a?MyCircle?object?can?be?set?without?affecting?its?diameter.30.10.?public?class?Hello?{? 11.?String?title;? 12.?int?value;? 13.?public?Hello()?{? 14.?title?+=?“?World”;? 15.?}? 16.?public?Hello(int?value)?{? 17.?this.value?=?value;? 18.?title?=?“Hello”;? 19.?Hello();? 20.?}? 21.?}? and:? 30.?Hello?c?=?new?Hello(5);? 31.?System.out.println(c.title);? What?is?the?result?()?A、?HelloB、?Hello?WorldC、?Compilation?fails.D、?Hello?World?5E、?The?code?runs?with?no?output.F、?An?exception?is?thrown?at?runtime.31.10.?class?Line?{? 11.?public?class?Point?{?public?int?x,y;?}? 12.?public?Point?getPoint()?{?return?new?Point();?}? 13.?}? 14.?class?Triangle?{? 15.?public?Triangle()?{? 16.?//?insert?code?here? 17.?}? 18.?}? Which?code,?inserted?at?line?16,?correctly?retrieves?a?local?instance?of?a?Point?object?()?A、?Point?p?=?Line.getPoint();B、?Line.Point?p?=?Line.getPoint();C、?Point?p?=?(new?Line()).getPoint();D、?Line.Point?p?=?(new?Line()).getPoint();32.下列關于容器集合類的說法正確的是()。A、LinkedList繼承自ListB、AbstractSet繼承自SetC、HashSet繼承自AbstractSeD、WeakMap繼承自HashMap33.What?is?the?resultasfollows?() A、5,6B、5,5C、6,5D、6,634.現有代碼片段:????? String??s="123";????? String?sl=S+456;? 請問sl的結果是哪項?()?????A、?123456B、?579C、編譯錯誤D、運行時拋出異常35.class?Foo?{? public?static?void?main(String?[]?args)?{? int?x?=?0;? int?y?=?4;? for(int?z=0;?z?〈?3;?z++,?x++)?{? if(x?〉?1?&?++y?〈?10) y++;? }? System.out.println(y);? }? }? 結果是什么?()??A、6B、7C、8D、1036.java語言中int類型數據占用多少位()A、?32B、?64C、?16D、?2037.What?is?the?result?() A、A,B,CB、B,C,AC、Compilation?fails.D、The?code?runs?with?no?outputE、An?exception?is?thrown?at?runtime.38.class?WhileTests?{ public?static?void?main(String?[]?args)?{? int?x?=?5;? while?(++x?〈?3)?{? --x;? }? System.out.println("x?=?"?+?x);? }? } 結果是什么?()A、x?=?2B、x?=?5C、x?=?6D、編譯失敗39.What?is?the?result?when?method?testIfA?is?invoked?() A、TrueB、Not?trueC、An?exception?is?thrown?at?runtime.D、Compilation?fails?because?of?an?error?at?line?12.E、Compilation?fails?because?of?an?error?at?line?19.40.Given?that?login.getName()?returns?a?java.lang.String?value?and?given?the?JSP?code:??Welcome?Which?is?equivalent?()A、?Welcome??B、?Welcome??C、?Welcome?D、?Welcome??E、?Welcome?41.publicclassTest{ publicstaticvoidmain(String[]args){ intx=5; booleanb1=true; booleanb2=false; if((x==4)&&!b2) System.out.print("l"); System.out.print("2"); if((b2=true)&&b1) System.out.print("3"); } } Whatistheresult?()A、2B、3C、12D、23E、123F、Compilationfails.G、Anexceptionalisthrownatruntime.42.輾轉相除法:從鍵盤輸入兩個數51211314和84131421,利用輾轉相除法求它們的最大公約數。求需要經過多少次輾轉43.What?is?the?result?() A、The?code?will?deadlock.B、The?code?may?run?with?no?output.C、An?exception?is?thrown?at?runtime.D、The?code?may?run?with?output?"0?6".E、The?code?may?run?with?output?"2?0?6?4".F、The?code?may?run?with?output?"0?2?4?6".44.完成數組int[]a={100,40,60,87,34,11,56,0}的快速排序、冒泡排序45.Which?interface?does?java.util.Hashtable?implement?()??A、?java.util.MapB、?java.util.ListC、?java.util.HashableD、?java.util.Collection46.(1)編寫一個圓類Circle,該類擁有:? ①一個成員變量? Radius(私有,浮點型);??//?存放圓的半徑;? ②兩個構造方法? ??????????Circle(?)?????????????????//?將半徑設為0? ??????????Circle(double??r?)?????????//創建Circle對象時將半徑初始化為r???????? ③?三個成員方法? ????????????double?getArea(?)???????//獲取圓的面積 ?????????????double?getPerimeter(?)???//獲取圓的周長? ????????????void??show(?)??????????//將圓的半徑、周長、面積輸出到屏幕? (2)編寫一個圓柱體類Cylinder,它繼承于上面的Circle類。還擁有:? ①一個成員變量? double?hight(私有,浮點型);??//?圓柱體的高;? ②構造方法? ??????????Cylinder?(double?r,?double??h?)???????????//創建Circle對象時將半徑初始化為r? ③?成員方法? ????????????double?getVolume(?)?????????????//獲取圓柱體的體積? ????????????void??showVolume(?)?????????????//將圓柱體的體積輸出到屏幕? 編寫應用程序,創建類的對象,分別設置圓的半徑、圓柱體的高,計算并分別顯示圓半徑、圓面積、圓周長,圓柱體的體積。47.For?which?three?events?can?web?application?event?listeners?be?registered??()A、?when?a?session?is?createdB、?after?a?servlet?is?destroyedC、?when?a?session?has?timed?outD、?when?a?cookie?has?been?createdE、?when?a?servlet?has?forwarded?a?requestF、?when?a?session?attribute?value?is?changed48.Click?the?’Select?and?Place’?button. Place?the?events?in?the?order?they?occur. 49.以下關于File?類的敘述,哪兩項正確?()A、File?類位于java.io?包中B、創建一個File?類的實例將導致打開指定文件進行讀寫C、File?實例封裝了指定文件的信息D、File?實例不能用于封裝目錄50.求表達式e^x≈1+x+x^2/2!+x^3/3!+x^4/4!……+x^n/n!的近似值,設x=9,n=2551.11.?double?input?=?314159.26;? 12.?NumberFormat?nf=?NumberFormat.getInstance(Locale.ITALIAN);? 13.?String?b;? 14.?//insert?code?here? Which?code,?inserted?at?line?14,?sets?the?value?of?b?to?3?14.159,26?()?A、?b?=?nf.parse(?input);B、?b?=?nf.format(?input);C、?b?=?nf.equals(?input);D、?b?=?nf.parseObject(?input);52.在類的繼承中,構造函數如何處理?()A、子類的構造函數覆蓋父類的構造函數B、以父類的構造函數為準,子類沒有自己的構造函數C、先執行父類的構造函數,再執行子類的構造函數D、如果父類的構造函數帶參數,則子類必須在構造函數的開頭用super()顯式地調用父類的構造函數E、除非子類在夠在函數中用super()顯式地調用,否則不會執行父類的構造函數53.class?Wrench?{? public?static?void?main(String?[]?args)?{? Wrench?w?=?new?Wrench();?Wrench?w2?=?new?Wrench();? w2?=?go(w,w2);? System.out.print(w2?==?w);? }? static?Wrench?go(Wrench?wr1,?Wrench?wr2)?{? Wrench?wr3?=?wr1;?wr1?=?wr2;?wr2?=?wr3;? return?wr3; }? }? 結果是什么?()?A、trueB、falseC、編譯失敗D、輸出不可預期54.求滿足以下條件的(a,b,c)的組數: (1)1/(a^2)+1/(b^2)=1/(c^2) (2)a>b>c (3)a+b+c<10055.class?Ifs{?? public?static?void?main(String[]?args){?? boolean?state=false;? ?int?i=1;?? if((++i>1)&&(state=true))?? i++;?? System.out.println(i);??}??} 結果是()??A、5B、編譯失敗C、運行時異常被拋出D、3E、456.輸入兩個正整數m和n,求其最大公約數和最小公倍數。57.同一個包的子類能否訪問父類的保護級成員變量?()A、可以訪問B、不能訪問C、可以訪問,但不能從父類中繼承保護級成員D、不能訪問,但可以從父類中繼承保存級成員58.已知: 下面哪些語句是和第2行等價的()A、publicinti=1;B、staticinti=1;C、finalinti=1;D、abstractinti=1;59.客戶端C和服務器S之間建立一個TCP連接,該連接總是以1KB的最大段長發送TCP段,客戶端C有足夠的數據要發送。當擁塞窗口為16KB的時候發生超時,如果接下來的4個RTT往返時間內的TCP段的傳輸是成功的,那么當第4個RTT時間內發送的所有TCP段都得到了ACK時,擁塞窗口大小是()。A、7KBB、8KBC、9KBD、16KB60.Under?what?two?circumstances?is?the?set?JspBody?method?NOT?called?in?a?tag?class?that?implements?the?Simple?Tag?interface??()A、?The?tag?is?invoked?without?a?body.B、?The?doTAb?method?throws?an?exception.C、?The??element?has?the?value?empty.D、?The?tag?is?called?with?the?attribute?skip-body=true61.Given?a?class?Repetition:? 1.?package?utils;? 2.? 3.?public?class?Repetition?{? 4.?public?static?String?twice(String?s)?{?return?s?+?s;?}? 5.?}? and?given?another?class?Demo:? 1.?//?insert?code?here 2.? 3.?public?class?Demo?{? 4.?public?static?void?main(String[]?args)?{? 5.?System.out.println(twice(”pizza”));? 6.?}? 7.?}? Which?code?should?be?inserted?at?line?1?of?Demo.java?to?compile?and?run?Demo?to?print“pizzapizza”?()?A、?import?utils.*;B、?static?import?utils.*;C、?import?utils.Repetition.*;D、?static?import?utils.Repetition.?*;E、?import?utils.Repetition.twice();F、?import?static?utils.Repetition.twice;G、?static?import?utils.Repetition.twice;62.設計一個汽車類Multiplication,在其中定義三個同名的mul方法:第一個方法是計算兩個整數的積;第二個方法是計算兩個浮點數的積;第三個方法是計算三個浮點數的積。63.public?class?ItemTest?{? private?final?mt?id;? public?ItemTest(int?id)?{?this.id?=?id;?}? public?void?updateId(int?newId)?{?id?=?newId;?}? public?static?void?main(String[]?args)?{? ItemTest?fa?=?new?ItemTest(42);? fa.updateId(69);? System.out.println(fa.id);? }? }? What?is?the?result?()?A、?Compilation?fails.B、?An?exception?is?thrown?at?runtime.C、?The?attribute?id?in?the?Item?object?remains?unchanged.D、?The?attribute?id?in?the?Item?object?is?modified?to?the?new?value.E、?A?new?Item?object?is?created?with?the?preferred?value?in?the?id?attribute.64.You?need?to?retrieve?the?username?cookie?from?an?HTTP?request.?If?this?cookie?does?NOT?exist,?then?the?cvariable?will?be?null. Which?code?snippet?must?be?used?to?retrieve?this?cookie?object?()A、B、C、D、65.兩個字符串連接程序66.Public?class?test?(??? Public?static?void?stringReplace?(String?text)?(??? Text?=?text.replace?(?j??,??i?);??? )???? ?public?static?void?bufferReplace?(StringBuffer?text)?(??? text?=?text.append?(“C”)???)???? ?public?static?void?main?(String?args?){? String?textString?=?new?String?(“java”);??? StringBuffer?text?BufferString?=?new?StringBuffer?(“java”);????? stringReplace?(textString);??? BufferReplace?(textBuffer);????? System.out.printIn?(textString?+?textBuffer);?? ?}?? )?? What?is?the?output?()67.什么是方法的覆蓋?方法的覆蓋與域的隱藏有何不同?與方法的重載有何不同?68.Given?a?Filter?class?definition?with?this?method: 21.public?void?doFilter(ServletRequest?request, 22.ServletResponse?response, 23.FilterChain?chain) 24.throws?ServletException,?IOException?{ 25.//?insert?code?here26.?} Which?should?you?insert?at?line?25?to?properly?invoke?the?next?filter?in?the?chain,or?the?target?servlet?if?thereare?no?more?filters?()A、chain.forward(request,?response);B、chain.doFilter(request,?response);C、request.forward(request,?response);D、request.doFilter(request,?response);69.下面關于try、catch和finally語句塊的組合使用,正確的是()A、try{,}B、try{,}finally{,}C、try{,}catch{,}finally{,}D、try{,}catch{,}catch{,}70.A?custom?JSP?tag?must?be?able?to?support?an?arbitrary?number?of?attributes?whose?names?are?unknown?when?the?tag?class?is?designed.? Which?two?are?true??()A、?A??element?in?the?echo?tag?LTD?must?have?the?value?JSPB、?The?echo?tag?handler?must?define?the?setAttribute?(String?key,?String?value)?methodC、?The?true?element?must?appear?in?the?echo?tag?TLDD、?The?class?implementing?the?echo?tag?handler?must?implement?the?javax.sevlet.jsp.tagext.IterationTag?interfaceE、?The?class?implementing?the?echo?tag?handler?must?implement?the?javax.sevlet.jsp.tagext.DynamicAttributes?interface71.輸入年份和月份即可打印出當月的日歷72.已知: 下面哪些代碼是正確的?()A、B、C、D、73.Within?a?web?application?deployment?descriptor,?which?maps?the?com.example.LoginServlet?servlet?to?/utils/LoginServlet?() A、AB、BC、CD、D74.在Swing?GUI編程中,setDefaultCloseOperation(JFrame.EXIT_ON_?CLOSE)語句的作用是:()?A、當執行關閉窗口操作時,不做任何操作。B、當執行關閉窗口操作時,調用WindowsListener對象并將隱藏JFrameC、當執行關閉窗口操作時,退出應用程序D、當執行關閉窗口操作時,調用WincowsListener對象并隱藏和銷毀Jframe75.線程安全的map在JDK1.5及其更高版本環境有哪幾種方法可以實現()。A、Map?map?=?new?HashMap()B、Map?map?=?new?TreeMap()C、Map?map?=?new?ConcurrentHashMap()D、Map?map?=?Collections.synchronizedMap(new?HashMap())第2卷一.參考題庫(共75題)1.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;?}2.Which?Man?class?properly?represents?the?relationship?“Man?has?a?best?friend?who?is?a?Dog”?()?A、?class?Man?extends?Dog?{?}B、?class?Man?implements?Dog?{?}C、?class?Man?{?private?BestFriend?dog;?}D、?class?Man?{?private?Dog?bestFriend;?}E、?class?Man?{?private?Dog?}F、?class?Man?{?private?BestFriend?}3.通過Ajax,客戶端獲取的數據主要有兩種類型:文本型和()4.打印出所有的"水仙花數",所謂"水仙花數"是指一個三位數,其各位數字立方和等于該數本身。例如:153是一個"水仙花數",因為153=1的三次方+5的三次方+3的三次方。5.1.?import?java.util.*;? 2.?class?SubGen?{? 3.?public?static?void?main(String?[]?args)?{? 4.?//insert?code?here? 5.?}? 6.?}? class?Alpha?{?}? class?Beta?extends?Alpha?{?}? class?Gamma?extends?Beta?{?}? 和四段代碼片段:? s1.?ArrayList〈??extends?Alpha〉?list1?=?new?ArrayList〈Gamma〉();? s2.?ArrayList〈Alpha〉?list2?=?new?ArrayList〈??extends?Alpha〉();? s3.?ArrayList〈??extends?Alpha〉?list3?=?new?ArrayList〈??extends?Beta〉();? s4.?ArrayList〈??extends?Beta〉?list4?=?new?ArrayList〈Gamma〉();?ArrayList〈??extends?Alpha〉?list5?=?list4;? 哪些片段分別插入到第4行,可允許代碼編譯?()??A、只有s1B、只有s3C、只有s1和s3D、只有s1和s46.A?collection?of?products?is?stored?in?the?Servle?Context?in?an?attribute?called?catalog.? Which?JSTL?code?structure?iterated?over?each?product?in?the?collection?and?prints?out?the?names?of?the?products?in?an?un-ordered?list?() A、AB、BC、CD、D7.判斷一個整數能被幾個9整除8.public?class?TestApp{? public?static?void?main(String[]?args){?????? try{? int?i?=?0;?????????? int?j?=?1?/?i;?????????? String?myname=null;?????????? ?if(myname.length()>2)????????????? System.out.print(“1”);??????? }catch(NullPointerException?e){? System.out.print(“2”);???????}? catch(Exception?e){? System.out.print(“3”);???????}???}?}? 上述程序運行后的輸出是哪項?()A、?3B、?2C、?231D、?329.已知: 則輸出為()A、81B、11C、7D、010.public?class?test(? public?static?void?main(string[]args){? string?foo?=?args?[1];? string?foo?=?args?[2];? string?foo?=?args?[3];? }? )? And?command?line?invocation:?Java?Test?red?green?blue?? What?is?the?result?()??A、?Baz?has?the?value?of?“”B、?Baz?has?the?value?of?nullC、?Baz?has?the?value?of?“red”D、?Baz?has?the?value?of?“blue”E、?Bax?has?the?value?of?“green”F、?The?program?throws?an?exception.11.Which?are?not?Java?keywords??()???A、?TRUEB、?sizeofC、?constD、?superE、?void12.float?f[][][]?=?new?float[3][][];? float?f0?=?1.0f;? float[][]?farray?=?new?float[1][1];? What?is?valid?()??A、?f[0]?=?f0;B、?f[0]?=?farray;C、?f[0]?=?farray[0];D、?f[0]?=?farray[0][0];13.What?is?the?result?() A、Compilation?fails.B、After?line?15,?the?value?of?age?is?5.C、After?line?15,?the?value?of?age?is?3.D、An?exception?is?thrown?at?runtime.14.現有如下五個聲明:? Linel:?int?a_really_really_really_long_variable_name=5?;???? Line2:?int??_hi=6;? Line3:??int??big=Integer.?getlnteger("7”);????? Line4:int?$dollars=8;????? line5:?int?%opercent=9;????? 哪行無法通過編譯?()A、Line1B、Line3C、Line4D、Line515.把一張一元鈔票,換成一分、二分和五分硬幣,每種至少8枚,求方案數16.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?C17.將一個正整數分解質因數。例如:輸入90,打印出90=2*3*3*5。 程序分析:對n進行分解質因數,應先找到一個最小的質數k,然后按下述步驟完成:???? (1)如果這個質數恰等于n,則說明分解質因數的過程已經結束,打印出即可。???? (2)如果n??k,但n能被k整除,則應打印出k的值,并用n除以k的商,作為新的正整數你n,重復執行第一步。???? (3)如果n不能被k整除,則用k+1作為k的值,重復執行第一步。18.在類Acoount中,正確引入類school.Student的語句是哪一項?()??A、import?schoolB、import?schllo.*C、package?school.StudentD、import?Student19. Which?two?are?valid?examples?of?method?overriding?()A、?float?getVar()?{return?x:}B、?public?float?getVar()?{return?x;?}C、?public?double?getVar()?{return?x;?}D、?protected?float?getVar()?{return?x;?}E、?public?float?getVar(float?f)?{return?f;}20.為了使得System.out.println()輸出對象引用的時候得到有意義的信息,我們應該覆蓋Object中的哪個方法?()?A、?equalsB、?hashCodeC、?toStringD、?notify21.下列敘述正確的是哪項?()??A、TextField能產生ActionEvent事件B、TextArea能產乍ActionEvent事件C、Button能產牛ActionEvent事件D、Menultem能產生ActionEvent事件22.寫一個類,并在一個方法拋出一個異常。試著在沒有異常規范的前提下編譯它,觀察編譯器會報告什么。接著添加適當的異常規范。在一個try-catch從句中嘗試自己的類以及它的異常。23.If?class?Donkey2?is?invoked?twice,?the?first?time?without?assertions?enabled,?and?the?second?time?with?assertions?enabled,?what?are?the?results?() A、no?outputB、no?output?assert?is?onC、assert?is?onD、no?output?,?An?Assertion?Error?is?thrown.E、assert?is?on?,?An?AssertionError?is?thrown.24. What?is?the?result?()A、?the?program?runs?and?prints?nothing.B、?The?program?runs?and?prints?“Finally”.C、?The?code?compiles.?But?an?exception?is?thrown?at?runtime.D、?the?code?will?not?compile?because?the?catch?block?is?missing.25.public?class?Yippee?{? public?static?void?main(String?[]?args)?{? for(int?x?=?1;?x?A、?No?output?is?produced.?123B、?No?output?is?produced.?234C、?No?output?is?produced.?1234D、?An?exception?is?thrown?at?runtime.?123E、?An?exception?is?thrown?at?runtime.?234F、?An?exception?is?thrown?at?rijntime.?123426.回文數是指正讀和反讀都一樣的正整數? 例如3773是回文數。求[1000,9999]之間的奇數回文數的個數27.Which?will?declare?a?method?that?is?available?to?all?members?of?the?same?package?and?can?be?referenced??without?an?instance?of?the?class?()??A、?Abstract?public?void?methoda();B、?Public?abstract?double?methoda();C、?Static?void?methoda(double?d1){}D、?Public?native?double?methoda(){}E、?Protected?void?methoda(double?d1){}28.如果一個方法或變量是"private"訪問級別,那么它的訪問范圍是:()。A、在當前類,或者子類中B、在當前類或者它的父類中C、在當前類,或者它所有的父類中D、在當前類中29.public?class?TestApp{? public?static?void?main(String[]?args){??????? try{? int?i?=?0;?????????? int?j?=?1?/?i;? System.out.println(“1”);??????? }catch(Exception?e){????????????? System.out.print(“3”);???????}finally{? System.out.print(“4”);???????}???}?}? 上述程序運行后的輸出是哪項?()?A、?4B、?34C、?43D、?1430.One?of?the?use?cases?in?your?web?application?uses?many?session-scoped?attributes.?At?the?end?of?the?usecase,you?want?to?clear?out?this?set?of?attributes?from?the?session?object.?Assume?that?this?static?variableholds?this?set?of?attribute?names: 201.private?static?final?Set?USE_CASE_ATTRS;? 202.static?{ 203.USE_CASE_ATTRS.add("customerOID"); 204.USE_CASE_ATTRS.add("custMgrBean"); 205.USE_CASE_ATTRS.add("orderOID"); 206.USE_CASE_ATTRS.add("orderMgrBean"); 207.} Which?code?snippet?deletes?these?attributes?from?the?session?object?()A、session.removeAll(USE_CASE_ATTRS);B、for?(?String?attr?:?USE_CASE_ATTRS?)?{session.remove(attr);}C、for?(?String?attr?:?USE_CASE_ATTRS?)?{session.removeAttribute(attr);}D、for?(?String?attr?:?USE_CASE_ATTRS?)?{session.deleteAttribute(attr);}E、session.deleteAllAttributes(USE_CASE_ATTRS);31.在linux編程中,以下哪個TCP的套接字選項與nagle算法的開啟和關閉有關()。A、TCP_MAXSEGB、TCP_NODELAYC、TCP_SYNCNTD、TCP_KEEPALIVE32.Which?statements?are?true?concerning?the?default?layout?manager?for?containers?in?the?java.awt?package?()??A、Objects?instantiated?from?Panel?do?not?have?a?default?layout?manager.B、Objects?instantiated?from?Panel?have?FlowLayout?as?default?layout?manager.C、Objects?instantiated?from?Applet?have?BorderLayout?as?default?layout?manager.D、Objects?instantiated?from?Dialog?have?BorderLayout?as?default?layout?manager.E、Objects?instantiated?from?Window?have?the?same?default?layout?manager?as?instances?of?Applet.33.How?can?you?force?garbage?collection?of?an?object?()A、?Garbage?collection?cannot?be?forced.B、?Call?System.gc().C、?Call?System.gc(),?passing?in?a?reference?to?the?object?to?be?garbage?collected.D、?Call?Runtime.gc().E、?Set?all?references?to?the?object?to?new?values(null,?for?example).34.試列舉出圖形用戶界面中你使用過的組件。35.求數列f(n)=n
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- DB32/T 3158-2016內河水上服務區建設標準
- DB31/T 744-2022智能電網儲能系統并網裝置測試技術規范
- DB31/T 682-2013古樹名木和古樹后續資源養護技術規程
- DB31/T 666-2012免煅燒脫硫石膏基衍生產品(粉刷砂漿、石膏砌塊和土壤固化劑)應用技術規程
- DB31/T 596-2021城市軌道交通合理通風技術管理要求
- DB31/T 1322-2021生鮮電商配送貨服務規范
- DB31/T 1235-2020高層民用建筑消防安全管理要求
- DB31/T 1185-2019特種設備雙重預防體系要求
- DB31/T 1048-2017上海品質評價通用要求
- DB31/T 1022-2016乘用車空氣凈化器凈化性能測定方法
- 針灸治療之蛇串瘡課件
- 大型商場裝修施工組織設計方案
- 【MOOC】材料力學-西北工業大學 中國大學慕課MOOC答案
- 《英語翻譯》教案全套 陳霞 第1-8章 中西方翻譯史 - 文體翻譯
- 人教版(2024)八年級上冊物理期中模擬試卷3套(含答案)
- DB11∕T 2115-2023 機械式停車設備使用管理和維護保養安全技術規范
- 北京市通州區2023-2024學年四年級下學期語文期末試卷
- 2024年四川省綿陽市中考學情調查地理試題(原卷版)
- 穿越時空的音樂鑒賞之旅智慧樹知到期末考試答案章節答案2024年浙江中醫藥大學
- 重慶市藻渡水庫工程環境影響報告書-上報
- DZ∕T 0207-2020 礦產地質勘查規范 硅質原料類(正式版)
評論
0/150
提交評論