Cambridge International A Level · Computer Science (9618)

Programming:練習問題

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

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

Which statement correctly describes the effect of passing a parameter BYVAL (by value) to a procedure in Programming?

問 2
1

In Programming, which of the following is a primary advantage of using a CASE structure instead of multiple nested IF statements?

問 3
1

Consider the following Programming pseudocode intended to find the maximum value in an array Arr of \( n \) integers:

Max ← Arr[1]
FOR i ← 2 TO n
  IF Arr[i] > Max THEN
    Max ← Arr[i]
  ENDIF
NEXT i

Which of the following describes the most significant risk if this algorithm is implemented without further validation or stepwise refinement?

問 4
1

A programmer needs to write a routine that repeats a block of code exactly 100 times. Which type of loop structure is most appropriate for this task in pseudocode?

問 5
1

A programmer is developing a module using the following pseudocode algorithm:

PROCEDURE Process(BYVAL x, BYREF y)
\(x \leftarrow x + 10\)
\(y \leftarrow y + x\)
\(x \leftarrow x \times 2\)
ENDPROCEDURE

DECLARE a, b : INTEGER
\(a \leftarrow 5\)
\(b \leftarrow 15\)
Process(a, b)
OUTPUT a, b

What is the output of this algorithm?

問 6
3

Describe how the implementation of exception handling improves the robustness of a program during a file-read operation.

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

問 7
5

Explain the concept of polymorphism in Object-Oriented Programming and describe how it relates to inheritance.

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

問 8
4

Explain the difference between passing a parameter by value and by reference when calling a procedure in a high-level programming language.

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

問 9
4

A programmer is developing a simple application to manage a theater's ticket pricing. The standard ticket price is set at \( \$25 \). The system applies the following rules:
- Customers aged 12 or under receive a \( 40\% \) discount.
- Customers aged 65 or over receive a \( 20\% \) discount.
- All other customers pay the full price.

a) Identify the most appropriate data types for the following variables: Age, StandardPrice, and IsMember (a flag indicating if they have a loyalty card).

b) Write pseudocode using a selection structure to calculate the FinalPrice for a customer based on their Age.

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

問 10
5

Consider the following pseudocode snippet:
PROCEDURE UpdateValue(BYREF x, BYVAL y)
  x = x + 10
  y = y + 10
ENDPROCEDURE

If variables A = 5 and B = 5 are passed to UpdateValue(A, B):
a) State the values of A and B after the procedure call and justify your answer by explaining the difference between Passing by Value and Passing by Reference.
b) Describe the role of a Function Header in structured programming.
c) Explain why using parameters is preferred over using global variables within subroutines.

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

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

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

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

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

練習を始める