AQA A Level · Computer Science 7517

Queues:練習問題

その場で採点される選択問題 5 問と、解説つきの記述問題 4 問。すべて「Queues」からの出題です。

9 問24 無料・登録不要
問 1
1

In a priority queue, how is the position of an item determined when it is added to the structure?

問 2
1

A circular queue is implemented using an array of size 4 (indices 0 to 3). The queue currently contains the following data:
Index 0: [Empty]
Index 1: 'A'
Index 2: 'B'
Index 3: 'C'

If the front pointer is 1 and the rear pointer is 3, what happens to the rear pointer when item 'D' is added?

問 3
1

A priority queue is implemented using an ordered list where the highest priority item is at the front. If a new item with priority \(P\) is added, and there are currently \(n\) items in the queue, what is the worst-case time complexity for the add operation?

問 4
1

Which of the following operations is necessary to test if a linear queue implemented using a static array of size N is full?

問 5
1

A linear queue is implemented using a static array of size 6 (indices 0 to 5).

Initially, the queue is empty with front at 0 and rear at -1. The following operations occur:
1. Enqueue 'X', 'Y', 'Z'
2. Dequeue two items
3. Enqueue 'W'

What are the current values of the front and rear pointers?

問 6
3

Consider a linear queue implemented with a static array of size 10. After several additions and removals, the front pointer is at index 9 and the rear pointer is also at index 9. Explain why this queue might be reported as 'full' even if index 0 to 8 are empty.

まず自分で答えを書いてから、解説と照らし合わせましょう。

問 7
5

A priority queue is used in a CPU scheduler. If three tasks with priorities 1, 5, and 3 (where 5 is the highest priority) are added in that order, what is the logical order in which they will be removed?

まず自分で答えを書いてから、解説と照らし合わせましょう。

問 8
4

A Priority Queue is used to manage print jobs. Each job has a priority level (1 = High, 5 = Low).

a. If the queue contains jobs with priorities [3, 1, 4] in that order, which job will be removed first? (1 point)
b. Describe the steps to add a job with priority 2 to a priority queue implemented as an ordered list. (2 points)
c. How does the remove operation in a priority queue differ from that in a standard FIFO linear queue? (1 point)

まず自分で答えを書いてから、解説と照らし合わせましょう。

問 9
7

A circular queue is implemented using a fixed-size array of 8 elements, indexed 0 to 7. The current state of the queue is as follows:
- front pointer: 6
- rear pointer: 1
- size: 4

a. Identify the indices of the array that currently contain data, assuming the rear pointer points to the last element added. (2 points)

b. Describe the steps involved in adding a new item to this circular queue. In your answer, include the specific calculations for updating the rear pointer using the MOD operator, given the array size of 8. (3 points)

c. Explain how a circular queue differs from a linear queue in terms of memory utilization. (2 points)

まず自分で答えを書いてから、解説と照らし合わせましょう。

※ thinkaのコンテンツはAIにより生成されているため、内容が正確でない場合があります。補助教材としてご使用いただき、公式の教材と合わせてご確認ください。

模範解答は見ました。次はあなたの答案を採点します。

このページは良い答案の形を示せますが、あなたの答案に何が足りないかは教えられません。thinka は実際の採点基準に沿って記述答案を約 15 秒で採点します。

同じような問題をもっと解きたい?このトピックの新しい問題を、解きながら採点。

練習を始める