115 年 國立臺灣大學資訊管理學系碩士班《資訊科技概論》
第 1 題2 分
Which of the following data structures provides O(1) average-time complexity for insertion, deletion, and search?
(A) Binary search tree
(B) Balanced binary search tree
(C) Hash table
(D) Sorted array
(E) Heap.
登入後即可作答並保存紀錄。
這題考查資料結構的平均時間複雜度。
平均時間複雜度為 O(1) 表示插入、刪除和搜尋操作的平均執行時間是常數時間。
- (A) 二元搜尋樹 (Binary Search Tree, BST):平均搜尋時間為 O(log n),最差為 O(n)。插入和刪除也類似。
- (B) 平衡二元搜尋樹 (Balanced Binary Search Tree, 如 AVL 樹, Red-Black 樹):搜尋、插入、刪除的平均和最差時間複雜度都是 O(log n)。
第 2 題2 分
Which of the following best describes the worst-case time complexity of QuickSort?
(A) O(n)
(B) O(n log n)
(C) O(log n)
(D) O(n²)
(E) O(n³)
登入後即可作答並保存紀錄。
這題考查 QuickSort 的最差情況時間複雜度。
QuickSort 是一種分治演算法,其效能高度依賴於 pivot (基準點) 的選擇。
- 平均情況:如果 pivot 選擇良好(例如,每次都能將陣列分成大致相等的兩半),則時間複雜度為 O(n log n)。
第 3 題2 分
What is the time complexity of inserting an element into a binary heap?
(A) O(1)
(B) O(n)
(C) O(log n)
(D) O(n log n)
(E) O(n²)
登入後即可作答並保存紀錄。
這題考查二元堆積 (Binary Heap) 的插入操作時間複雜度。
二元堆積是一種完全二元樹,通常用陣列來實現。堆積的性質(最大堆積或最小堆積)保證了父節點與子節點之間的關係。
插入一個新元素到二元堆積的步驟如下:
- 將新元素添加到陣列的末尾,這相當於將其放在樹的最後一層的最右邊位置。這個操作是 O(1)。
- 然後,將新元素與其父節點進行比較。
第 4 題2 分
Which data structure is most appropriate for checking if an expression has balanced parentheses (e.g., ((a+b)*c) )?
(A) Queue
(B) Stack
(C) Binary Search Tree
(D) Hash Table
(E) Graph.
登入後即可作答並保存紀錄。
這題考查哪種資料結構適合檢查括號是否平衡。
檢查表達式中括號是否平衡的典型方法是使用堆疊 (Stack)。其原理如下:
- 當掃描到一個開括號(如 '(', '[', '{')時,將其壓入堆疊。
- 當掃描到一個閉括號(如 ')', ']', '}')時:
- 檢查堆疊是否為空。如果堆疊為空,表示沒有對應的開括號,則括號不平衡。
- 如果堆疊不為空,則彈出堆疊頂端的元素,並檢查彈出的開括號是否與當前的閉括號是匹配的一對(例如,'(' 匹配 ')', '[' 匹配 ']')。如果它們不匹配,則括號不平衡。
第 5 題2 分
Which of the following sorting algorithms is not stable? (Meaning relative order of equal elements is not guaranteed to be preserved).
(A) Insertion Sort
(B) Merge Sort
(C) Bubble Sort
(D) QuickSort
(E) none of the above.
登入後即可作答並保存紀錄。
這題考查哪些排序演算法是「不穩定」(unstable) 的。穩定排序演算法是指,對於兩個數值相等的元素,它們在排序前的相對順序,在排序後也會保持不變。
- (A) 插入排序 (Insertion Sort):穩定。它將元素逐個插入到已排序的部分,相同元素插入時會保持原來的相對位置。
- (B) 合併排序 (Merge Sort):穩定。合併過程中,如果兩個子陣列中出現相同鍵值的元素,總是先取左邊子陣列的元素,從而保持了穩定性。
- (C) 氣泡排序 (Bubble Sort):穩定。
第 6 題2 分
What is the prerequisite for performing a Topological Sort on a graph?
(A) The graph must be undirected.
(B) The graph must be a tree.
(C) The graph must be a Directed Acyclic Graph (DAG).
(D) The graph must be fully connected.
(E) The graph must have non-negative edge weights.
登入後即可作答並保存紀錄。
這題考查進行拓撲排序 (Topological Sort) 的前提條件。
拓撲排序是對有向無環圖 (Directed Acyclic Graph, DAG) 的頂點進行的線性排序,使得對於圖中的每一條有向邊 ,頂點 在排序中都出現在頂點 之前。
- (A) 無向圖 (Undirected graph):拓撲排序定義在有向圖上,無向圖無法進行拓撲排序。
- (B) 樹 (Tree):樹是一種特殊的圖,但通常是無向的,或者是有根的指向特定方向。即使是有向樹,也必須是無環的。
第 7 題2 分
Which of the following best describes the role of a cache memory in a computer system?
(A) To permanently store program instructions
(B) To reduce average memory access time
(C) To manage virtual memory
(D) To schedule CPU processes
(E) To translate virtual addresses to physical addresses
登入後即可作答並保存紀錄。
這題考查快取記憶體 (Cache Memory) 在電腦系統中的作用。
快取記憶體是一種容量較小但速度極快的記憶體,位於 CPU 和主記憶體 (RAM) 之間。它的主要目的是利用程式執行的局部性原理(時間局部性和空間局部性)來儲存最近或最常使用的數據和指令,從而減少 CPU 訪問主記憶體的次數,進而降低平均記憶體存取時間。
- (A) 永久儲存程式指令:這是輔助儲存裝置(如硬碟)或 ROM 的功能,快取記憶體不是永久儲存的。
- (B) 降低平均記憶體存取時間:這是快取記憶體的核心功能。當 CPU 需要數據時,它首先檢查快取。
第 8 題2 分
Which of the following CPU scheduling algorithms may cause starvation?
(A) Round Robin
(B) First-Come, First-Served
(C) Multilevel feedback queue (with aging)
(D) Priority scheduling without aging
(E) Shortest remaining time first.
登入後即可作答並保存紀錄。
核心觀念
**飢餓(starvation)**是指某個行程長時間等待 CPU,且因排程規則持續偏好其他行程,導致它無限期無法獲得 CPU。判斷重點是:是否存在一種持續到達或持續就緒的行程,能讓某個行程一直被擠在後面。
解題方法
逐一檢查各演算法是否會讓某些行程無限期等待:
- 非搶先且依序服務的排程,行程通常會按順序輪到。
- 依優先權或剩餘執行時間選擇行程的排程,若偏好的行程持續出現,其他行程就可能一直等不到 CPU。
- **老化(aging)**會隨等待時間提高行程優先權,用來避免行程永遠被忽略。
選項分析
(A) Round Robin:錯。
輪轉排程讓就緒佇列中的行程依序取得固定時間片。只要行程持續留在就緒佇列中,就會輪到它執行,因此不會因排程政策而無限期等待。
(B) First-Come, First-Served:錯。
先到先服務依行程進入就緒佇列的順序執行。即使前方行程執行時間較長,後方行程仍會在前方行程完成後依序取得 CPU;
第 9 題2 分
Which of the following best describes a context switch?
(A) Switching between CPU cores
(B) Changing page tables
(C) Reloading cache blocks
(D) Switching from kernel mode to user mode
(E) Saving and restoring process execution state
登入後即可作答並保存紀錄。
這題考查「上下文切換」(Context Switch) 的含義。
上下文切換是指作業系統在 CPU 上從執行一個進程(或執行緒)切換到另一個進程(或執行緒)的過程。這個過程涉及到儲存當前進程的執行狀態(CPU 暫存器值、程式計數器、記憶體狀態等),然後載入下一個要執行的進程的執行狀態。
- (A) 在 CPU 核心之間切換:這可能發生在多核心處理器上,但上下文切換的核心概念不是核心本身,而是進程的狀態。
- (B) 更改頁表:這是記憶體管理的一部分,與虛擬記憶體有關,是上下文切換的一部分,但不等於上下文切換本身。
第 10 題2 分
In a pipelined processor, which situation most directly leads to a pipeline stall?
(A) Instruction prefetching
(B) Data hazard due to operand dependency
(C) Branch prediction hit
(D) Cache hit
(E) Register renaming
登入後即可作答並保存紀錄。
核心觀念
管線處理器把指令執行分成多個階段,讓多條指令能同時處於不同階段。若後續指令需要的資料尚未就緒,處理器便須暫停部分管線階段,插入空氣泡(bubble);這種等待稱為管線停滯(pipeline stall)。
資料危障(data hazard)常由指令間的運算元相依造成。例如,前一條指令尚未產生結果,後一條指令就要讀取該結果。若轉送(forwarding)等機制無法及時提供資料,後一條指令便須等待。
解題方法
判斷各選項是否會讓管線中的指令「無法在預定時點繼續執行」。只要有指令因相依資料尚未可用而必須等待,就是最直接造成管線停滯的情況。
選項分析
- (A) Instruction prefetching(指令預取):預先取得後續指令,通常是為了讓指令管線有充足供應,本身不會直接造成停滯。
第 11 題2 分
Which CPU scheduling algorithm has the smallest average waiting time for a given set of processes?
(A) First-Come, First-Served (FCFS)
(B) Shortest Job First (SJF)
(C) Round Robin (RR)
(D) Multilevel Queue
(E) Priority Scheduling.
登入後即可作答並保存紀錄。
核心觀念
本題考「平均等待時間最小化」。等待時間是行程在就緒佇列中等待 CPU 的時間;若所有行程同時就緒、忽略切換成本,行程 的等待時間為:
平均等待時間為:
在 CPU 執行時間已知的前提下,最短工作優先(Shortest Job First, SJF)能使平均等待時間最小。
解題方法
將行程依 CPU 執行時間由短至長排列。若相鄰兩個行程的執行時間分別為 、,且 ,原順序為「較長的 在前、較短的 在後」,設它們開始前已有等待時間 ,兩者等待時間總和為:
交換順序後,等待時間總和為:
第 12 題2 分
What is the phenomenon called "Thrashing" in a virtual memory system?
(A) The system spends more time paging (swapping pages in and out) than executing processes.
(B) The hard disk fails due to excessive read/write operations.
(C) A process enters an infinite loop.
(D) Multiple processes are deadlocked waiting for resources.
(E) The CPU pipeline is constantly flushed due to branch mispredictions.
登入後即可作答並保存紀錄。
這題考查虛擬記憶體系統中的「換頁風暴」(Thrashing) 現象。
換頁風暴是指系統花費了大量的時間在頁面交換(從主記憶體將頁面換出到輔助儲存,再從輔助儲存將需要的頁面換入主記憶體)上,而不是真正執行進程的計算任務。這種情況通常發生在系統的總記憶體需求(所有進程的活躍頁面)超過了物理記憶體容量時,導致系統頻繁地進行頁面交換,CPU 利用率反而下降,系統效能急劇惡化。
第 13 題2 分
What is the primary function of the Time to Live (TTL) field in an IPv4 header?
(A) To determine the timestamp of when the packet was created.
(B) To prioritize the packet for Quality of Service (QoS).
(C) To ensure the packet is reassembled in the correct order.
(D) To prevent packets from circulating indefinitely in a routing loop.
(E) none of the above.
登入後即可作答並保存紀錄。
這題考查 IPv4 標頭中的「存活時間」(Time to Live, TTL) 欄位的主要功能。
TTL 欄位是一個 8 位元的欄位,用於限制 IP 資料包在網路中傳播的「壽命」。每當資料包經過一個路由器時,TTL 值就會減 1。當 TTL 值減到 0 時,路由器就會丟棄該資料包,並通常會向源主機發送一個 ICMP 訊息(TTL Exceeded)。
TTL 的主要目的是防止 IP 資料包在網路中無限期地循環傳播,例如由於路由配置錯誤而導致的路由迴圈。
第 14 題2 分
Which of the following is a characteristic of UDP (User Datagram Protocol) compared to TCP?
(A) It guarantees delivery of data.
(B) It provides flow control and congestion control mechanisms.
(C) It is connectionless and has a smaller header overhead.
(D) It sequences packets to ensure they arrive in order.
(E) It performs a three-way handshake before sending data.
登入後即可作答並保存紀錄。
這題考查 UDP (User Datagram Protocol) 相較於 TCP (Transmission Control Protocol) 的特性。
UDP 和 TCP 是 TCP/IP 協定堆疊中傳輸層的兩種主要協定。
- (A) 保證資料傳輸:這是 TCP 的特性(可靠傳輸),UDP 不保證。
- (B) 提供流量控制和擁塞控制:這是 TCP 的特性,UDP 不提供。
第 15 題2 分
In TCP congestion control, what is the main purpose of the slow start phase?
(A) To avoid retransmissions entirely
(B) To probe available network capacity exponentially
(C) To maintain a constant congestion window
(D) To prioritize latency-sensitive flows
(E) To prevent receiver buffer overflow.
登入後即可作答並保存紀錄。
核心觀念
本題考查 TCP 壅塞控制中的 慢啟動(slow start)。連線初期,傳送端尚未掌握網路可承受的流量,因此以壅塞視窗(congestion window,)控制未確認資料量,並逐步增加傳送速率。
慢啟動時,每收到一個確認封包(ACK), 大約增加一個最大區段長度(MSS)。若一個往返時間(RTT)內收到約 個 ACK,則一個 RTT 後的視窗約為原來的兩倍:
因此, 初期呈指數成長,傳送端藉此快速探測網路可用容量。達到慢啟動門檻(slow start threshold,)後,通常改採較緩和的壅塞避免(congestion avoidance)成長方式。
解題方法
抓住慢啟動的關鍵特徵:起始階段以指數方式增加壅塞視窗,快速探測可用的網路容量。選項中與此目的相符的是「以指數方式探測可用網路容量」。
選項分析
第 16 題2 分
Which index structure is most used in relational databases to support range queries efficiently?
(A) Hash index
(B) Bitmap index
(C) B+ tree
(D) Inverted index
(E) Heap file.
登入後即可作答並保存紀錄。
這題考查在關聯式資料庫中,哪種索引結構最適合高效地支援範圍查詢 (Range Queries)。
範圍查詢是指查詢滿足某個範圍條件的記錄,例如 WHERE age BETWEEN 20 AND 30 或 WHERE name > 'M'。
- (A) 雜湊索引 (Hash Index):雜湊索引將鍵值映射到儲存位置,非常適合等值查詢 (
WHERE id = 123),但對於範圍查詢效率很差,因為雜湊函數無法保持鍵值的順序。 - (B) 位圖索引 (Bitmap Index):通常用於低基數(distinct 值較少)的欄位,能夠非常高效地處理複雜的布林邏輯查詢。對於範圍查詢,其效率取決於實現方式,但通常不如 B+ tree。
第 17 題2 分
Which of the following concurrency control techniques may result in deadlocks?
(A) Timestamp ordering
(B) Two-phase locking (2PL)
(C) Optimistic concurrency control
(D) Multiversion concurrency control (MVCC)
(E) Snapshot isolation.
登入後即可作答並保存紀錄。
核心觀念
本題考「併發控制技術是否會讓交易彼此等待」,以及等待是否可能形成死結。若交易 等待 釋放資源,而 又等待 釋放資源,就形成循環等待;在等待圖中,循環代表可能發生死結。
解題方法
判斷各技術如何處理衝突:
- 等待取得鎖:交易可能互相等待,若等待形成循環,就會死結。
- 排序或驗證後中止交易:衝突時以拒絕、回滾或重啟處理,不必讓交易持續等待,因此不會由該控制機制造成死結。
選項分析
-
(A) Timestamp ordering(時間戳記排序):錯。交易依時間戳記順序執行;若操作違反順序,系統會中止交易,而非讓它等待另一交易釋放鎖。此機制本身不會造成死結。
-
(B) Two-phase locking(兩階段鎖定,2PL):對。交易取得鎖後,在鎖定階段可能繼續持有鎖並等待其他鎖。例如 持有資料項 、等待 ; 持有 、等待 。兩者互相等待,形成循環,因此可能發生死結。
第 18 題2 分
Which of the following best explains why hash-based indexing is generally unsuitable for range queries?
(A) Hash functions destroy ordering information
(B) Hash indexes require more storage
(C) Hash collisions slow down inserts
(D) Hash indexes cannot support equality queries
(E) Hashing increases I/O operations.
登入後即可作答並保存紀錄。
這題考查為什麼基於雜湊的索引 (Hash-based indexing) 通常不適合範圍查詢 (range queries)。
雜湊索引的核心是雜湊函數,它將一個鍵值映射到一個儲存桶 (bucket) 或位置。雜湊函數的目的是盡可能均勻地分佈鍵值,以實現快速的等值查詢。
- (A) 雜湊函數破壞了順序資訊 (Hash functions destroy ordering information):這是最主要的原因。雜湊函數的輸出值與輸入鍵值的順序沒有直接關係。例如,鍵值 100 的雜湊值可能比鍵值 50 的雜湊值小,也可能大。這意味著,如果我們想要查詢鍵值在 50 到 100 之間的記錄,我們無法僅僅根據雜湊值來判斷哪些記錄可能在此範圍內。
第 19 題2 分
In write-ahead logging (WAL), which rule must be satisfied to ensure database recovery correctness?
(A) Data pages must be written before log records
(B) Log records are optional for read-only transactions
(C) Checkpoints eliminate the need for redo
(D) Log records must be written to stable storage before data pages
(E) Logs are only needed for undo operations.
登入後即可作答並保存紀錄。
這題考查寫入預寫日誌 (Write-Ahead Logging, WAL) 的核心規則,以確保資料庫恢復的正確性。
WAL 是一種確保資料庫事務原子性 (Atomicity) 和持久性 (Durability) 的日誌記錄機制。其核心原則是:任何對數據的修改,其日誌記錄必須先寫入穩定儲存(如硬碟),然後才能將修改後的數據頁寫入磁碟。
- (A) 資料頁必須在日誌記錄之前寫入:這違反了 WAL 的原則。如果資料頁先寫入,而日誌記錄尚未寫入,系統崩潰時,資料庫狀態將是不一致的,且無法從日誌中恢復。
- (B) 唯讀事務的日誌記錄是可選的:即使是唯讀事務,如果在執行過程中發生了某些操作(例如,鎖定資源,或在某些 MVCC 系統中需要記錄版本信息),也可能需要日誌記錄。更重要的是,WAL 的原則是關於修改操作的日誌,唯讀事務本身不修改數據,因此不需要 WAL 進行恢復。
第 20 題2 分
Which statement best captures a fundamental trade-off in database system design?
(A) Strong consistency always improves performance
(B) Indexing eliminates the need for query optimization
(C) Higher isolation levels can reduce concurrency
(D) Normalization always improves query speed
(E) Replication removes the need for recovery mechanisms.
登入後即可作答並保存紀錄。
這題考查資料庫系統設計中的基本權衡 (trade-off)。
- (A) 強一致性總是提升效能:這是不正確的。強一致性通常會增加系統的複雜性、延遲和通訊開銷,尤其是在分布式系統中,它往往會犧牲效能和可用性。CAP 定理就是一個著名的例子。
- (B) 索引消除了對查詢優化的需求:這是不正確的。索引可以顯著提高查詢速度,但查詢優化器仍然需要考慮如何最佳地使用索引(例如,選擇哪個索引,如何結合多個索引,如何掃描索引等),以及在沒有合適索引時如何執行查詢。
- (C) 更高的隔離級別可以降低並發性:這是正確的。在 ACID 屬性中,隔離性 (Isolation) 描述了事務之間如何相互影響。
第 21 題2 分
In the context of Distributed Database Systems, the CAP Theorem states that a distributed system can only simultaneously provide two out of which three guarantees?
(A) Concurrency, Availability, Performance
(B) Consistency, Atomicity, Partition Tolerance
(C) Consistency, Authenticity, Persistence
(D) Consistency, Availability, Partition Tolerance
(E) Concurrency, Accuracy, Performance.
登入後即可作答並保存紀錄。
這題考查分布式資料庫系統中的 CAP 定理。
CAP 定理(也稱為 Brewer 定理)指出,對於一個分布式資料系統,在面對網路分割 (Network Partition) 時,只能同時滿足以下三個特性中的最多兩個:
- 一致性 (Consistency):所有節點在同一時間看到相同數據。
- 可用性 (Availability):每個請求都能在有限的時間內得到響應(但可能不是最新的數據)。
- 分區容錯性 (Partition Tolerance):系統能夠在網路分割(節點之間的通訊中斷)的情況下繼續運行。
在分布式系統中,網路分割是不可避免的,因此分區容錯性 (P) 通常被認為是必須滿足的。這意味著,在發生網路分割時,系統必須在一致性 (C) 和可用性 (A) 之間做出選擇:
第 22 題2 分
A relation R is in Boyce-Codd Normal Form (BCNF) if and only if:
(A) For every functional dependency X→Y, X is a superkey.
(B) It is in 3NF and has no multivalued dependencies.
(C) It is in 3NF and preserves all functional dependencies.
(D) It contains atomic values only.
(E) There are no partial dependencies.
登入後即可作答並保存紀錄。
核心觀念
本題考查資料庫正規化中的 Boyce-Codd Normal Form(BCNF,Boyce-Codd 正規形)定義。
關聯綱要 符合 BCNF,當且僅當對於 上每一個非平凡功能相依:
決定項 都必須是超鍵(superkey)。
其中:
- 功能相依 :若兩筆資料在 上的值相同,則在 上的值也必須相同。
- 超鍵:能唯一識別關聯中每一筆資料的屬性集合。
- 非平凡功能相依:,也就是右側屬性並非已包含在左側屬性中。
BCNF 的判斷公式可寫為:
此處通常省略「非平凡」三字,選項 (A) 即採用此標準簡寫。
解題方法
判斷正規形定義題時,應直接比對各選項是否符合 BCNF 的正式定義。
BCNF 的關鍵不是:
- 是否只有原子值;
- 是否消除部分相依;
- 是否保留所有功能相依;
- 是否處理多值相依。
BCNF 的唯一核心要求是:
每一個非平凡功能相依的決定項,都必須是超鍵。
因此,選項 (A) 與 BCNF 定義相符。
選項分析
(A) For every functional dependency X→Y, X is a superkey.
正確。
BCNF 要求對於每一個非平凡功能相依 , 必須是超鍵。選項雖未明確寫出「非平凡」,但這是教科書中對 BCNF 定義的標準簡寫,因此為正確答案。
(B) It is in 3NF and has no multivalued dependencies.
錯誤。
第 23 題2 分
Which of the following is a key advantage of containerization (e.g., Docker) compared to virtual machines?
(A) Lower overhead due to sharing the host OS kernel
(B) Stronger hardware-level isolation
(C) No dependency on the host operating system
(D) Elimination of resource contention
(E) Guaranteed real-time performance.
登入後即可作答並保存紀錄。
這題考查容器化 (Containerization, 例如 Docker) 相較於虛擬機 (Virtual Machine, VM) 的一個關鍵優勢。
容器化技術和虛擬機都是用來隔離應用程式及其依賴的技術,但它們的實現方式不同。
- 虛擬機 (VM):在硬體層模擬一個完整的電腦系統,包括虛擬的 CPU、記憶體、網路介面卡等,並在其上安裝一個完整的作業系統 (Guest OS)。每個 VM 都有自己的 OS 核心。
- 容器化 (Containerization):在主機作業系統 (Host OS) 上運行,並共享主機 OS 的核心。每個容器運行在自己的隔離使用者空間中,但共享底層的 OS 核心。
基於這個區別,我們可以分析選項:
第 24 題2 分
Which of the following best describes the role of edge computing?
(A) Centralizing all computation in large data centers
(B) Replacing cloud computing entirely
(C) Increasing storage capacity
(D) Processing data closer to data sources to reduce latency
(E) Encrypting data before transmission.
登入後即可作答並保存紀錄。
這題考查邊緣運算 (Edge Computing) 的作用。
邊緣運算是一種分散式運算模型,它將運算和數據儲存移近數據的來源地或使用者端,而不是將所有數據都發送到遠端的數據中心或雲端進行處理。
- (A) 將所有計算集中在大數據中心:這是傳統的雲端運算模式,與邊緣運算相反。
- (B) 完全取代雲端運算:邊緣運算通常是補充或擴展雲端運算,而不是完全取代它。許多邊緣設備的數據最終仍可能被匯總到雲端進行更深入的分析。
第 25 題2 分
Which technology enables immutable and verifiable transaction records without relying on a central authority?
(A) Distributed databases
(B) Blockchain
(C) Content delivery networks
(D) Peer-to-peer file sharing
(E) Federated learning.
登入後即可作答並保存紀錄。
這題考查哪種技術能夠實現不可變且可驗證的交易記錄,且無需依賴中心權威。
- (A) 分散式資料庫 (Distributed Databases):雖然分散式資料庫將數據分散儲存在多個節點上,提高了可用性和可擴展性,但它們通常仍然需要中心化的管理或共識機制來確保數據的一致性,並且記錄不一定是不可變的。
- (B) 區塊鏈 (Blockchain):區塊鏈是一種分散式的、分佈式的帳本技術,交易記錄被打包成區塊,並按時間順序鏈接起來。每個區塊都包含前一個區塊的雜湊值,這使得記錄具有不可變性。
第 26 題2 分
Why are NoSQL databases often preferred in large-scale distributed applications?
(A) They provide flexible schemas and horizontal scalability
(B) They strictly enforce ACID properties
(C) They eliminate network partitions
(D) They guarantee strong consistency
(E) They require less storage than relational databases.
登入後即可作答並保存紀錄。
核心觀念
本題考查 NoSQL 資料庫在大型分散式應用中的常見優勢。NoSQL 泛指非關聯式資料庫,常見類型包括文件型、鍵值型、寬欄型與圖形資料庫。
相較於固定資料表結構的關聯式資料庫,許多 NoSQL 資料庫允許資料結構較有彈性,適合欄位常變動或資料型態多樣的應用;也常透過增加多台伺服器分擔資料與請求,達成水平擴充。
解題方法
從「大型分散式應用需要什麼」切入:通常需要容納多樣資料,並能在資料量或流量增加時,透過增加伺服器擴充容量與處理能力。因此,符合這兩項需求的選項是正確答案。
再檢查其餘選項是否把特定資料庫的特性說成所有 NoSQL 的保證,或聲稱能解決分散式系統無法消除的限制。
選項分析
- (A) 正確。 NoSQL 常提供較彈性的資料結構,並支援水平擴充,能因應大型分散式應用的資料與流量需求。
- (B) 錯誤。 NoSQL 不以嚴格遵守 ACID 為共同特色。
第 27 題2 分
In the context of Large Language Models (LLMs) like GPT, what is the primary function of the "Self-Attention" mechanism in the Transformer architecture?
(A) To compress the input data into a smaller vector.
(B) To allow the model to weigh the importance of different words in a sequence relative to each other, regardless of their distance.
(C) To generate random variations of the output to increase creativity.
(D) To convert text into speech.
(E) To store long-term memory of previous conversations on a hard drive.
登入後即可作答並保存紀錄。
這題考查 Transformer 架構中「自注意力」(Self-Attention) 機制的關鍵功能。
Transformer 模型是現代大型語言模型 (LLM) 的基礎架構,而自注意力機制是其核心組成部分。
- (A) 將輸入數據壓縮成更小的向量:這是編碼器 (Encoder) 或某些其他網路結構(如 Autoencoder)的功能,例如使用固定大小的向量來表示整個輸入序列。自注意力機制本身並不是為了壓縮,而是為了計算序列內部的關係。
- (B) 讓模型權衡序列中不同詞語相對彼此的重要性,無論它們的距離遠近:這是自注意力機制的精確描述。
第 28 題2 分
What is the core principle of the "Zero Trust" security architecture?
(A) "Never trust, always verify" - no user or device is trusted by default, even if inside the corporate network.
(B) All internal traffic is trusted, but external traffic is blocked.
(C) Using only biometric authentication for all access.
(D) Isolating the network from the internet completely.
(E) Relying solely on firewalls to protect the network perimeter.
登入後即可作答並保存紀錄。
這題考查「零信任」(Zero Trust) 安全架構的核心原則。
傳統的安全模型通常是「信任內部,懷疑外部」(trust but verify),即一旦使用者或設備通過了邊界驗證(例如,進入了公司內部網路),就被認為是受信任的。而零信任模型則完全顛覆了這個概念。
- (A) 「永不信任,始終驗證」- 預設情況下,沒有使用者或設備是受信任的,即使它們位於公司內部網路。這是零信任的核心理念。零信任假定網路內部和外部都可能存在威脅,因此必須對所有訪問請求進行嚴格的驗證和授權,無論其來源如何。
- (B) 所有內部流量都被信任,但外部流量被阻止:這描述的是傳統的「圍牆花園」(walled garden) 安全模型,與零信任相反。
第 29 題2 分
What is the defining characteristic of "Serverless Computing" (e.g., AWS Lambda)?
(A) There are physically no servers involved in the process.
(B) The developer must manually patch and manage the operating system of the server.
(C) The cloud provider dynamically manages the allocation of machine resources, and pricing is based on the actual amount of resources consumed by an application execution, not pre-purchased capacity.
(D) It is a peer-to-peer network where every client is also a server.
(E) Use commodity-grade PCs to replace high-cost servers.
登入後即可作答並保存紀錄。
這題考查「無伺服器運算」(Serverless Computing),例如 AWS Lambda 的定義性特徵。
「無伺服器」這個詞可能會引起誤解,實際上伺服器仍然存在,只是開發者無需關心底層的伺服器管理。
- (A) 過程中沒有物理伺服器:這是錯誤的。伺服器是存在的,只是由雲端供應商管理。
- (B) 開發者必須手動修補和管理伺服器的作業系統:這是傳統的伺服器管理模式,與無伺服器運算的理念完全相反。在無伺服器架構中,伺服器管理、OS 修補等都由雲端供應商負責。
第 30 題2 分
In the field of Generative AI, what does "RAG" (Retrieval-Augmented Generation) refer to?
(A) A method to generate random answers to prevent overfitting.
(B) A technique to reduce the model size by removing unused neurons.
(C) A training process that relies solely on reinforcement learning from human feedback.
(D) A technique that optimizes the output of an LLM by referencing an authoritative knowledge base outside its training data before generating a response.
(E) An AI agent learns to make decisions by interacting with an environment, taking actions, and receiving rewards or penalties.
登入後即可作答並保存紀錄。
核心觀念
本題考查生成式人工智慧中的檢索增強生成(Retrieval-Augmented Generation,RAG)。RAG 結合「檢索」與「生成」:大型語言模型(LLM)回答問題前,先從外部知識庫找出相關資料,再將資料提供給模型作為生成回覆的依據。
典型流程為:
外部知識庫可包含文件、資料庫或經索引的網頁內容。RAG 能讓回答參考模型訓練資料以外的資訊,並有助於提供較新或較具領域性的內容;回答品質仍取決於檢索資料是否相關、正確,以及模型是否妥善運用資料。
解題方法
判斷關鍵在於辨認 RAG 的兩個步驟:
- Retrieval(檢索):從外部知識來源找出與問題相關的內容。
第 二、1.(a) 題10 分
The following shows an array-based implementation of ADT Stack that stores non-duplicated integers. NOTE: The Stack class has NO member function of data swapping!! All item switching or swapping operations must be implemented by yourself!!
const int MAXSIZE = 20; // the maximal stack size
class Stack
{
public:
// insert an integer into the stack
int push(int data);
// reverse the order of the integers in the stack
void reverse();
// rank the integers in the stack in ascending order
void rank();
private:
int items [MAXSIZE]; // the array of the stacked integers
int top; // the index of the top item, the initial is -1
};
(a) (10 points) Write the Stack:: push () function that inserts an integer into the stack. Note that the function returns -1 if either the stack is full or the input integer has already existed in the stack; otherwise, it returns 0.
登入後即可作答並保存紀錄。
核心觀念
本題考查陣列實作 Stack 的 push() 操作,以及:
top表示堆疊頂端元素的索引。- 初始為
top = -1,表示堆疊為空。 - 堆疊容量為
MAXSIZE = 20。 - 堆疊已滿的條件為:
- 插入新元素前,必須確認該整數尚未存在於目前堆疊中。
- Stack 採取後進先出(LIFO),新元素應放在目前頂端的下一個位置。
解題方法
push() 的處理順序如下:
- 判斷堆疊是否已滿。若已滿,回傳
-1。 - 從索引
0掃描至top,檢查輸入值是否已存在。 - 若發現重複值,回傳
-1。 - 將
top增加 1。 - 將輸入值放入
items[top]。 - 成功插入後回傳
0。
參考程式碼
int Stack::push(int data)
{
// 堆疊已滿
if (top == MAXSIZE - 1)
return -1;
// 檢查輸入整數是否已存在
for (int i = 0; i <= top; i++)
{
if (items[i] == data)
return -1;
}
// 將新資料放在堆疊頂端
top++;
items[top] = data;
return 0;
}
若初始狀態為:
top = -1;
第 二、1.(b) 題10 分
The following shows an array-based implementation of ADT Stack that stores non-duplicated integers. NOTE: The Stack class has NO member function of data swapping!! All item switching or swapping operations must be implemented by yourself!!
const int MAXSIZE = 20; // the maximal stack size
class Stack
{
public:
// insert an integer into the stack
int push(int data);
// reverse the order of the integers in the stack
void reverse();
// rank the integers in the stack in ascending order
void rank();
private:
int items [MAXSIZE]; // the array of the stacked integers
int top; // the index of the top item, the initial is -1
};
(b) (10 points) Write the Stack:: reverse() function that reverses the sequence of the stacked integers.
登入後即可作答並保存紀錄。
核心觀念
本題考查抽象資料型態堆疊(ADT Stack)之陣列實作與**陣列元素反轉(Array In-place Reversal)**演算法:
- 內部狀態與邊界:
- 題目以一維陣列
items[MAXSIZE]儲存堆疊資料,私有變數top代表目前最頂端元素的索引值(初始為 )。 - 當 時,堆疊內為空()或僅有 個元素(),順序反轉後結構維持不變,無需執行對調。
- 題目以一維陣列
- 類別成員函式之存取權限:
Stack::reverse()屬於Stack類別的成員函式,具備直接存取私有成員(private members)items與top的權限。
- 原地交換(In-place Swapping):
- 題目明確限制:「類別中沒有提供資料交換的成員函式,所有交換操作必須自行實作」。
- 陣列反轉最有效率的解法為雙指標法(Two-pointer Approach):設定左指標 、右指標 ,當 時,自行宣告暫存變數
temp進行數值交換(swap),隨後 遞增、 遞減,直至兩指標相遇或交錯。
解題方法
採用雙指標對稱交換法:
- 處理邊界情況:先檢查 ,若成立則直接
return。 - 雙端對調:
- 堆疊中有效資料範圍為
items[0]至items[top]。 - 使用整數索引變數 從底端 開始往上移動,變數 從頂端 開始往下移動。
- 迴圈終止條件設為 。
- 每次迴圈內部利用暫存變數
temp達成三步驟交換:
- 堆疊中有效資料範圍為
- 維護內部指標:反轉後堆疊內元素的總個數未變,頂端元素指標
top數值維持不變。
關鍵程式碼實作
第 二、1.(c) 題20 分
The following shows an array-based implementation of ADT Stack that stores non-duplicated integers. NOTE: The Stack class has NO member function of data swapping!! All item switching or swapping operations must be implemented by yourself!!
const int MAXSIZE = 20; // the maximal stack size
class Stack
{
public:
// insert an integer into the stack
int push(int data);
// reverse the order of the integers in the stack
void reverse();
// rank the integers in the stack in ascending order
void rank();
private:
int items [MAXSIZE]; // the array of the stacked integers
int top; // the index of the top item, the initial is -1
};
(c) (20 points) Write the Stack:: rank () function that ranks the stacked integers in ascending order. In other words, the top is the smallest integer. You MUST employ the bubble sort algorithm to rank the data!!
登入後即可作答並保存紀錄。
核心觀念
本題考查三個重點:
-
Stack 的儲存方向
items[0]是堆疊底部,items[top]是堆疊頂端。因此,若要使「top 是最小值」,陣列必須由底部到頂端呈現遞減排列: -
Bubble Sort
題目指定必須使用泡沫排序法。泡沫排序會反覆比較相鄰元素,若順序不符就交換。
-
自行交換資料
Stack沒有提供資料交換函式,因此必須使用暫存變數完成交換:int temp = items[j]; items[j] = items[j + 1]; items[j + 1] = temp;
解題方法
設堆疊共有 個元素。
由於陣列索引愈大代表位置愈接近 stack top,而題目要求 top 為最小值,因此陣列必須由左至右遞減排列。
所以 Bubble Sort 的比較條件應為:
if (items[j] < items[j + 1])
當左側元素小於右側元素時,交換兩者,使較大的元素往左移動。經過多輪比較後,陣列會排列成遞減順序,最小值自然位於 items[top]。