AQA A Level · Computer Science 7517

堆疊:練習題

5 條多項選擇題即時批改,另有 5 條文字題附完整解題步驟,全部圍繞「堆疊」。

10 條題目25 免費,無需登記
第 1 題
1

A programmer is choosing how to implement a Stack ADT. They decide to use a dynamic data structure rather than a static one. Which of the following is a potential disadvantage of using a dynamic data structure in this context?

第 2 題
1

Consider a stack implemented using a static array of size 5. Currently, the stack pointer points to index 4 (the last valid index). If a push operation is attempted, what condition is triggered?

第 3 題
1

When a subroutine is called, a stack frame is created. According to the AQA specification, what are the three primary types of data stored within this stack frame?

第 4 題
1

Which stack operation returns the value of the top element without removing it from the data structure?

第 5 題
1

A programmer needs to evaluate the expression \(12 + (3 \times 4)\) using a Stack. They first convert it to Reverse Polish Notation (RPN). What is the sequence of push and pop operations required to evaluate the resulting RPN: 12 3 4 * +?

第 6 題
2

A stack is used to reverse the order of characters in a string. If the string "AQA" is pushed onto the stack character by character from left to right, what will be the result of three consecutive pop operations?

先自己寫一次答案,再對照解題步驟。

第 7 題
3

During a Depth-First Search (DFS) on a graph, a stack is used to keep track of vertices. If the algorithm visits a vertex that has no unvisited neighbors, what specific stack operation is performed to continue the search?

先自己寫一次答案,再對照解題步驟。

第 8 題
5

When implementing a stack frame in memory for a recursive subroutine call, name three specific items that are stored on the stack to manage the execution state.

先自己寫一次答案,再對照解題步驟。

第 9 題
4

A stack is an Abstract Data Type (ADT) that follows the LIFO principle.

(a) Describe the difference between the push and pop operations.
(b) What is the purpose of a peek (or top) operation?
(c) Explain the condition known as stack overflow and when it occurs.

先自己寫一次答案,再對照解題步驟。

第 10 題
6

An expression tree is a specific type of binary tree. For the algebraic expression: \( (5 + 3) \times (8 - 2) \):

a. Determine the result of a Post-order traversal of the corresponding expression tree. (2 points)
b. Explain how a Stack is used to evaluate the resulting Reverse Polish Notation (RPN) from part a. (3 points)
c. Why does RPN eliminate the need for parentheses in complex calculations? (1 point)

先自己寫一次答案,再對照解題步驟。

* thinka提供的內容由AI生成,可能並非總是準確或最新。請將其用作輔助資源,並與官方材料進行核實。

你已看過標準答案,接下來輪到批改你的答案。

這一頁可以告訴你好答案的樣子,卻無法指出你的答案欠缺什麼。thinka 按真實評分準則批改你的文字答案,約 15 秒完成。

想多做幾條同類題目?立即開始練習呢個課題,即做即批改。

立即練習