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

Following and writing algorithms:練習問題

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

10 問22 無料・登録不要
問 1
1

A linear search algorithm is used to find the value 25 in the following list: [10, 5, 25, 40, 15].
Assuming the algorithm stops as soon as the item is found, how many comparisons are made?

問 2
1

Which of the following statements accurately compares the worst-case time efficiency of Binary Search and Linear Search on a very large, sorted list containing \(n\) elements?

問 3
1

Hand-trace the following algorithm and determine the final value of B:

A = 6
B = 1
REPEAT
    A = A - 2
    B = B * 3
UNTIL B > A

問 4
1

What is the defining characteristic of an algorithm according to the standard definition in computer science?

問 5
1

Consider the list [8, 3, 6, 1]. After the first complete pass of the bubble sort algorithm (starting from the left and comparing adjacent elements), what is the state of the list?

問 6
2

What is the fundamental characteristic of an algorithm, as defined in computer science?

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

問 7
3

Explain the primary purpose of hand-tracing an algorithm using a set of test data.

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

問 8
5

Explain the importance of using erroneous test data when hand-tracing an algorithm intended for a production environment.

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

問 9
3

Consider the following algorithm expressed in pseudocode:

START
X = 15
Y = 7
Z = 0
IF X > Y THEN
    Z = X MOD Y
    X = X DIV Y
ELSE
    Z = Y - X
    X = Y * 2
END IF
Y = Y + Z
OUTPUT X
OUTPUT Y
OUTPUT Z
END

Trace the execution of this algorithm, assuming standard integer arithmetic (DIV is integer division and MOD is the remainder), and state the final output values of X, Y, and Z.

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

問 10
4

The following pseudocode processes an array Items of integers. Assume Items = [10, 4, 1, 9, 6] and the array indices run from 1 to 5 ( =5).

FUNCTION ProcessList(Items, n)
1. Total = 0
2. FOR I = 1 TO n DO
3.     Current = Items[I]
4.     IF Current < 5 AND Current MOD 2 == 0 THEN
5.         Total = Total + 1
6.     ELSE IF Current >= 10 OR Current MOD 3 == 0 THEN
7.         Total = Total + 2
8.     ELSE
9.         Total = Total + 0
10.     END IF
11. END FOR
12. RETURN Total

Hand-trace the execution of ProcessList(Items, 5) and state the final value returned by the function.

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

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

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

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

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

練習を始める