試題1已知變數a和obj的定義如下:
object a1 = ;
object obj = a1;
則下面語句執行時會丟擲異常的是( )。
a. object a2 = (object)obj;
b. string str1 = (string)((object)obj)[1]
c. string a3 = (string)obj
d. string str2 = (string)a1[2]
試題2已知類foo的定義如下:
public class foo
}執行下面程式段:
foo a1 = ;
foo a2 = new foo[a1.length];
system.arraycopy(a1, 0, a2, 0, a1.length);
system.out.println((a1 == a2a1[1] == a2[1]));
控制台輸出的結果是( )。
a. false,true
b. false,false
c. true,true
d. true,false
試題3已知類foo的定義如下:
public class foo
public boolean equals(object obj) else
}執行下面程式段:
arraylist list = new arraylist();
hashset set = new hashset();
list.add(new foo(1));
set.add(new foo(1));
system.out.println( foo(1)) + 「,」
+ foo(1)));
控制台輸出的結果是( )。
a.true,false
b. true,true
c. false,false
d. false,true
試題4已知類a、b、c和介面d的定義如下:
public class a
public class b extends a implements d
public class c extends a
public inte***ce d
變數a、b、c、d的定義如下:
a a = new a(); b b = new b();
c c = new c(); d d = null;
則下列語句會有編譯錯誤的是( )。
a. a = b;
b. d = b;
c. d = (d)a;
d. c = (c)b;
試題5執行如下**:
class cone
}class ctwo extends cone
}class cthree
public void g(ctwo two)
}public class main
}控制台輸出的結果是( )。
a. g(cone)
ctwo.f
b. g(cone)
cone.f
c. g(ctwo)
ctwo.f
d. g(ctwo)
cone.f
試題6執行如下**
class foo
}class bar extends foo
}public class main
}控制台輸出的結果是( )。
a.bar()
10foo()
5b. foo()
5bar()
10c. bar()
5foo()
10d. foo()
10bar()
5 試題7
實現point類的equals方法,具體邏輯為:「成員變數x和y分別相等的point物件被視為相等」。
public class point
}以下**正確的是( )。
a.if(obj.x == this.x || obj.y == this.y)
return false;
b.if(obj.x == this.x && obj.y == this.y)
return false;
c.if(!(obj instanceof point)) return false;
if(((point)obj).x == ((point)obj).y && this.x == this.y)
return false;
d.if(!(obj instanceof point)) return false;
if(((point)obj).x == this.x && ((point)obj).y == this.y)
return false;
試題8執行如下**:
list list = new arraylist();
//向list中插入內容
list.set(2, list.set(5,list.get(2)))
system.out.println(list);
控制台的輸出結果是( )。
a. [1, 2, 5, 4, 5, 2]
b. [1, 5, 3, 4, 2, 6]
c. [1, 2, 6, 4, 5, 3]
d. [1, 2, 3, 4, 5, 3]
試題9執行如下**:
list list = new arraylist();
//向list中插入內容
… … …
list.sublist(2, 5).clear();
system.out.println(list);
控制台的輸出結果是( )。
a. [1, 2, 3, 6]
b. [1, 2]
c. [1, 2, 3]
d. [1, 2, 6]
試題10
題示**的功能為:將兩個有序的arraylist合併為乙個有序的arraylist。
對於兩個存放integer物件的arraylist,
內容分別為:list1: 和 list2:
合併後的list3:
…list list3 = new arraylist();
int size = list1.size() + list2.size();
for (int i = 0, j = 0, k = 0; k < size; k++)
system.out.println(list3);
…完成該功能應該填入的**是( )。
a.if (j >= list2.size() || i > list1.size()
&& list1.get(i) < list2.get(j)) else
b.if (j >= list2.size() || i < list1.size()
&& list1.get(i) < list2.get(j)) else
c.if (j >= list2.size() || i < list1.size()
&& list1.get(i) > list2.get(j)) else
d.if (j >= list2.size() || i < list1.size()
|| list1.get(i) < list2.get(j)) else
試題11
執行如下**:
string ss = "abcdefcde";
int i = ss.indexof("cde", 3);
system.out.println(i);
計算機面試筆試題
一單項選擇題 每題中只有乙個正確答案,每題1分,共80題。計算機基礎 2題 01 下列一組資料中的最大數是 a a a 311 8 b c7 16 c 11001000 2 d 200 10 02 powerpoint中,有關選定幻燈片的說法中錯誤的是 d a 在瀏覽檢視中單擊幻燈片,即可選定。b ...
計算機筆試題
作業系統 1.基本知識點 1 作業系統是控制和管理計算機軟硬體資源,以盡量合理有效的方法組織多個使用者共享多種資源的程式集合。2 作業系統的基本功能 1 處理機管理。主要功能包括程序控制 程序排程 程序同步和程序通訊。2 儲存器管理。主要功能包括記憶體分配 位址對映 記憶體保護和記憶體擴充。3 裝置...
2019計算機教師招聘筆試試題答案
一 填空題 每空1分,共10分 1 馮諾依曼 2 eniac 3 流 4 搜尋引擎 5 10100 6 61.139.2.69或202.98.96.68 7 usb 8 客戶端 伺服器 9 128 10 ping 二 選擇題 每題2分,共60分 1 5 bcdcb 6 10 aaadc 11 15 ...