Anda di halaman 1dari 2

國立屏東教育大學 98 學年度研究所碩士班入學考試

計算機概論 試題
(資訊科學系碩士班)
※請注意:1.本試題共二頁。
2.答案須寫在答案卷上,否則不予計分。

問答題(共 100 分)
1. Consider the following structure of the instruction register.
What is the maximum number of distinct operation codes that can be recognized and executed
by the processor on this machine? What is the maximum memory size on this machine? (10
分)

Op code Address-1 Address-2

6 bits 10 bits 10 bits


2. Consider a demand-paging system with the following time-measured utilizations:
CPU utilization 20%
Paging disk 97.7%
Other I/O devices 5%
Which (if any) of the following will (probably) improve CPU utilization? Explain your
answer. (20 分)
(a) Install a faster CPU
(b) Install a bigger paging disk
(c) Increase the degree of multiprogramming
(d) Decrease the degree of multiprogramming
(e) Install more main memory
3. Consider the C++ program fragments given below. Assume that n, m, and k are unsigned
integers and that the functions e, f, g, and h have the following characteristics:
• The worst case running time for e(n,m,k) is O(1), and it returns a value between 1 and
(n+m+k).
• The worst case running time for f(n,m,k) is O(n+m).
• The worst case running time for g(n,m,k) is O(m+k).
• The worst case running time for h(n,m,k) is O(n+k).
Determine a tight, big oh expression for the worst case running time of each of the following
program fragments: (20 分)
(a). f(n, 10, 0);
g(n, m, k);
h(n, m, 10000);

(b). for (unsigned int i = 0; i < n; ++i)


f (n, m, k);

(c). for (unsigned int i = 0; i < e(n, m, k); ++i)

第 1 頁,共 2 頁
f (n, 10, 0);
(d). for (unsigned int i = 0; i < n; ++i)
for (unsigned int j = i; j < n; ++j)
f (n, m, k);
4. Explain the operation of my fun(v) on some vertex v of the given graph.
Here `graph' in line 7 is an adjacency list for representing graph. (10 分)
1 #define MAX_VERTICES 50
2 typedef struct node *node_pointer;
3 typedef struct node{
4 int vertex;
5 struct node *link;
6 };
7 node_pointer graph[MAX_VERTICES];
8
9 void my_fun(int v)
10 {
11 node_pointer w;
12 visited[v] = TRUE;
13 printf("%5D",v);
14 for (w = graph[v]; w; w = w->link)
15 if(!visited[w->vertex])
16 my_fun(w->vertex);
17 }
5. Write the postfix form of the following expressions: (a) -a+b-c+d (b) a*-b+c (c) (a+b)*d+e/
(f+a*d)+c (6 分)
6. The Fibonacci numbers are defined as: f 0 = 0, f 1 = 1, and f i −1 + f i −2 for i > 1 . Write a program to
compute fi . (14 分)
7. There are three towers and 64 disks of different diameters placed on the frst tower. The disks
are in order of decreasing diameter as one scans up the tower. Monks were reputedly supposed
to move the disk from tower 1 to tower 3 obeying the rules: (a) Only one disk can be moved at
any time. (b) No disk can be placed on top of a disk with a smaller diameter. Write a recursive
function that prints out the sequence of moves needed to accomplish this task. (20 分)

第 2 頁,共 2 頁

Anda mungkin juga menyukai