Senior Secondary (HKDSE) · Information and Communication Technology

Algorithm Design:練習問題

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

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

In Algorithm Design, which of the following is considered a simple data structure rather than a basic data type?

問 2
1

A medical application records a patient's body temperature (e.g., \( 36.5 \)), whether they have a fever (True/False), and their unique patient code (e.g., "P105"). Which combination of data types is most appropriate for these three items respectively?

問 3
1

A flowchart for a membership system uses the following logic to determine a discount rate based on Points:

- If Points > 1000, then Discount = 0.2.
- Else if Points > 500, then Discount = 0.1.
- Otherwise, Discount = 0.05.

If the input Points is exactly \( 1000 \), what is the outputted Discount?

問 4
1

Which of the following is a fundamental control structure used in Algorithm Design to represent a choice between two or more execution paths based on a condition?

問 5
1

A programmer wants to write an algorithm that repeatedly asks the user for a positive number until a number greater than 100 is entered. Which control structure is most appropriate for implementing this requirement?

問 6
2

In Algorithm Design, which logical operator should be used to combine two Boolean conditions such that the resulting expression is True only if both individual conditions are True?

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

問 7
3

Consider the following pseudocode involving an integer variable \( N \):

SET N TO 15
IF (N MOD 3 == 0) AND (N > 10) THEN
  PRINT "Alpha"
ELSE
  PRINT "Beta"
END IF

What will be the output of this algorithm?

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

問 8
5

Design a pseudocode algorithm that accepts three integer inputs, A, B, and C, and prints "All equal" if all three are the same, otherwise prints "Not all equal".

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

問 9
3

In Algorithm Design, choosing the correct data types and control structures is vital for efficiency. Answer the following questions regarding algorithm fundamentals.

(a) State one difference between an integer data type and a real data type. (1 mark)

(b) Which control structure (Sequence, Selection, or Iteration) is most suitable for an algorithm that needs to check if a student's mark is above \(50\) to determine a pass or fail? (1 mark)

(c) Determine the final value of the variable total after the following pseudocode is executed:
total = 20
num = 8
IF \(num + 5 < 15\) THEN
total = total * 2
ELSE
total = total + 10
END IF (1 mark)

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

問 10
8

A programming contest stores the scores of 5 participants in a 1-dimensional array MARKS: [65, 42, 88, 65, 92]. Assume the array is 1-indexed and that the value -1 represents a null state.


(a) Complete a trace table for the following algorithm to determine the final values of X and Y as it processes the array. (4 marks)


1. X = MARKS[1]
2. Y = -1
3. FOR I FROM 2 TO 5 DO
4.   IF MARKS[I] > X THEN
5.     Y = X
6.     X = MARKS[I]
7.   ELSE IF (MARKS[I] > Y) AND (MARKS[I] < X) THEN
8.     Y = MARKS[I]
9.   END IF
10. END FOR


(b) Based on your trace table, identify the logical purpose of the variable Y at the end of the algorithm. (1 mark)


(c) If the number of participants increases to a large value, such as \(N = 1,000,000\), and the MARKS array is sorted, which search algorithm would be most efficient to locate a specific score? Justify your answer by comparing its performance to a linear search. (2 marks)


(d) State one programming style, such as those related to documentation or layout, that should be applied to the pseudocode above to make it easier for other developers to maintain. (1 mark)

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

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

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

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

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

練習を始める