1、在Java中,負(fù)責(zé)對字節(jié)代碼解釋執(zhí)行的是()?
A.應(yīng)用服務(wù)器
B.虛擬機
C.垃圾回收器
D.編譯器
答案選:B
A.5 4 1 3 2
B.2 3 4 1 5
C.1 5 4 3 2
D.2 3 1 4 5
答案選:B
A.物理層數(shù)據(jù)鏈路層傳輸層網(wǎng)絡(luò)層會話層表示層應(yīng)用層
B.物理層數(shù)據(jù)鏈路層會話層網(wǎng)絡(luò)層傳輸層表示層應(yīng)用層
C.物理層數(shù)據(jù)鏈路層網(wǎng)絡(luò)層傳輸層會話層表示層應(yīng)用層
D.網(wǎng)絡(luò)層傳輸層物理層數(shù)據(jù)鏈路層會話層表示層應(yīng)用層
答案選:C
A.連接不會關(guān)閉,只是簡單地歸還給連接池
B.連接被關(guān)閉,但又被重新打開并歸還給連接池
C.連接永久性關(guān)閉
答案選:A
A.eval
B.escape
C.setTimeout
D.parseFloat
答案選:C
A.rm/tmp/aaa
B.rm–r/tmp/aaa
C.rmdir–r/tmp/aaa
D.rmdir/tmp/aaa
答案選:B
A.協(xié)作圖
B.網(wǎng)絡(luò)圖
C.序列圖
D.狀態(tài)圖
答案選:C
A.高峰時段日處理業(yè)務(wù)量100000
B.高峰時段平均每秒請求數(shù)80
C.同時在線用戶100
D.平均每秒用戶請求50
答案選:B
A.Bridge模式
B.Facade模式
C.Adapter模式
D.Proxy模式
答案選:D
A.LinkedHashSet
B.HashSet
C.TreeSet
D.AbstractSet
答案選:C
package com.bjpowernode.test;
import java.util.Iterator;
import java.util.TreeSet;
public class NumberRandom {
String[] stra = {"1", "2", "2", "3", "4", "5"
};
int n = stra.length;
boolean[] visited = new boolean[n];
String result = "";
TreeSet<String> ts = new TreeSet<String>();
int[][] a = new int[n][n];
private void searchMap() {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == j) {
a[i][j] = 0;
} else {
a[i][j] = 1;
}
}
}
//3和5不能相連
a[3][5] = 0;
a[5][3] = 0;
//開始遍歷
for (int i = 0; i < n; i++) {
search(i);
}
Iterator<String> it = ts.iterator();
while (it.hasNext()) {
String str = it.next();
//4不能在第三位
if (str.indexOf("4") != 2) {
System.out.println(str);
}
}
}
private void search(int startIndex) {
visited[startIndex] = true;
result = result + stra[startIndex];
if (result.length() == n) {
ts.add(result);
}
for (int j = 0; j < n; j++) {
if (a[startIndex][j] == 1 && visited[j] == false) {
search(j);
} else {
continue;
}
}
//一個result結(jié)束后踢掉最后一個,尋找別的可能性,若沒有的話,則繼續(xù)向前踢掉當(dāng)前最后一個
result = result.substring(0,result.length() - 1);
visited[startIndex] = false;
}
public static void main(String[] args) {
new NumberRandom().searchMap();
}
}
12、編程題:一個數(shù)如果恰好等于它的因子之和,這個數(shù)就稱為”完數(shù)”.例如6=1+2+3。編程找出1000以內(nèi)的所有完數(shù)。
public class wsTest{
public static void main(String[]args){
for(int m=2;m<1000;m++){
int s=0;
for(int i=1;i<m;i++){
if((m%i)==0)
s+=i;
}
if(s==m){
System.out.print(m+"its factors are:");
for(int j=1;j<m;j++)
{
if((m%j)==0){
System.out.print(j);
System.out.print("");
}
}
System.out.println();
}
}
}
}
結(jié)果:???????
6 its factors are:1 2 3
28 its factors are:1 2 4 7 14
496 its factors are:1 2 4 8 16 31 62 124 248