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 秒完成。

想多做几道同类题目?立即开始练习这个课题,边做边批改。

立即练习