Cambridge International AS Level · Computer Science (9618)

Programming: Practice Questions

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

8 questions17 marksFree, no account
Question 1
1 mark

A programmer needs to define a constant for the maximum number of attempts allowed in a login system. Which pseudocode statement correctly performs this declaration and initialisation?

Question 2
1 mark

Consider the following pseudocode fragment:
IF Temperature > 30 THEN
  OUTPUT "Hot"
ELSE
  IF Temperature < 10 THEN
    OUTPUT "Cold"
  ELSE
    OUTPUT "Moderate"
  ENDIF
ENDIF
What is this specific structure an example of?

Question 3
1 mark

A developer is deciding between using a pre-condition loop (WHILE...ENDWHILE) and a post-condition loop (REPEAT...UNTIL) for a specific task. What is the primary functional difference that would justify using a pre-condition loop?

Question 4
1 mark

What is the main difference between a procedure and a function in structured programming?

Question 5
1 mark

A programmer uses the following pseudocode for a string manipulation task:

DECLARE MyString : STRING
MyString ← "Cambridge"
OUTPUT RIGHT(MyString, 6)

What will be the output of this code?

Question 6
5 marks

Evaluate the output of the following pseudocode expression, assuming standard string library functions:
LCASE(SUBSTR("COMPUTER SCIENCE", 10, 4)) & STR(LENGTH("9618"))

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

Question 7
3 marks

A program is being developed to manage scores for a competitive game.
Write pseudocode to declare a constant called MAX_PLAYERS with a value of 50 and a variable called CurrentScore that can hold decimal values. Initialise CurrentScore to 0.0.

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

Question 8
4 marks

A string variable UserID contains a value such as "ST1234".

Write pseudocode to:
1. Extract the first two characters of the string.
2. Convert these characters to uppercase.
3. Determine the total length of the string and output it to the console.

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, marked as you go.

Practise More