Cambridge International A Level · Computer Science (9618)

Programming: Practice Questions

5 multiple-choice questions marked as you go, and 5 written questions with worked solutions. All on Programming.

10 questions26 marksFree, no account
Question 1
1 mark

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

Question 2
1 mark

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

Question 3
1 mark

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?

Question 4
1 mark

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?

Question 5
1 mark

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?

Question 6
3 marks

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

Write your answer out first, then check it against the worked solution.

Question 7
5 marks

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

Write your answer out first, then check it against the worked solution.

Question 8
4 marks

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

Write your answer out first, then check it against the worked solution.

Question 9
4 marks

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.

Write your answer out first, then check it against the worked solution.

Question 10
5 marks

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.

Write your answer out first, then check it against the worked solution.

* The content provided by thinka is generated by AI and may not always be accurate or up-to-date. Please use it as a supplementary resource and verify with official materials.

You've seen the model answer. Now get yours marked.

This page can show you how a good answer looks. It cannot tell you what your answer was missing. thinka marks your written work against the real mark scheme in about 15 seconds.

Want more questions like these? Get a fresh set on this topic, graded as you go.

Practice More