Which statement correctly describes the effect of passing a parameter BYVAL (by value) to a procedure in Programming?
Cambridge International A Level · Computer Science (9618)
Programming:練習題
5 條多項選擇題即時批改,另有 5 條文字題附完整解題步驟,全部圍繞「Programming」。
In Programming, which of the following is a primary advantage of using a CASE structure instead of multiple nested IF statements?
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] ENDIFNEXT i
Which of the following describes the most significant risk if this algorithm is implemented without further validation or stepwise refinement?
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?
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?
Describe how the implementation of exception handling improves the robustness of a program during a file-read operation.
先自己寫一次答案,再對照解題步驟。
Explain the concept of polymorphism in Object-Oriented Programming and describe how it relates to inheritance.
先自己寫一次答案,再對照解題步驟。
Explain the difference between passing a parameter by value and by reference when calling a procedure in a high-level programming language.
先自己寫一次答案,再對照解題步驟。
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.
先自己寫一次答案,再對照解題步驟。
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生成,可能並非總是準確或最新。請將其用作輔助資源,並與官方材料進行核實。
想多做幾條同類題目?立即開始練習呢個課題,即做即批改。
立即練習