




已閱讀5頁(yè),還剩18頁(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)介
在線考試 本次考試得分:100.0溫馨提示:第七題BC答案都正確1.(單選)下列屬于不合法Java標(biāo)識(shí)符的是()。 A._mem B.12a C.M12 D.$12正確答案:B2.(單選)程序的執(zhí)行結(jié)果是: public class Test public static void main(String args) System.out.println(+a+1); A.98 B.a1 C.971 D.197正確答案:B3.(單選)下列Java標(biāo)識(shí)符,錯(cuò)誤的是() A._sys_varl B.$change C.User_name D.1_file正確答案:D4.(單選)請(qǐng)看下列代碼: public String makinStrings() String s = Fred; s = s + 47; s = s.substring(2, 5); s = s.toUpperCase(); return s.toString(); 調(diào)用makinString方法,得到的字符串長(zhǎng)度是: A.1 B.2 C.3 D.4正確答案:C5.(單選)分析如下代碼,輸出結(jié)果為()。 public static void main(String args) int i = 0; boolean re = false; re = (+i) + i = 2) ? true : false; System.out.println(i= + i + ,re=+re); A.i=1,re=true B.i=0,re=true C.i=1,re=false D.i=0,re=false正確答案:A6.(單選)下列代碼的運(yùn)行結(jié)果是() public static void main(String args) String str = 420; str += 42; System.out.print(str); A.42 B.420 C.462 D.42042正確答案:D7.(單選)請(qǐng)看下列代碼: public static void main(String args) System.out.println(s); 如果程序輸出的結(jié)果是4247,那么在處應(yīng)該填入代碼是()。 A.String s = 123456789; s = (s-123).replace(1,3,24) - 89; B.StringBuffer s = new StringBuffer(123456789); s.delete(0,3).replace( 1,3, 24).delete(4,6); C.StringBuffer s = new StringBuffer(123456789); s.delete(0,3).replace( 1,3, 24).delete(4,6); D.StringBuilder s = new StringBuilder(123456789); s.substring(3,6).delete( 1 ,2).insert( 1, 24);正確答案:B8.(單選)下列關(guān)于IDE開(kāi)發(fā)環(huán)境Eclipse,說(shuō)法錯(cuò)誤的是:()。 A.Eclipse可以通過(guò)插件(plugin)的方式擴(kuò)展其功能。 B.Eclipse聯(lián)盟是由IBM公司捐資組建的。 C.Eclipse使用了SWT圖形界面技術(shù)。 D.Eclipse的運(yùn)行不需要有JRE的支持。正確答案:D9.(單選)下列賦值語(yǔ)句中,正確的是()。 A.byte b1 = 10, b2 = 20; byte b=b1+b2; B.byte b1 = 10, b2 = 20; byte b=b1; C.byte b1 = 10, b2 = 20; byte b=b11; D.byte b1 = 10; byte b=+b1;正確答案:D10.(單選)運(yùn)行下面的語(yǔ)句: String s=; if(s=s+0) System.out.println(Hello World); 編譯,運(yùn)行的結(jié)果是:()。 A.Hello World B.無(wú)輸出 C.編譯錯(cuò)誤 D.拋出運(yùn)行時(shí)異常正確答案:B11.(單選)下列代碼編譯和運(yùn)行的結(jié)果是: public static void main(String args) String elements = for, tea, too ; String first = (elements.length 0) ? elements0 : null; System.out.println(first); A.編譯出錯(cuò) B.輸出:tea C.輸出:for D.輸出:null正確答案:C12.(單選)下列表達(dá)式中,可以得到精確結(jié)果的是()。 A.double d1 = 3.0 - 2.6; B.double d4 = 2.5 * 1.5; C.double d2 = 30/300; D.double d3 = 1/2 + 0.5;正確答案:B13.(單選)下列關(guān)于JVM說(shuō)法,錯(cuò)誤的是()。 A.JVM通過(guò)專門的線程實(shí)現(xiàn)內(nèi)存的回收。 B.使用java命令時(shí),可以通過(guò)參數(shù)來(lái)設(shè)置分配JVM的內(nèi)存大小。 C.JRE包括JVM及Java核心類庫(kù)。 D.目前主流版本JVM通過(guò)純解釋的方式運(yùn)行Java字節(jié)碼。正確答案:D14.(單選)請(qǐng)看下列代碼: 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() /*do something*/ B.public class Employee implements Info extends Data public 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() /*do something */ public void Info.load() /*do something*/ 正確答案:A15.(單選)下列數(shù)組聲明語(yǔ)句中,錯(cuò)誤的是:()。 A.int arr = new int8; B.int arr = new int8; C.int arr = ; D.int arr = new int;正確答案:B16.(單選)運(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; 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 twoArr.length) System.arraycopy(twoArr, q, threeArr, p + q, twoArr.length - q); System.out.println(Arrays.toString(threeArr); 輸出的結(jié)果是:()。 A.2,11,26,27,37,44,48,60,19,35,49,55,58,75,83,84,91,93; B.2,11,19,26,27,35,37,44,48,49,55,58,60,75,83,84,91,93; C.19,35,49,55,58,75,83,84,91,93,2,11,26,27,37,44,48,60; D.2,19,11,35,26,49,27,55,37,58,44,75,48,83,60,84,91,93;正確答案:B17.(單選)程序的執(zhí)行結(jié)果是: public class Test public static void main(String args) String str1 = new String(abc); String str2 = new String(abc); String str3 = str1; if(str1.equals(str2) System.out.println(true); else System.out.println(false); if(str1=str3) System.out.println(true); else System.out.println(false); A.true true B.true false C.false true D.false false正確答案:A18.(單選)運(yùn)行下面的程序: String fileNames = abc.txt, bcd.exe, cde.exe, def.dat,efg.exe ; for (String fileName : fileNames) if (fileName.endsWith(.exe) System.out.print(fileName.substring(0, fileName .lastIndexOf(.exe)+ ); 控制臺(tái)的輸出結(jié)果是:()。 A.bcd. cde. efg. B.bc cd ef C.bcd.exe cde.exe efg.exe D.bcd cde efg正確答案:D19.(單選)如下方法聲明中,錯(cuò)誤的是()。 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; 正確答案:C20.(單選)數(shù)據(jù)類型int、char和double所占用內(nèi)存字節(jié)數(shù)分別是:()。 A.4、2和8 B.2、2和4 C.2、1和8 D.4、4和4正確答案:A21.(單選)關(guān)于String 和 StringBuffer 下面說(shuō)法正確的是()。 A.String操作字符串不改變?cè)凶址膬?nèi)容 B.StringBuffer連接字符串速度沒(méi)有String快 C.String可以使用append方法連接字符串 D.StringBuffer在java.util包中正確答案:A22.(單選)運(yùn)行下面的程序: int a = 100; int b = 200; a = a + b; b = a - b; a = a - b; System.out.println(a= + a + , b= + b); 輸出的結(jié)果是:()。 A.a=100, b=300 B.a=100, b=200 C.a=200, b=100 D.a=300, b=200正確答案:C23.(單選)下列代碼的輸出結(jié)果是: public class Yikes public static void go(Long n) System.out.println(Long); public static void go(Short n) System.out.println(Short); public static void go(int n) System.out.println(int); public static void main(String args) short y = 6; long z = 7; go(y); go(z); A.Long Long B.Short Long C.int Long D.int int正確答案:C24.(單選)分析如下語(yǔ)句,說(shuō)法錯(cuò)誤的是()。 A.break可用于跳出循環(huán),當(dāng)多層嵌套時(shí),只用于跳出一層循環(huán) B.break即可以出現(xiàn)在循環(huán)語(yǔ)句中也可以出現(xiàn)在switch語(yǔ)句中 C.continue可以用于跳出循環(huán) D.continue不能出現(xiàn)在switch語(yǔ)句中正確答案:C25.(單選)A類中有一個(gè)方法:protected int print(String str),B類繼承A類, 以下方法能在B類中重寫A類中print()方法的是: ()。 A.public int print(String str) B.private int print(String str) C.private void print(String str) D.public void print(String str)正確答案:A26.(單選)下列代碼的運(yùn)行結(jié)果是: String test = Test A. Test B. Test C.; String regex = .s*; String result = test.split(regex); for (String s : result) System.out.print(s + ); A.Test A Test B Test C B.Test A. Test B. Test C. C.Test . Test . Test . D.A. B. C.正確答案:A27.(單選)請(qǐng)看下列代碼 public class Member private Long userId; private String nickName; /以下是getter和sett方法 Main方法中的代碼: Member m1=new Member(); m1.setUserId(new Long(100001); m1.setNickName(mick); Member m2=new Member(); m2.setUserId(new Long(100001); m2.setNickName(mick); System.out.println(m1=m2); System.out.println(m1.equals(m2); 控制臺(tái)的輸出結(jié)果是: A.true false B.false true C.false false D.true ture正確答案:C28.(單選)實(shí)現(xiàn)Point類的equals方法,具體邏輯為:“成員變量x和y分別相等的Point對(duì)象被視為相等”。 public class Point private int x; private int y; . public boolean equals(Object obj) 填入代碼 插入代碼處應(yīng)填入的代碼正確的是: A.if(obj.x = this.x | obj.y = this.y) return true; return false; B.if(obj.x = this.x & obj.y = this.y) return true; return false; C.if(!(obj instanceof Point) return false; if(Point)obj).x = (Point)obj).y & this.x = this.y) return true; return false; D.if(!(obj instanceof Point) return false; if(Point)obj).x = this.x & (Point)obj).y = this.y) return true; return false;正確答案:D29.(單選)運(yùn)行下列代碼,輸出為false的是:()。 A.String st1 = abc; System.out.println(abc = st1); B.String st2 = abc; System.out.println(st2.equals(new String(abc); C.Integer i = 100; System.out.println(100 = i); D.ArrayList list = new ArrayList(); System.out.println(list.contains(null);正確答案:D30.(單選)請(qǐng)看下列代碼,出現(xiàn)錯(cuò)誤的行是:() public interface Cookie Cookie cookie=new Cart (小面包,盼盼); public class Cart implements Cookie private String name; private String production; public Cart(String name,String production) =name; duction=production; public void smell() cookie =new Cart(蛋黃派,達(dá)利園); A.第2行 B.第4行 C.第11行 D.第12行正確答案:D31.(單選)請(qǐng)看下列代碼的輸出結(jié)果是: public class Bootchy int bootch; String snootch; public Bootchy() this(snootchy); System.out.print(first ); public Bootchy(String snootch) 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 snootchy 420 B.third second first snootchy 420 C.third first second snootchy 420 D.first second first third snootchy 420正確答案:B32.(單選)下列語(yǔ)句創(chuàng)建對(duì)象的總個(gè)數(shù)是:()。 String s=”a”+”b”+”c”+”d”+”e”; A.1 B.2 C.3 D.4正確答案:A33.(單選)下面的代碼用于對(duì)數(shù)組arr實(shí)現(xiàn)冒泡排序: for (int i = 0; i i; j-) 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; arrj = arrj - 1; arrj - 1 = temp; isSwap = true; 正確答案:A34.(單選)請(qǐng)看下列代碼: 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 changePayload(Payload p) public static void 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.setWeight(420);正確答案:A35.(單選)下列代碼運(yùn)行的結(jié)果是()。 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; A.foofoofoofoofoo B.foobarfoobarbar C.foobarfoofoofoo D.foobarfoobarfoo正確答案:D36.(多選)請(qǐng)看下列代碼: 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; 下列選項(xiàng)中能正確使用Shape類的是: A.public class Circle implements Shape private int radius; B.public abstract class Circle extends Shape private int radius; C.public class Circle extends Shape private int radius; public void draw(); D.public class Circle extends Shape private int radius; public void draw() /* code here */ 正確答案:BD37.(多選)在Java語(yǔ)言中,下列說(shuō)法正確的是()。 A.一個(gè)接口可以繼承多個(gè)接口 B.一個(gè)類可以繼承多個(gè)類 C.一個(gè)類可以實(shí)現(xiàn)多個(gè)接口 D.一個(gè)類可以有多個(gè)子類正確答案:ACD38.(多選)請(qǐng)看下列代碼: package com.tarena; public class Geodetics public static final double DIAMETER = 12756.32; 訪問(wèn)靜態(tài)常量DIAMETER的方式正確的是: A.import com.tarena.Geodetics; public class TerraCarta public double halfway() return Geodetics.DIAMETER/2.0; B.import com.tarena.Geodetics; public class TerraCarta public double halfway() return DIAMETER/2.0; C.import com.tarena; public class TerraCarta public double halfway() return Geodetics.DIAMETER/2.0; D.import com.tarena.*; public class TerraCarta public double halfway() return Geodetics.DIAMETER/2.0; 正確答案:AD39.(多選)請(qǐng)看下列代碼 public class Foo public void method(String str,int age) 和Foo類中method方法重載的方法是: A.public int method(String str,int age) B.public void method(String s,int year) C.public void method(int year,String s) D.public int method(int year,String s)正確答案:CD40.(多選)在處,填入下列代碼編譯正確的是: public void foo(int x) A.foreach(int z : x) System.out.println(z); B.for(int z : x) System.out.println(z); C.while( x.hasNext() System.out.println( x.next(); D.for( int i=0; i 0) 插入代碼 A.int length = str.length(); char first=str.charAt(0); String strNew = str.replaceAll(String.valueOf(first), ); if (lengthstrNew.length() max_length = length - strNew.length(); System.out.println(first+:+max_length); B.int length = str.length(); char first=str.charAt(0); String strNew = str.replaceAll(String.valueOf(first), ); if (lengthstrNew.length() max_length = length - strNew.length(); str = strNew; System.out.println(first+:+max_length); C.int length = str.length(); String first = str.substring(0, 1); String strNew = str.replaceAll(first, ); if (lengthstrNew.length() max_length = length - strNew.length(); str = strNew; System.out.println(first+:+max_length); D.int length = str.length(); String first = str.substring(0, 1); String strNew = str.replaceAll(first, ); if (lengthstrNew.length() max_length = length - strNew.length(); System.out.println(first+:+max_length); 正確答案:BC43.(多選)在Java語(yǔ)言中,下列說(shuō)法正確的是:()。 A.StringBuffer和StringBuilder的區(qū)別在于:StringBuffer是線程安全的而StringBuilder不是。 B.String是不可變對(duì)象,而StringBuffer中封裝的字符串?dāng)?shù)據(jù)是可以動(dòng)態(tài)改變的。 C.判斷兩個(gè)StringBuilder對(duì)象的字符序列是否相同,可以調(diào)用其equlas方法進(jìn)行比較。 D.String的重寫了equals方法,重寫的邏輯是:字符序列相同的String對(duì)象equals方法返回true。正確答案:ABD44.(多選)下面的方法屬于StringBuffer的是:()。 A.size B.insert C.delete D.length正確答案:BCD45.(多選)請(qǐng)看下列代碼: public class Old public static Object get(List list) return list.get(0); 以下選項(xiàng)調(diào)用get方法,能編譯通過(guò)的是: A.Object o = Old.get(n
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 錫礦選礦廠企業(yè)文化建設(shè)與員工關(guān)懷考核試卷
- 聚異氰酸酯共聚物纖維單體應(yīng)用與市場(chǎng)分析考核試卷
- 玉米淀粉在嬰幼兒食品中的應(yīng)用與安全性評(píng)估考核試卷
- 無(wú)創(chuàng)呼吸機(jī)使用基本知識(shí)
- 電氣一次設(shè)計(jì)畢業(yè)答辯
- 麻醉科安全管理
- 伏立康唑在呼吸科臨床應(yīng)用
- 門診外科換藥規(guī)范與操作要點(diǎn)
- 兒童口腔小衛(wèi)士
- CP-865569-生命科學(xué)試劑-MCE
- 2025年北京市高考英語(yǔ)試卷真題(含答案解析)
- 中國(guó)可穿戴醫(yī)療設(shè)備項(xiàng)目創(chuàng)業(yè)計(jì)劃書
- 招商運(yùn)營(yíng)筆試題目及答案
- 湟水河河湟新區(qū)段北岸防洪生態(tài)綜合治理項(xiàng)目 社會(huì)穩(wěn)定風(fēng)險(xiǎn)評(píng)估報(bào)告
- 國(guó)家開(kāi)放大學(xué)本科《商務(wù)英語(yǔ)4》一平臺(tái)機(jī)考真題及答案(第四套)
- 2024年湖北省中考地理生物試卷(含答案)
- 2024年甘肅省天水市中考生物·地理試題卷(含答案)
- GA 1016-2012槍支(彈藥)庫(kù)室風(fēng)險(xiǎn)等級(jí)劃分與安全防范要求
- 2022年小學(xué)六年級(jí)畢業(yè)監(jiān)測(cè)科學(xué)素養(yǎng)測(cè)試題試卷 (含答題卡)
- 新編TSG D0001- 壓力管道安全技術(shù)監(jiān)察規(guī)程——工業(yè)管道(高清晰版)
評(píng)論
0/150
提交評(píng)論