達(dá)內(nèi)Java班第一次月考_第1頁
達(dá)內(nèi)Java班第一次月考_第2頁
達(dá)內(nèi)Java班第一次月考_第3頁
達(dá)內(nèi)Java班第一次月考_第4頁
達(dá)內(nèi)Java班第一次月考_第5頁
已閱讀5頁,還剩60頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、(單選題)下列數(shù)組聲明語句中,錯(cuò)誤的是:()2 A.int口 arr = new int。;?B.int arr = new int口;?C.int arr = ;?D.int arr = new int2口;正確答案:B2.(單選)class Card 下列不屬于Card類構(gòu)造方法的是:()2 A.Card()?B.public Card()?C.public void Card()。?D.private Card()。3.正確答案:C(單選)下面不屬于Java語言特點(diǎn)的是:2 A.平臺(tái)無關(guān)?B.面向?qū)ο?C.支持指針類型?D.垃圾回收機(jī)制正確答案:C4.(單選)下列選項(xiàng)中的類,能正確實(shí)現(xiàn)

2、java.lang.Runnable 接口和java.lang.Clonable 接 口的是()。2 A.public class Session implements Runnable, Clonable public void run(); publicObject clone(); ?B.public class Session implements Runnable, implements Clonable public void run() / do something */ public Object clone() / make a copy */ ?C.public class

3、 Session implements Runnable, Clonable public void run() / dosomething */ public Object clone() /* make a copy */ ?D.public class Session extends Runnable, Clonable public void run() ; public Objectclone(); 正確答案:C5.(單選)下列屬于不合法Java標(biāo)識(shí)符的是()?A.mem?B.12a?C.M12?D.$12正確答案:B6.(單選)下列Java標(biāo)識(shí)符,錯(cuò)誤的是()2 A._sys_va

4、rl?B.$change?C.User_name?D.Ifile8.正確答案:D(單選Java程序的執(zhí)行過程中用到一套JDK工具,其中javac.exe是指()。2 A.Java語言編譯器?B.Java字節(jié)碼解釋器?C.Java文檔生成器?D.Java類分解器9.正確答案:A(單選)運(yùn)行下列代碼:int口 oneArr = 2, 11, 26, 27, 37, 44, 48, 60 ; int口 twoArr= 19, 35, 49, 55, 58, 75, 83, 84, 91, 93 ; int口 threeArr = new intoneArr.length+ twoArr.length

5、; int p = 0, q = 0; while(p oneArr.length & q twoArr.length) threeArrp + q = oneArrp twoArrq ? oneArrp+ : twoArrq+; if (p oneArr.length) System.arraycopy(oneArr, p, threeArr, p + q, oneArr.length -p); else if (q 1;?D.byte bl = 10; byte b=+b1;正確答案:D12.(單選)類 Super 及 Sub定義如下:public class Super private

6、void f() System.out.println(Super.f(); public void g() f(); public void k() f(); public class Sub extends Super private void f() System.out.println(Sub.f(); public void k() f(); 運(yùn)行下列語句Super obj = new Sub(); obj.g(); obj.k();輸出的結(jié)果是:()。?A.Sub.f() Sub.f()?B.Sub.f() Super.f()?C.Super.f() Sub.f()?D.Super

7、.f() Super.f()正確答案:C13.(單選)關(guān)于下列代碼說法正確的是: class ClassA public int numberOfinstances;voidprotected ClassA(int numberOfinstances) this.numberOfinstances = numberOfinstances; public class ExtendedA extends ClassA private ExtendedA(int numberOfinstances) super(numberOfinstances); public static main(Strin

8、g口 args) ExtendedA ext = new ExtendedA(420);System.out.print(ext.numberOfinstances); ?A.運(yùn)行后,輸出420?B.運(yùn)行時(shí)拋出異常?C.編譯錯(cuò)誤,所有的構(gòu)造器必須是 public的?D.編譯錯(cuò)誤,構(gòu)造器不能是private的正確答案:A14.(單選)關(guān)于下列代碼說法正確的是:public class A private int counter = 0; publicstatic int getInstanceCount() return counter; public A() counter+; public

9、static void main(String口 args) A a1 = new A(); A a2 = new A(); A a3 = new A();System.out.println(A.getInstanceCount(); ?A.該類編譯失敗?B.輸出:1?C.輸出:3?D.輸出:0正確答案:A15.(單選)下面for語句,存在編譯錯(cuò)誤的是()2 A.for( ; ; )?B.for(int i=0; i 0) ? elements。 : null; System.out.println(first); ?A.編譯出錯(cuò)輸出:tea?B.?C.輸出:for?D.輸出:null正確答

10、案:C25.輸出的結(jié)果是:()o(單選)運(yùn)行下面的程序: int a = 100; int b = 200; a = a + b; b = a - b; a = a - b; System.out.println(a= + a + , b= + b);?A.a=100, b=300a=100, b=200a=200, b=100?B.?C.?D.a=300, b=200正確答案:C26.(單選)下列關(guān)于JVM說法,錯(cuò)誤的是()2 A.JVM通過專門的線程實(shí)現(xiàn)內(nèi)存的回收?B.使用java命令時(shí),可以通過參數(shù)來設(shè)置分配 JVM的內(nèi)存大小。?C.JRE包括JVM及Java核心類庫。?D.目前主流版本

11、JVM過純解釋白方式運(yùn)行Java字節(jié)碼正確答案:D27.(單選)請(qǐng)看下歹U代碼:interface Data public void load(); abstract class Info public abstract void load(); 下列選項(xiàng)中,能正確使用 Data接口和Info類的是()?A.public class Employee extends Info implements Data public void load() /*dosomething*/ ?B.public class Employee implements Info extends Data publi

12、c void load() /*do something*/ ?C.public class Employee implements Info extends Data public void Data.load() /*d something */ public void load() /*do something */ ?D.public class Employee extends Info implements Data public void load() /*dosomething */ public void Info.load() /*do something*/ 正確答案:A

13、28.(單選)類 A, B 的定義如下: class A private int a = 100; A() System.out.print(A()”); System.out.println(a); class B extends A private int a = 200; B() System.out.print(B(); System.out.println(a); 運(yùn)行下面的代碼:new B();輸出的結(jié)果是:()。2 A.A() 100 B() 200?B.A() 200 B() 200?C.B() 200 A() 100?D.B() 200 A() 200正確答案:A29.(單選

14、)如下方法聲明中,錯(cuò)誤的是()2 A.public void say() System.out.print(“Hi”); ?B.public void say() System.out.print(“Hi ); return; ?C.public int say() System.out.print(“Hi ); return; ?D.public int say() System.out.print(“Hi ); return 0; 正確答案:C30.(單選)下列代碼編譯和運(yùn)行的結(jié)果是()。 public class A public void start() System.out.prin

15、tln(TestA); public class B extends A public void start() System.out.println(TestB); public static void main(String口args) (A) newB().start(); 輸出:TestA2 A.?B.輸出:TestB?C.輸出:TestA TestB?D.編譯錯(cuò)誤正確答案:B31.(單選)下列代碼的運(yùn)行結(jié)果是:public class GoTest public static void main(String口args) Sente a = new Sente(); a.go();

16、Goban b = new Goban(); b.go(); Stone c =new Stone(); c.go(); class Sente implements Go public void go() System.out.println(go in Sente); class Goban extends Sente public voidgo() System.out.println(go in Goban); class Stone extends GobanimplementsGo interface Go public void go(); ?A.go in Goban go i

17、n Sente go in Sente?B.go in Sente go in Sente go in Goban?C.go in Sente go in Goban go in Goban?D.go in Goban go in Goban go in Sente(單選)程序的執(zhí)行結(jié)果是()。 public class Test int x; public static voidmain(String 口 args) Test t = new Test(); t.x=5; change(t);System.out.println(t.x); public static void change

18、(Test t) t.x=3; ?A.5?B.3?C.0?D.正確答案:B33.(單選)分析如下語句,說法錯(cuò)誤的是()2 A.break可用于跳出循環(huán),當(dāng)多層嵌套時(shí),只用于跳出一層循環(huán)?B.break即可以出現(xiàn)在循環(huán)語句中也可以出現(xiàn)在switch語句中?C.continue可以用于跳出循環(huán)?D.continue不能出現(xiàn)在switch語句中正確答案:C43.(單選)請(qǐng)看下歹U代碼編譯和運(yùn)行的結(jié)果是:package packagea; public class Message String getText() return text; package packageb; public class

19、XMLMessage extends packagea.Message String getText() return text”; public static void main(String口 args) System.out.println(newXMLMessage().getText(); ?A.text?B.text?C.拋出運(yùn)行時(shí)異常?D.代碼 public class XMLMessage extends packagea.Message 行, 編譯錯(cuò)誤正確答案:B35.(單選)程序執(zhí)行的結(jié)果是()。 public class Test String name=Tom; pub

20、licTest(String name) name=name; public static void main(String 口 args) Test t=new Test(Jack); System.out.println(); ?A.null?B.Tom?C.Jack?D.正確答案:B36.(單選)請(qǐng)看下列代碼的輸出結(jié)果是:public class Bootchy int bootch; String snootch;public Bootchy() this(snootchy); System.out.print(first ); publicBootchy(String s

21、nootch) this(420, snootchy); System.out.print(second ); public Bootchy(int bootch, String snootch) this.bootch = bootch; this.snootch =snootch; System.out.print(third ); public static void main(String口 args) Bootchy b = new Bootchy(); System.out.print(b.snootch + + b.bootch); ?A.first second third s

22、nootchy 420?B.third second first snootchy 420?C.third first second snootchy 420?D.first second first third snootchy 420正確答案:B37.(單選)下列代碼的輸出結(jié)果是:()。 public class StaticFoo int num; static int x; public static void main(String口 args) StaticFoo fool = new StaticFoo ();foo1.num+; foo1.x+; StaticFoo foo2

23、= new StaticFoo (); foo2.num+; foo2.x+;StaticFoo foo3 = new StaticFoo (); foo3.num+; foo3.x+; StaticFoo.x+;System.out.print(foo3.num+,); System.out.println(foo3.x); ?A.3,3?B.1,3?C.3,4?D.1,4正確答案:D38.(單選)請(qǐng)看下列程序的輸出結(jié)果是:public class Item private String desc; publicString getDescription() return desc; pub

24、lic void setDescription(String d) desc = d; public static void modifyDesc(Item item, String desc) item = newItem(); item.setDescription(desc); public static void main(String口 args) Item it = new Item(); it.setDescription(Gobstopper); Item it2 = new Item();it2.setDescription(Fizzylifting); modifyDesc

25、(it, Scrumdiddlyumptious);System.out.println(it.getDescription();System.out.println(it2.getDescription(); ?A.Scrumdiddlyumptious Scrumdiddlyumptious?B.Scrumdiddlyumptious Fizzylifltng?C.Gobstopper Scrumdiddlyumptious?D.Gobstopper Fizzylifting正確答案:D39.(單選)下面的代碼用于對(duì)數(shù)組 arr實(shí)現(xiàn)冒泡排序:for (int i = 0; i i; j-)

26、 if (arrj 0; j-) if (arrj arrj - 1) int temp = arrj; arrj = arrj - 1; arrj - 1 = temp; isSwap = true; ?C.for (int j = i + 1; j arr.length; j+) if (arrj arrj - 1) int temp =arrj; arrj = arrj - 1; arrj - 1 = temp; isSwap = true; ?D.for (int j = i; j arr.length; j+) if (arrj arrj - 1) int temp = arrj;a

27、rrj = arrj - 1; arrj - 1 = temp; isSwap = true; 正確答案:A40.(單選)請(qǐng)看下歹U代碼:class Payload private int weight; public Payload(int wt) weight = wt; public Payload() public void setWeight(int w) weight = w; public String toString() return Integer.toString(weight); public class TestPayload static void changePa

28、yload(Payload p) public staticvoid main(String args) Payload p = new Payload(); p.setWeight(1024);changePayload(p); System.out.println(The value of p is + p); 假設(shè)運(yùn)行后輸出“The value of p is 420,那么 插入代碼處應(yīng)填入代碼是:?A.p.setWeight(420);?B.Payload.setWeight(420);?C.p = new Payload(420);?D.p = new Payload(); p.se

29、tWeight(420);41. returnRaceCar+ .正確答案:A(單選)下列代碼的輸出結(jié)果是()。abstract class Vehicle public int speed() 0; class Car extends Vehicle public int speed() return 60; class extends Car public int speed() return 150; public class TestCar public static void main(String口 args) RaceCar racer = new RaceCar(); Car

30、car = new RaceCar(); Vehicle vehicle = new RaceCar(); System.out.println(racer.speed() + car.speed() + , + vehicle.speed(); 0, 0, 02 A.?B.150, 60, 0?C.150, 150, 150?D.拋出運(yùn)行時(shí)異常正確答案:C42.(單選)題目:下列代碼的輸出結(jié)果是:()。public class A public voidinfo() System.out.println(A info); public class B extends A public voi

31、dinfo() System.out.println(B info); public static void main(String口 args) B b=new B(); A a=b; (); ?A.B info A info?B.A info B info?C.A info?D.B info正確答案:D43.(單選)請(qǐng)看下列代碼:class ClassA class ClassB extends ClassA class ClassCextends ClassA public class Test public static void main(String口 args) Cl

32、assA p0 = new ClassA(); ClassB p1 = new ClassB(); ClassC p2 = new ClassC(); ClassA p3=new ClassB(); ClassA p4 = new ClassC(); 插入代碼 可以在 插入代碼處,填入的代碼正確的是()?A.p0 = p1;?B.p1 = p2;?C.p2 = p4;?D.p2 = (ClassC)p1;正確答案:A44.(單選)下列代碼的運(yùn)行結(jié)果是()。public class Animal public String noise() return peep; public static v

33、oid main(String口 args) Animal animal = new Dog(); Catcat = (Cat)animal; System.out.println(cat.noise(); class Dog extends Animal public String noise() return bark; class Cat extends Animal public String noise() return meow; ?A.peep?B.bark?C.meow?D.拋出運(yùn)行時(shí)異常正確答案:D45.(單選)類 A, B 和 C 的定義如下: public class A

34、 public void f() System.out.println(A.f(); public class B extends A public void f() System.out.println(B.f(); public class C public void g(A a) System.out.println(g(A a); a.f(); public void g(B b) System.out.println(g(B b); b.f(); 運(yùn)行下面程序:C c = new C(); A a = newB(); c.g(a);輸出的結(jié)果是:()。?A.g(A a) A.f()?

35、B.g(A a) B.f()?C.g(B b) A.f()?D.g(B b) B.f()正確答案:B46.(多選)請(qǐng)看下歹U代碼:package com.tarena; public class Geodetics public staticfinal double DIAMETER = 12756.32; 訪問靜態(tài)常量 DIAMETER:方式正確的是:?A.import com.tarena.Geodetics; public class TerraCarta public doublehalfway() return Geodetics.DIAMETER/2.0; ?B.import com.tarena.Geodetics; public class TerraCarta publ

溫馨提示

  • 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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論