




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、10年JAVA模擬試題A一、單項(xiàng)選擇題( 分)135每小題1分,3650每小題2分,共651. Java虛擬機(jī)(JVM )在運(yùn)行JAVA代碼時(shí),不會(huì)進(jìn)行的操作是A )加載代碼B)校驗(yàn)代碼C)編譯代碼 D )執(zhí)行代碼2. JAVA程序的并發(fā)機(jī)制是A) 多線程 B)多接口C)多平臺(tái)D)多態(tài)性3. 在方法內(nèi)部使用,代表對(duì)當(dāng)前對(duì)象自身引用的關(guān)鍵字是A) super B)ThisD)SuperD)this4. 對(duì)鼠標(biāo)點(diǎn)擊按鈕操作進(jìn)行事件處理的接口是A) MouseListenerB) WindowsListenerC) ActionListenerD) KeyListener5. AWT中用來表示顏色的
2、類是A) FontB) Color6. Java中屬于跳轉(zhuǎn)語句的是A) tryB) catch7. 下面說法哪個(gè)是正確的()A ) Applet可以訪問本地文件C) socket類在 javaang 中C)PanelD)DialogC) finallyD ) breakB)對(duì)static方法的調(diào)用需要類實(shí)例D ) 127.0.0.1地址代表本機(jī)&下列哪個(gè)方法可用于創(chuàng)建一個(gè)可運(yùn)行的類 ()A ) public class X implements Runable public void run()B ) public class X implements Thread public void r
3、un()C) public class X implements Thread public int run()D ) public class X implements Runable protected void run()9. Java編程所必須的默認(rèn)引用包為()D)以上都不是A ) java.sys包B) javaang 包C) java.new 包10. Java Applet源程序文件的擴(kuò)展名為()。A ) .javaB) .class C) .html D) .exe11. 設(shè)a = 3,則表達(dá)式(-a)a的值是()。A ) 16B ) 8C ) 24D) 1212. 在Java
4、 Applet程序用戶自定義的Applet子類中,一般需要重載父類的()方法來完成主類實(shí)例的初始化工作。A ) start( )B) stop( ) C) init( ) D) paint()13. 創(chuàng)建一個(gè)標(biāo)識(shí)有“關(guān)閉”按鈕的語句是()。A ) TextField b = new TextField( “關(guān)閉”);B ) Label b = new Label( “關(guān)閉”);C) Checkbox b = new Checkbox關(guān)閉”);D) Button b = new Button( “關(guān)閉”);14. 在編寫異常處理的Java程序中,每個(gè)catch語句塊都應(yīng)該與()語句塊對(duì)應(yīng),使得用
5、該語句塊來啟動(dòng) Java的異常處理機(jī)制。A) ifelse B) switch C) tryD) throw15. 在Java中,屬于整數(shù)類型變量的是()A) single B) double C) byte D) char16. Applet類的直接父類是()A) Component類B) Container 類 C) Frame 類D) Panel 類仃.Frame的默認(rèn)的布局管理器是下列哪一個(gè)()A ) FlowLayout B) BorderLayout C) GridLayout D ) CardLayout18.在下列事件處理機(jī)制中哪個(gè)不是機(jī)制中的角色()A)事件 B)事件源 C)
6、事件接口D事件處理者佃.下列語句片段int a=10,b=4,c=20,d=6;System.out.println(a+*b+c*-d);的結(jié)果為()A ) 144D)不能執(zhí)行20. 下列語句片段:int a=-67,b=116,c=78;int d=a | b&c;B ) 281000011 011110011111001001100C) 14011101001001110System.out.println(d)的結(jié)果為()A) 70B) 6721. Java中訪問限定符不包括()A ) public B) privateC) 78D ) 56D) final22. 如果希望所有的控件在
7、界面上均勻排列,應(yīng)使用下列那種布局管理器?A)BoxLayout B)GridLayout C)BorderLayout D)FlowLouLayout23.A )C)24.JAVA程序經(jīng)常用到 遞歸” 讓別人反復(fù)調(diào)用自己” 自己反復(fù)調(diào)用自己”Which is Java keyword?A ) mathB ) staticC)C) default遞歸”的基本思想是()B)自己反復(fù)調(diào)用別人” D)以上說法都不對(duì)FALSE D ) TRUE25. What is the range of a char?3131A ) -32 768 32 767B ) -128 127 C) -2 2 -1D)
8、u0000 uFFFF26. Java變量中,以下不屬于復(fù)合類型的數(shù)據(jù)類型是()A)類B)字符型 C)數(shù)組型 D)接口27. 當(dāng)方法遇到異常又不知如何處理時(shí),下列哪種說法是正確的()A)捕獲異常B)拋出異常C)聲明異常D)嵌套異常28. 在Java中,不屬于整數(shù)類型變量的是()A ) doubleB) longC) intD) byte29. 在異常處理中,如釋放資源、關(guān)閉文件、關(guān)閉數(shù)據(jù)庫等由()來完成。A ) try 子句B ) catch子句 C) finally 子句D ) throw子句30. Which of the following are valid declarations?
9、A) char c= B) char c= cafeC) char c= 0xfgD) char c=xef31. Which of the following is true of anonymous innerclass?A) Anonymous inner class can be declared as private,protected or public.B) Anonymous inner class can implement multiple interfaces.C) if not extended or implemented, an anonymous innercla
10、ss can become immediate subclass of the outer class or implement an interface.D) if not extended or implemented, an anonymous inner class can become immediate subclass of outer class or implement mutiple interfaces.32. Which statement is true about an inner class?A) It must be anonymousB) It can t i
11、mplement an interfaceC) It is only accessible in the enclosing classD) It can access any final variables in any enclosing scope.33. Which is the main() method return of a application?A) String B) byte C) char D) void34. Which is corrected argument of main() method of application?A) String args B) St
12、ring args C) Char args D) StringBuffer args35. Given the following declarationString s = Example;Which are legal code?A ) s = 3;B) s3 = x;C) int i = s.length; D) String t =For + s;36. What is written to the standard output given the following statement: System.out.println(4&7);100Select the right an
13、swer: 111A ) 4 B ) 5C) 6 D) 737. What is written to the standard output given the following statement: System.out.println(7|9);Select the right answer:A ) 0 B ) 7C) 9 D) 1538. Consider the following code: Integer s = new Integer(9); Integer t = new Integer(9); Long u = new Long(9);Which test would r
14、eturn true?A) (s.equals(new Integer(9)B ) (s.equals(9)C) (s=u)D) (s=t)39. What should you use to position a Button within an application frame so that the width of the Button is affected by the Frame size but the height is not affected.A) FlowLayoutB)GridLayoutC) Center area of a BorderLayoutD) Nort
15、h or South of aBorderLayout40. If this source code is contained in a file called SmallProg.java, what command should be used to compile it using the JDK?public class SmallProg public static void main(String args) System.out.println(Good luck!); A) java SmallProgB)javac SmallProgC) java SmallProg.jav
16、aD) javacSmallProg.java41. Which statement about listener is true?A) Most component unallow multiple listeners to be added.B ) If multiple listener be add to a single component, the event only affected one listener.C) Component don t allow multiple listeners to be add.D) The listener mechanism allow
17、s you to call an addXxxxListener method as many times as is needed, specifying as many different listeners as your design require.42. What will be the result when you run the following code?class Aclassvoid go()System.out.println(Aclass);public class Bclass extends Aclassvoid goSystem.out.println(Bc
18、lass);public static void main(String args)Aclass a=new Aclass();Aclass a1=new Bclass();a.go();a1.go();The output is:A ) AclassB ) BclassC) AclassD) BclassAclassBclassBclassAclass43. 已知有下列類的說明,則下列哪個(gè)語句是正確的?public class Test private float f = 1.0f;int m = 12;static int n=1;public static void main(Strin
19、g arg)Test t = new Test();A) t.f ;B) this.n ; C ) Test.m ; D) Test.f ;44. 給定下面的代碼片段:1) String str = null;2) if (str != null) & (strength() 10) 3) System.out.println(more than 10);4) 5) else if (str != null) & (str.length() 5) 6) System.out.println(less than 5);7) 8) else System.out.println(end); 哪一行
20、會(huì)導(dǎo)致錯(cuò)誤?A)line 1B) line 2C)line 5D)line 845. 對(duì)于下列代碼:public class Parent public int addValue( int a, int b) int s;s = a+b; return s;class Child extends Parent 下述哪個(gè)方法可以加入Child類中實(shí)現(xiàn)多態(tài)?A) int addValue( int a, int b )/ do something.B) public void addValue (int a, int b )/ do something.C) public int addValue
21、( int a )/ do something.D) public int addValue( int a, int b ) /do something.46. 下列語句序列執(zhí)行后,k的值是()。int i=10, j=18, k=30;switch( j - i )case 8 : k+;case 9 : k+=2;case 10: k+=3;default : k/=j;A) 31B) 32C) 2D) 3347. Given the following class definition:class Aprotected int i;A(int i)this.i=i;which of th
22、e following would be a valid inner class for this class?A) class B B) class B extends A C) class B extends AD) class BB()System.out.println(“ i= ” + i); class A 48. Give the following java class:public class Examplestatic int x=new int15;public static void main(String args)System.out.println(x5);Whi
23、ch statement is corrected?A) When compile, some error will occur. B ) When run, some error will occur.C) Output is zero.D) Output is null.49. What will be the result of attempting to compile and run the following code? abstract class MineBaseabstract void amethod();static int i;public class Mine ext
24、ends MineBasepublic static void main(String args)int ar = new int5;for(i=0; iar.length; i+)System.out.println(ari);A ) a sequence of 5 0 s will be printedB ) Error: ar is used beforeit is initializedC) Error Mine must be declared abstract D ) IndexOutOfBoundes Error50. class Line public static class
25、 Point class Triangle II insert code hereWhich code, inserted at line 15, creates an instance of the Point class defined in Line?A. Point p = new Point();B. Line.Point p = new Line.Point();C. The Point class cannot be instatiated at line 15.D. Line 1 = new Line() ; 1.Point p = new 1.Point();二、寫出下列程序
26、完成的功能(每小題5分,共20分)1、public class Sumpublic static void main( String args )int sum = 0 ;for ( int i = 1 ; i = 100 ; i + + )sum += i ;System.out.println(“ sum= +sum );2、import java.io.* ;public class Reversepublic static void main(String args )int i , n =10 ;int a = new int10;for ( i = 0 ; i = 0 ; i-)S
27、ystem.out.print(ai+);System.out.println();3、import java.awt.*;public class AppOutpublic static void main(String args)new FrameOut();class FrameOut extends FrameLabel prompt;FrameOut()super(西南交通大學(xué)); prompt=new Label(西南交通大學(xué)歡迎您); setLayout(new FlowLayout(); add(prompt);setSize(300,200); show();4、import
28、 java.io.*;public class abcpublic static void main(String args) SubClass sb = new SubClass();System.out.println(sb.max();class SuperClass int a = 10 , b = 20 ; class SubClass extends SuperClass int max( ) return (ab)?a:b); 三、寫出下面程序的運(yùn)行結(jié)果(每小題5分,共15分)1、import java.io.*;public class abcpublic static voi
29、d main(String args) String s1 = Hello!;String s2 = new String(I am fine!); System.out.println(s1+ +s2); 2、import java.io.* ;public class abcpublic static void main(String args) int i , s = 0 ;int a = 1,2,3,4,5,6,7,8,9,10 ;for ( i = 0 ; i a.length ; i + )if ( ai%2 = 0 ) s += ai; System.out.println(s=
30、+s);3、Give following programe:class EXpublic static void main(String args)outer: for(int i=0; i3; i+ ) inner: for(int j=0; j=1) break outer;System.out.println(j + and + i); What will be output?第二、三題參考答案:二、 寫出下列類完成的功能。(每小題5分,共20分 )1、求1至100之間的整數(shù)的和,并在屏幕上顯示岀來。2、從標(biāo)準(zhǔn)輸入(即鍵盤)讀入10個(gè)整數(shù)存入整型數(shù)組 a中,然后逆序輸岀這10個(gè)整數(shù)。3、創(chuàng)建一個(gè)標(biāo)題為“西南交通大學(xué)”的窗框,窗框中顯示有“西南交通大學(xué)歡迎您”字樣的標(biāo)簽。4、求兩個(gè)數(shù)的最大值。三、寫出下面程序的運(yùn)行結(jié)果 (每小題5分,共15分)1、Hello! I am fine!2、s=303、0 and 0When you are old and grey and full of sleep,And no ddi ng by the fire, take down this book,And slowly read, and dream o
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 遼河油田施工合同
- 短期翻譯服務(wù)合同
- 有關(guān)私了賠償協(xié)議書
- 餐飲業(yè)食品安全及服務(wù)質(zhì)量保障合同
- 幼兒園接送免責(zé)協(xié)議書
- 采購預(yù)付款合同
- 高端機(jī)械裝備研發(fā)項(xiàng)目合作框架協(xié)議
- 中央空調(diào)安裝施工合同
- 企業(yè)采購智能化設(shè)備合同
- 合格供應(yīng)商框架協(xié)議
- 2024年湖南汽車工程職業(yè)學(xué)院?jiǎn)握新殬I(yè)技能測(cè)試題庫標(biāo)準(zhǔn)卷
- (正式版)HGT 6313-2024 化工園區(qū)智慧化評(píng)價(jià)導(dǎo)則
- 二級(jí)公立醫(yī)院績效考核三級(jí)手術(shù)目錄(2020版)
- 公共關(guān)系學(xué)完整教學(xué)課件
- NUDD新獨(dú)難異失效模式預(yù)防檢查表
- 研發(fā)向善課程----綻放生命異彩
- Z3050型 搖臂鉆床使用說明書
- 加油站數(shù)質(zhì)量管理考核辦法版.doc
- 華文版四年級(jí)下冊(cè)全冊(cè)書法教案
- 最新整理自動(dòng)化儀表專業(yè)英語詞匯只是分享
- 強(qiáng)夯、堆載預(yù)壓地基處理方案
評(píng)論
0/150
提交評(píng)論