
代號:
頁次:
-
20 若以插入排序(Insertion sort)對數列(7, 10, 2, 5, 4)進行排序,下列何者是正確步驟?
(7, 10, 2, 5, 4)->(7, 10, 2, 5, 4)->(2, 7, 10, 5, 4)->(2, 5, 7, 10, 4)->(2, 4, 5, 7, 10)
(7, 10, 2, 5, 4)->(2, 7, 10, 5, 4)->(2, 4, 7, 10, 5)->(2, 4, 5, 7, 10)->(2, 4, 5, 7, 10)
(7, 10, 2, 5, 4)->(7, 10, 2, 4, 5)->(2, 4, 5, 7, 10)
(7, 10, 2, 5, 4)->(7, 2, 5, 4, 10)->(2, 4, 5, 7, 10)
21 若宣告下列 2維整數陣列
int a[3][3]={{1, 2},{3, 4, 5},{6}};
則下列那個元素為 0?
a[0][1] a[1][0] a[1][2] a[2][1]
22 給定一個陣列 arr ={45, 66, 78, 89, 91, 95, 120},且欲搜尋的目標鍵值是 key = 95,則使用二元搜尋法
第一次尋找、第二次尋找分別比對那個元素?
89、95 89、91 78、95 78、91
23 Java 程式經編譯後,會先產生什麼格式的檔案?
Assembly code Byte code Machine code Virtual code
24 事先寫好的函式(function)經過編譯(compile)後,將目的檔(object file)集合起來存放於一個檔
案供其他程式連結使用,這種檔案稱為:
系統呼叫(System Call)虛擬碼(Pseudo code)
中斷服務常式(Interrupt Service Routine)函式庫(Library)
25 如下所示之 C程式,其輸出為何?
#include
int data[] = {
6, 8, 4, 3, 11, 18, 17, 29, 25, 23, 27, 24, 22,
48, 43, 55, 68, 63, 62, 69, 65, 72, 77,
85, 88, 81, 99, 97, 92, 94, 91
};
int count[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
int main(void)
{int ii, nn = sizeof(data)/sizeof(data[0]);
for (ii=0; ii < nn; ii++) {
count[data[ii] / 10]++;
}
for (ii=0; ii < 10; ii+=2) {
printf("%2d,", count[ii]);
}
return 0;
}
4, 3, 6, 0, 2 4, 6, 2, 5, 3 3, 0, 1, 2, 5 4, 3, 6, 0, 2, 1, 5, 2, 3, 5
26 執行下列 C程式,並輸入「10 10 9」,下列何者為程式的輸出?
#include
#include
int main() {
int count =0, x=10, next;
scanf("%d", &next);
while (next == x)
{count++;
scanf("%d", &next);
}
printf("%d", count);
}
23910