1
-國立臺中教育大學 101 學年度大學日間部轉學招生考試
計算機概論試題
適用學系:資訊工程學系二、三年級 (本試題共三頁) 一、單選題: 30% 1. 假如有 65 個符號,利用 0/1 的 bit 表示方式,試問需要幾個 bit 的組合才可完 全表示這些符號 ? A. 5 B. 6 C. 7 D. 82. 當 memory space 共有 16MB 且每個 word size 為 16 bits 時,試問需幾個 bit 寬
度方能存取每一個 word ? A. 4
B. 8 C. 16
D. 以上皆非
3. TCP/IP 中哪一層負責整個訊息的 source-to-destination delivery。
A. transport B. network C. data-link D. session 4. 堆疊(stack)是下列哪種結構 A. FIFO B. LIFO C. a 及 b 皆成立 D. a 及 b 皆不成立 5. 在二元樹中 postorder traversal 時,左子樹在何種順序被處理 A. first B. second C. last D. a 及 b 皆成立
6. 在 C 語言中,下列何者為正確的 preprocessor 命令,用以避免標頭檔(header file)
的重複引用。
A. #include “header.h” B. #define HEADER_H
#ifndef HEADER_H
//declarations for header.h go here #endif
C. #ifndef HEADER_H #define HEADER_H
2
-void recursive (int i) { using namespace std; if (i < 6) { cout << i << “ ”; recursive(i); } }
//declarations for header.h go here #endif
D. #ifndef HEADER_H
//declarations for header.h go here #endif
7. C 語言中,下列何者不會建立出一個 C-string(字串),其內容值為 “Hello”?
A. char stringVar[10] = {‘H’, ‘e’, ‘l’, ‘l’, ‘o’}; B. char stringVar[10] = “Hello”;
C. char stringVar[10] = {‘H’, ‘e’, ‘l’, ‘l’, ‘o’, ‘\0’}; D. char stringVar[6] = “Hello”;
E. char stringVar[] = “hello”;
8. 以下有關 C 語言中建構子(constructor)的敘述,何者為是? A. 只能用來初始化 B. 必須將所有成員變數(member variables)初始化 C. 無法做到其他成員方法(member operation)所能做到的 D. 不能有傳入值 E. 通常將全部或大多數的成員變數初始化 9. 以下何者為 Java 語言所不支援的? A. classes B. global functions
C. automatic garbage collection D. support for polymorphism E. pointer
10. 以下算式 10.0 * (76 / 8) + 28.0 的計算結果為何?
A. 118.0 B. 123.0 C. 28.0
D. Incorrect expression, the / should be % E. Incorrect expression, so there is no value 二、填充題:20% (每小題 5%) 1. 試寫出下列數字的two’s complement表示方式:(-29)10 = ( )2, (-763)10 = ( )2 2. C語言中,指標可用於預留記憶體空間以供使用,於使用完畢之後,應以何指令 歸還所預留之空間? ________________。 3. 請問在C字串 (C-String)中,char s[9]這個敘述,最長可存放多少長度的字串? ___ 4. 請問下列的遞迴式中,若呼叫recursive(4)會被執行幾次? _________次
3 -三、問答題:50% 1. 請寫出 binary search 的虛擬程式碼。(10%) 2. 試問一首歌,長度 2 分鐘,具立體聲,在取樣頻率為 44100 次/秒時,若以 16 bit 儲存每次取樣資料,在未壓縮情況下,此首歌曲占用多大儲存空間。(10%) 3. 請說明網路協定中,CSMA/CD 如何解決碰撞問題。(10%) 4. 下列為一計算平方根的函式,程式看起來沒問題,但卻無法通過編譯(compile), 請問為什麼? (10%)
5. 請利用 call-by-reference 撰寫一個 void function 以用來交換兩個整數變數內容,
假設函式名為 swap,傳入值名稱分別為 first 以及 second。(10%) //returns one of the roots of the quadratic equation
//a*x*x + b*x + c = 0 a!= 0
double root1 (double a, double b, double c) { return (-b + sqrt(b*b-4*a*c))/(2*a);