java工程師考試_第1頁(yè)
java工程師考試_第2頁(yè)
java工程師考試_第3頁(yè)
java工程師考試_第4頁(yè)
已閱讀5頁(yè),還剩8頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、第一題: ( 過(guò)程可以寫在后面)學(xué)校的畢業(yè)話劇演出由四個(gè)小美女來(lái)出演小紅帽、美羊羊、女巫和公主的角色。沒(méi)人在排練時(shí)的角色與演出時(shí)的角色不同。排練時(shí)出演小紅帽的人會(huì)撒謊,通過(guò)如下消息,請(qǐng)判斷四人在演出和排練時(shí)分別出演什么角色。梅:“排練時(shí),蘭的角色是演出時(shí)竹的角色?!碧m:“菊排練時(shí)扮演的是美羊羊?!敝瘢骸把莩鰰r(shí)我演公主。”菊:“蘭演出時(shí)扮演的是美羊羊?!钡诙}: 解數(shù)獨(dú)題( 數(shù)獨(dú)是九宮格 ( 即 3 格寬 x3 格高 ) ) 正方形狀,每一格又細(xì)分為一個(gè)九宮格,在沒(méi)一個(gè)小九宮格中,分別填上 19 個(gè)數(shù)字,讓每一個(gè)大九宮格沒(méi)一列,沒(méi)一行的數(shù)字都不重復(fù)。81746948338527569665118

2、31、Which line contains a constructor in this class definition?精品文庫(kù)public class Counter/(1)int current ,step;public Counter(int startVaue,int stepValue)/(2)set(startValue);setStepValue(steValue);public int get()return current;/(3)public void set(int value)current=value;/(4)public void setStepValue(in

3、t stepValue)step=stepValue;/(5)1)Code marked with (1) is a constructor2)Code marked with (2) is a constructor3)Code marked with (3) is a constructor4)Code marked with (4) is a constructor5)Code marked with (5) is a constructor2、An instance member.1)is also called a static member2)is always a variabl

4、e3)is never a method4)belongs to a single instance,not to the class as a whole5)always represents an operation3、Given the following class,which statements can be inserted at position I without causing the code to fail compilation?public class Q6db8int a ;int b=0;static int c;public void m()歡迎下載2精品文庫(kù)

5、int d;int e=0;/Position 11)a+2)b+3)c+4)d+5)e+7、What is wrong with the following code?Class MyException extends ExceptionPublic class qb4abPublic void foo()TryBar();finallyBaz();catch(MyException e)Public void bar() throws MyExceptionThrow new Exception();Public void baz() throws RuntimeExceptionThro

6、w new RuntimeException();4、) Since the method foo() does not catch the exception generated by the method baz(), it must declare the RuntimeException in its throws clause.歡迎下載36.7.精品文庫(kù)5、) A the try block cannot be followed by both a catch and a finally block.6、) An empty catch block is not allowed.7、

7、) A catch block cannot follow a finally block.8、) A finally block must always follow one or more catch blocks.5、What will happen when you attempt to compile and run the following program by passing the Test class to the Java interpreter?Class TestPublic static void main“hello ”);Select the one right

8、 answer.the program does not compile because main() is not defined correctly.The program compiles but when you try to run the interpreter complies that it cannot find the main() method it needs to run.C) the program compiles but you cannot run it because the class is not declared as public .D) the p

9、rogram compiles and runs without an error but does not display anything in the standard output .E) the program compiles and displays “hello ”in the standard output when you in run it.6、Give those code snippets:Boolean b1=new Boolean(true);Boolean b2=new Boolean(true);Which expressions are legal Java

10、 expressions that return true?Select all valid answer.3. b1=b24. b1.equals(b2) C) b1&b2D) b1|b2E) b1&&b2F) b1|b2歡迎下載4精品文庫(kù)7、Given this code snippet:trytryThis();return;catch(IOException x1)return ;catch(Exception x2)return ;finallyWhat will appear in the standard output if try This() thro

11、ws a NumberFormatException?Select the one right answer.a)Nothingb)"exception 1",followed by "finally"c)"exception 2",followed by "finally"d)"exception 1"e)"exception 2"選擇:C8、Giver these class definitions;class Superclassclass Subclass1 exte

12、nds Superclassclass Subclass2 extends Superclassand these objects;Superclass a =new Superclass();歡迎下載5精品文庫(kù)Subclass1 b=new Subclass1();Subclass2 c=new Subclass2();which of the following explains the result of the statement; b=(Subclass1)c;Selected the one right answer;a)Illegal at compile timeb)Legal

13、 at compile time but possibly illegal at runtimec)Definitely legal at runtime9、簡(jiǎn)述以下代碼是在做什么事情?”);Throw new RuntimeException( “getEJBHome could tretrieve initial context ”10: 請(qǐng)從空白處填寫代碼,滿足以下功能:A) 從請(qǐng)求中得到用戶名和口令(請(qǐng)求通過(guò) web 瀏覽器中的 HTML 頁(yè)面提交, 頁(yè)面中用戶名對(duì)象名為 userName, 口令對(duì)象名為 password )B) 如果用戶名為 ”admin ”, 口令為 passwo

14、rd , 則講登陸成功,將頁(yè)面轉(zhuǎn)到loginSuccess.jsp 頁(yè)面,并在session 存放用戶名( username )和密碼(password)C( 如果用戶名和空靈為其他值,轉(zhuǎn)到error.jspPublic class TestServlet extends HttpServlet歡迎下載6精品文庫(kù)Public void service(HttpServletRequest request,HttpServletResponse resopnse)throws ServletException,IOException/Include following lins in all s

15、ervlet.Try/請(qǐng)?jiān)诖颂韺懘aIf(userName.equals(“admin ”) && password.equals(“password ”)request.getsession.setAttribute("username",”admin ”);request.getsession.setAttribute("password",”password ”);Request.sendRedirect(“l(fā)oginSuccess.jsp ”);elseRequest.sendRedirect(“error.jsp ”);catc

16、h(Exception e)典道的筆試分A-B 卷,題型有:1. 選擇題 30 道(每道 2 分 共 60 分)2. 代碼閱讀題 4 道(每道 5 分 共 20 分)3. 程序邏輯題 2 道(每道 10 分 共 20 分)不管是 A-B 卷,考察的范圍都是基礎(chǔ)知識(shí),這個(gè)是和幾個(gè)做B 卷的同學(xué)那了解到的,主要的考點(diǎn)如下:歡迎下載7精品文庫(kù)考點(diǎn)名稱考試頻率難易度備注數(shù)組高易值傳遞與址傳高中遞Main 函數(shù)低中線程低難Swing 與 awt低中Ascii 碼高難請(qǐng)務(wù)必記住常用 ascii 碼,代碼題都有考運(yùn)算符優(yōu)先級(jí)低中去網(wǎng)上百度一下Oop 思想高中方法重載與重高易寫包低易方法與類的命低易名規(guī)則邏輯

17、思維高難其他的記得不是很清楚了,不過(guò)不會(huì)超過(guò)基礎(chǔ)知識(shí)這個(gè)范圍,但光靠書(shū)(accp6.0 )上那些還不夠,建議找些參考書(shū)學(xué)習(xí)一下,越基礎(chǔ)越好。以下是 A 卷代碼閱讀題8、建一個(gè)數(shù)組,順序輸出10 位數(shù),然后把這10 位數(shù)再倒序輸出歡迎下載8精品文庫(kù)publicclassTest publicstaticvoidmain(String args) int arr=newint1,2,3,4,5,6,7,8,9,10;System.out .println("-順序輸出 -");for( inti = 0; i < arr.length; i+) System.out .p

18、rint(arri+",");System.out .println();System.out .println("-倒敘輸出 -");for( intj = arr.length-1; j >=0 ; j-) System.out .print(arrj+",");9、考的是方法重載,它是將兩個(gè)方法的參數(shù)順序顛倒了一下,看題的時(shí)候要注意。3.publicclassTest5 publicstaticvoidmain(Stringargs)int arr=newint1,2,3,4,5,6,7,8;a(arr);b(arr);a

19、(arr);staticvoida(intarr)for( inttemp:arr)歡迎下載9精品文庫(kù)System.out .println(temp);staticvoidb(intarr)for( inti=0;i<arr.length;i+)arri*=i;輸出結(jié)果是: 56以下是 A卷手寫代碼題:8.請(qǐng)用 1、 2、 3、 4 組成 N個(gè)數(shù)值不重復(fù) 且個(gè)十百位都不重復(fù) 的 3位數(shù) , 一共有幾個(gè)?分別是什么?共有: 24 個(gè)分別是:123,124,132,134,142,143,213,214,231,234,241,243,312,314,321,324,341,342,412

20、,413,421,423,431,432,參考答案:Int count=0;For(int i=1;i<=4;i+)For(int j=1;j<=4;j+)For(int k=1;k<=4;k+)If(i!=j&&i!=k&&j!=k)歡迎下載10精品文庫(kù)Count+;一共有 24 個(gè),公式: 4*3*2=24,具體數(shù)學(xué)公式請(qǐng)見(jiàn)排列算法。9.查詢子串在父串中出現(xiàn)的次數(shù):參考答案:設(shè): str1為父串, str2為字串,則:publicclassTest6 publicstaticvoidmain(Stringargs)Stringstr1="hdsajkfhuisadhifnokfasdfdasdoksdfsdsfsok"String str2="ok"String temp="" ;intcount=0;for(temp=str1;temp!=null&&str2.length()<=s

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論