國立台中師範學院九十三學年度研究所碩士班招生考試試題
科目:程式設計
適用:測統、數教
一、選擇題:共 25 題,(50%)
第一部分:共 11 題,(22%)
1. Java 在執行期間呼叫同名異式的方法叫做
(1) implementation (2) inheritance (3) dispatch (4) abstract
2. 演算法之時間複雜度分析中以
(1)最佳狀況時間複雜度 (2)最差狀況時間複雜度 (3)平均狀況時間複雜度 (4)以上皆非 用處最大
3. 若 A(1,1) 在位置 2,A(2,3) 在位置 62,A(3,2) 在位置 104 則此陣列每列有 (1) 2 (2) 4 (3) 6 (4) 8 元素
4. 承第 3 題,此陣列之配置方式為
(1) row major (2) column major (3) mix major (4)以上皆非
5. 有關 linked list 敘述下列何者有誤?
(1)必須使用連續空間 (2)資料存取比陣列不靈活 (3)比陣列節省空間 (4)資料插入與刪除較陣列靈活
6. 下列程式中,最多可省略幾行指令,其執行結果不變。 (1) 2 (2) 3 (3) 4 (4) 5 程式開始『 #include <stdio.h> #include <stdlib.h> int main() { int i;
for (i=1; i<=10; i++) { printf("%5d ", rand()); if (i%5==0) { printf("\n"); } } return 0; } 』程式結束 7. 下列程式中,正常執行後,出現在畫面上之所有「x++」值中,數字最大為? (1) 13 (2) 14 (3) 15 (4) 16 程式開始『 #include <stdio.h> int main() { int x=10,y; y=++x*2; printf("y=%d ++x=%d x=%d\n", y, ++x, x); y=2*x++; printf(" x=%d ++x=%d x++=%d x=%d\n", x, ++x, x++, x); printf("y=%d x=%d ++x=%d x++=%d x=%d x++=%d\n", y, x, ++x, x++, x, x++ ); return 0; } 』程式結束
8. 第一步: 把數列分成二個子數列,各個數列擁有 n/2 個數字。
第二步: 排列各個子數列,除非此子數列夠小(只剩一個數字),否則再繼續 重覆第一步。
第三步: 結合每一個子數列使之成為單一數列。 請問這是何種排序法?
(1) Exchange sort (2) Insertion sort (3) Merge sort (4) Quick sort
9. 有一個資料列,其兩端分為頭端和尾端。新進資料由資料列的尾端,而 刪除資料卻是除去資料列頭端的資料,我們稱這樣的資料列為:
(1) Stack (2) Queue (3) Tree (4) Linked list
10. 請問在 ASP 的 VB 中,「Sub ……End Sub」代表什麼意思?
(1) 宣告一個物件 (2) 建構一個函式 (3) 執行一個減法 (4) 定義一個子程式
11. 請問在 SQL 中,建立資料表的語法是什麼? (1) OPEN DATABASE [ table_name ] ( …… ) (2) CREATE TABLE [ database_name ] ( …… ) (3) OPEN TABLE [ database_name ] ( …… ) (4) CREATE DATABASE [ table_name ] ( …… )
第二部分:共 5 題,(10%)
常見的演算法可分為下列五種:(1) Greedy Method (2) Dynamic Programming (3) Divide-and-Conquer (4) Backtracking (5) Branch-and-Bound
下列演算法各屬於哪一類: 12. Breadth-First Search
(1) Backtracking (2) Divide-and-Conquer (3) Greedy Method (4) Branch-and-Bound
13. Depth-First Search
(1) Divide-and-Conquer (2) Backtracking (3) Greedy Method (4) Dynamic Programming
14. Floyd-warshall Algorithm
(1) Greedy Method (2) Divide-and-Conquer (3) Dynamic Programming (4) Branch-and-Bound
15. Dijkstra’s Algorithm
(1) Greedy Method (2) Backtracking (3) Divide-and-Conquer (4) Branch-and-Bound
16. Quicksort
(1) Divide-and-Conquer (2) Greedy Method (3) Dynamic Programming (4) Branch-and-Bound
第三部分:共 9 題,(18%)
17. How many strongly connected components are there in the following graph?
4
5
1
(1) 2 (2) 3 (3) 4 (4) 5
18. Which of the following algorithms does NOT work with directed graphs? (1) Minimal Spanning Trees Algorithms
(2) Breadth-first Sort (3) Topologic Sort
(4) Single-source Shortest-path algorithms
19. Which of the following algorithms check for the presence of a negative weight cycle when executing?
1. Dijkstra Algorithm 2. Bellman-Ford Algorithm 3. DAG-Shortest-Path Algorithm 4. Floyd-Warshall Algorithm 5. Faster-All-Pairs-Shortest-Path Algorithm (1) all (2) 2, 4 (3) 2 (4) 4, 5
20. Which of the following problems is NOT a problem solvable by a greedy algorithm?
(1) The activity selection problem where the goal is to maximize the umber of activities scheduled.
(2) The fractional knapsack problem. (3) The HUFFMAN code algorithm. (4) The 0-1 knapsack problem.
21. Suppose you wish to find the successor to a given element in a dictionary in addition to supporting search, insertion, and deletion operations. Also assume that all operations will be carried out with equal frequency, and that for the deletion and successor operations, you have a pointer to the element in a question. Which data structure should you select to represent the dictionary to most efficiently support the required operations?
(1) A balanced binary search tree (2) An unsorted linked list (3) A hash table
22. Consider the following Stooge-Sort algorithm with array A[1]=8, A[2]=8,…, A[8]=1, A[9]=0. What will the array look like after line 6 is executed in the top-level call to Stooge-Sort(A,1, 9)?
Stooge-Sort (A i j, , ) 1 if A i[ ]>A j[ ] 2 then exchange A i[ ]↔ A j[ ] 3 if i+ ≥1 j 4 then return 5 [ 1] 3 j i− + = k 6 Stooge-Sort (A i j, , −k) 7 Stooge-Sort ( ,A i+k j, ) 8 Stooge-Sort (A i j, , −k) (1) 0, 3, 4, 5, 6, 7, 2, 1, 8 (2) 3, 4, 5, 6, 7, 8, 2, 1, 0 (3) 0, 5, 6, 7, 4, 3, 2, 1, 8 (4) 5, 6, 7, 8, 4, 3, 2, 1, 0
23. Designing a hash table requires much more knowledge than writing the search, insert, and delete routines. Which of the following should be avoided when designing a hashing scheme?
1. A prime table size using the division method.
2. A table size of 7 when a character string is interpreted in radix 8 using the multiplication method.
3. A table size of a power of 2 when using the division method.
4. A table size of a power of 10 when processing decimal numbers as keys in the division method.
24. Which of the following statements is false?
(1) Linear probing suffers from primary clustering. (2) Double hashing suffers form secondary clustering.
(3) Open addressing makes the assumption of uniform hashing.
(4) A finite collection of hash functions is said to be universal if for each pair of distinct keys , the number of hash functions for which
is , x y∈U h∈H ( ) ( ) h x =h y the size of H m .
25. What is the maximum number of elements in a d-ary heap of height 7? (1) 8 1 1 d d − − (2) 8 1 d d − − 1 (3) 7 1 1 d d − − (4) 7 1 d −
二、問答題:共 5 題,(50%)
1. 何謂抽象資料型態(Abstract Data Type:ADT)? (10%)
2. 寫出下式之二元樹與後序表示法(a+b)*d+e/(f+a/d)+c*(p+q) (10%) 3. 依函式的參數(parameter)及傳回值(return value)的有無,(1)任舉不同架構之兩
例;(2)配合上兩例,依使用目的不同加以重點說明。 (10%) 4. 請問利用遞迴寫成的函數,優缺點為何? (10%)
5. 請用你所熟悉的電腦語言(例如 Html, ASP, VB script, Java script, XML 等), 發揮你的創意,寫出一個簡易的線上票選明星(3 位)的網頁程式。並且請在 程式行間,寫上簡明扼要的註解。 (10%)