Oxford AQA International A-level · Computer Science (9645)

Stacks: แบบฝึกหัด

ข้อปรนัย 5 ข้อ ตรวจให้ทันทีที่ตอบ และข้อเขียน 5 ข้อ พร้อมวิธีทำละเอียด ทั้งหมดจากเรื่อง Stacks

10 ข้อ23 คะแนนฟรี ไม่ต้องสมัคร
ข้อ 1
1 คะแนน

In the context of a stack data structure, what is the term used for the operation of adding an item to the top of the stack?

ข้อ 2
1 คะแนน

Which of the following computational tasks is most appropriately solved using a stack data structure?

ข้อ 3
1 คะแนน

Consider two common scenarios: (i) Processing function calls and local variables during program execution, and (ii) Handling data requests sent to a shared server that processes them sequentially based on arrival time. Which data structures are most suitable for (i) and (ii) respectively?

ข้อ 4
1 คะแนน

A stack is initially empty. The following operations are performed in sequence:
1. Push(10)
2. Push(20)
3. Pop
4. Push(30)
5. Peek
What value is returned by the Peek operation?

ข้อ 5
1 คะแนน

An empty stack S is manipulated using the following operations:
1. Push(A)
2. Push(B)
3. Pop()
4. Push(C)
5. Peek()
6. Pop()
If the Peek operation returns the value at the top without removing it, what is the final state of the stack (from bottom to top)?

ข้อ 6
2 คะแนน

Define the principle governing the operation of a Stack data structure and name the primary pointer used to track its active end.

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 7
3 คะแนน

Explain the role of the 'peek' operation on a stack, and how it differs functionally from the 'pop' operation.

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 8
5 คะแนน

When implementing a stack using a fixed-size array represented by STACK[0..N-1], and a stack pointer Top that points to the most recently added item, what precise condition must be met to test if the stack is full?

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 9
3 คะแนน

A stack is implemented using an array with a maximum capacity of 5. The stack currently contains the elements ['A', 'B', 'C'] where 'C' is the top of the stack.

(a) Define the term LIFO (Last-In, First-Out) in the context of a stack data structure.

(b) Describe the state of the stack contents (the list of elements) and identify the new top element after the following sequence of operations:
1. PUSH ('D')
2. PUSH ('E')
3. POP()
4. PUSH ('F')

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

ข้อ 10
5 คะแนน

When a subroutine is called, data is temporarily stored in a stack frame on the system stack.

(a) State two distinct types of data, other than parameters and return addresses, that may be stored in a stack frame when a subroutine is executed.

(b) Explain the importance of storing the return address within the stack frame during subroutine execution.

(c) Contrast the scope of a local variable defined within a subroutine with that of a global variable.

ลองเขียนคำตอบด้วยตัวเองก่อน แล้วค่อยเทียบกับวิธีทำ

* เนื้อหาของ thinka สร้างโดย AI อาจไม่ถูกต้องสมบูรณ์ในทุกกรณี กรุณาใช้เป็นสื่อเสริมและตรวจสอบกับเอกสารอ้างอิงอย่างเป็นทางการ

คุณเห็นเฉลยแล้ว ทีนี้มาตรวจคำตอบของคุณบ้าง

หน้านี้บอกได้ว่าคำตอบที่ดีเป็นอย่างไร แต่บอกไม่ได้ว่าคำตอบของคุณขาดอะไร thinka ตรวจข้อเขียนของคุณตามเกณฑ์ให้คะแนนจริงในราว 15 วินาที

อยากฝึกโจทย์แบบนี้เพิ่มไหม เริ่มฝึกหัวข้อนี้ได้เลย ตรวจให้ทันทีทุกข้อ

เริ่มฝึกเลย