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 秒完成。

想多做几道同类题目?立即开始练习这个课题,边做边批改。

立即练习