O Level Computer Science 2210 Paper 21, May/June 2024

Question paper and mark scheme75 marks9 questions

Solve it on ExamPal

Practise

Untimed. Write on the paper and check as you go.

Start

Exam

Timed, with a clock you set, like sitting the real paper.

Start

Opens full screen.

Papers open in

Opening the question paper

Read as textThe questions and the mark scheme as plain text. Easier to read on a phone.

Question paper

2210/21 · May/June 2024

Download PDF
2

Four descriptions of programming concepts and five programming concepts are shown.

a

Draw one line to link each description to the most appropriate programming concept. Not all programming concepts will be used. Description a subroutine that may not return a value a value that is declared and used within a specific procedure a value that a procedure expects you to supply when it is called a subroutine that will always return a value Programming concept function procedure parameter global variable local variable

[4]
b

Write the pseudocode to use a procedure named Average that passes the values 25 and 50 to the procedure.

[2]
c

Outline the role of procedures and functions in creating a program that is easier to maintain.

[3]
3

State what is meant by the data types integer and real. Give an example of each. Integer .............................................................................................................................................. .......................................................................................................................................................... Example ........................................................................................................................................... Real .................................................................................................................................................. .......................................................................................................................................................... Example ...........................................................................................................................................

[4]
4

This pseudocode algorithm is intended to allow, at random, between 1 and 20 values to be entered and totalled. The total and average of the entered values are output at the end of the algorithm. 01 DECLARE Loop : STRING 02 DECLARE Limit : INTEGER 03 DECLARE Value : REAL 04 DECLARE Total : REAL 05 Total ← 0 06 Limit ← ROUND(RANDOM() * 19,0) + 1 07 IF Loop ← 1 TO Limit 08 OUTPUT "Enter a number" 09 INPUT Loop 10 Total ← Total * Value 11 NEXT Loop 12 OUTPUT "The total of the numbers entered is ", Total 13 OUTPUT "The average of the numbers entered is ", Total / Limit

a

Identify the line numbers of four errors in the pseudocode and suggest corrections. Error 1 line number ................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 2 line number ................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 3 line number ................................................................................................................... Correction ................................................................................................................................. ................................................................................................................................................... Error 4 line number ................................................................................................................... Correction ................................................................................................................................. ...................................................................................................................................................

[4]
b

Write the pseudocode statement that would output the average calculated in line 13 of the algorithm rounded to one decimal place.

[2]
c

Explain how you should alter the original corrected algorithm to make sure that all the numbers entered are between 1 and 500 inclusive. If any numbers fall outside these limits, a replacement value is requested and entered. You do not need to re-write the algorithm.

[4]
5

Write the pseudocode statements to perform this task: • accept the input of a whole number from 1 to 4 inclusive • use a CASE statement to: ○ output the number (1 to 4 inclusive) that was entered ○ output the word “ERROR” if a 1 to 4 inclusive number was not entered.

[5]
6

The flowchart represents an algorithm.

Figure 1 of 1 for question 6
a

Complete the trace table for the input data: 7, 47, 50, 52, 60, 80, 63, 70

[7]
b

Outline the processes involved in the algorithm shown in the flowchart on page 6.

[3]
7
a

Outline why it is useful to store data in a file.

[2]
b

The function LENGTH(X) calculates the length of a string X Write the pseudocode statements to: • read the contents of the text file Quotation.txt into an appropriate string variable that has been declared • output the string in upper case and the length of the string.

[4]
8

Consider the logic expression: Z = (R OR NOT T) XOR (NOT S AND T)

a

Draw a logic circuit for this logic expression. Each logic gate must have a maximum of two inputs. Do not simplify this logic expression.

[5]
b

Complete the truth table from the given logic expression.

[4]
9

A database table called SoftDrinks stores details of the soft drinks sold by a small shop. Field | Example data Name | Cola Supplier | Cambridge Beverages Container | Can SizeCl | 330 NumberInStock | 30 ReorderLevel | 15 Reordered | Yes

a

State whether any of the given fields would be suitable as a primary key and give a reason for your answer.

[1]
b

Complete the structured query language (SQL) statement to return the number of cans the shop has in stock. SELECT ....................................................... (.......................................................) FROM ....................................................... WHERE ....................................................... = ....................................................... ;

[5]
10

The one-dimensional (1D) array Clubs[] is used to store the names of 12 cricket clubs in a local sports league. The two-dimensional (2D) array Statistics[] is used to store, for each cricket club, the number of: • matches won • matches drawn • matches lost. The 1D array Points[] is used to store the total number of points each cricket club has been awarded. The position of any cricket club’s data is the same in all three arrays. For example, the data in index 2 of Statistics[] and index 2 of Points[] belongs to the cricket club in index 2 of Clubs[] The variable Matches stores the number of matches played by each team. Each team plays the same number of matches. Points are awarded for: • a win – 12 points • a draw – 5 points • a loss – 0 points. Write a program that meets the following requirements: • allows the number of matches played to be input and stored, with a maximum of 22 matches • validates the number of matches played • allows the names of the cricket clubs to be input and stored • allows the number of matches won, drawn and lost to be input and stored for each team • validates the number of matches won, drawn or lost against the number of matches played • asks the user to re-enter the number of matches won, drawn or lost if the total does not match the number of matches played • calculates and stores the total number of points for each club • finds the cricket club or clubs with the highest number of points • outputs the name or names of the winning club or clubs, the number of wins and the total number of points awarded. You must use pseudocode or program code and add comments to explain how your code works. You do not need to declare any arrays or variables; you may assume that this has already been done. All inputs and outputs must contain suitable messages.

[15]

Mark scheme

2210/21 · May/June 2024

Download PDF

2a · 4 marks

  • 1 mark

    a subroutine that may not return a value -> procedure

  • 1 mark

    a value that is declared and used within a specific procedure -> local variable

  • 1 mark

    a value that a procedure expects you to supply when it is called -> parameter

  • 1 mark

    a subroutine that will always return a value -> function

2b · 2 marks

  • 1 mark

    Correct key word - CALL

  • 1 mark

    Procedure name with correct parameters - Average(25, 50)

2c · 3 marks

  • 1 mark

    Procedures / functions divide the program into smaller manageable segments

  • 1 mark

    … making it more readable / easier to understand / easier to debug

  • 1 mark

    Procedures / functions with meaningful names help to provide documentation for the program / enable/help/provide abstraction

  • 1 mark

    Procedures and functions may be re-used (in the program / in other programs / as part of a library) / run from a single line

  • 1 mark

    Procedures and functions can reduce / eliminate (repeated) code

3 · 4 marks

  • 1 mark

    Integer: A whole number

  • 1 mark

    Integer: Example of integer data (e.g. 27)

  • 1 mark

    Real: A number that contains a fractional part

  • 1 mark

    Real: Example of real data (e.g. 18.75)

4a · 4 marks

  • 1 mark

    Line 01 / DECLARE Loop : STRING should be DECLARE Loop : INTEGER

  • 1 mark

    Line 07 / IF Loop ← 1 TO Limit should be FOR Loop ← 1 TO Limit

  • 1 mark

    Line 09 / INPUT Loop should be INPUT Value

  • 1 mark

    Line 10 / Total ← Total * Value should be Total ← Total + Value

4b · 2 marks

  • 1 mark

    Correct use of ROUND with 2 arguments separated by comma, for example ROUND( 5, 2) (in statement 13) …

  • 1 mark

    … (Total / Limit,1) correct arguments

4c · 4 marks

  • 1 mark

    After line 09 / after the input (or Before line 08 / before the input message)

  • 1 mark

    Insert a WHILE / pre-condition loop (or start a REPEAT / post-condition loop)

  • 1 mark

    … to check if the value entered is between 1 and 500 inclusive (or close the REPEAT loop by checking if the value entered was between 1 and 500 inclusive after line 09 / after the input)

  • 1 mark

    If the value is not in range, output an error message and insert another input statement for re-input (or If it wasn’t, (the loop will repeat) for the number to be re-input / If it was, the program continues)

5 · 5 marks

  • 1 mark

    Correct input statement with appropriate variable

  • 1 mark

    Elements of selection statement present – CASE OF ENDCASE

  • 1 mark

    At least one correct branch in the case statement

  • 1 mark

    All branches from 1 to 4 correct

  • 1 mark

    Correct use of OTHERWISE with correct output.

6a · 7 marks

  • 1 mark

    Correct Limit column

  • 1 mark

    Correct Count column

  • 1 mark

    Array columns for input stage

  • 1 mark

    Array columns for sort stage

  • 1 mark

    Correct Flag column

  • 1 mark

    Correct Swap column

  • 1 mark

    Correct Result and OUTPUT columns

6b · 3 marks

  • 1 mark

    A set of numbers is input / stored in an array

  • 1 mark

    The numbers are sorted / Bubble sort into (ascending) order

  • 1 mark

    The middle / median value is found / output

7a · 2 marks

  • 1 mark

    Data stored in a file gives a permanent copy / prevents the data from being lost

  • 1 mark

    … so it can be recalled / used again in a program / in another program

  • 1 mark

    can be stored elsewhere / transferred to another computer

7b · 4 marks

  • 1 mark

    Declaration of a string variable

  • 1 mark

    Correct use of OPENFILE keywords for reading

  • 1 mark

    Correct use READFILE with string variable

  • 1 mark

    Correct use of UCASE and LENGTH functions and output of each

  • 1 mark

    Correct use of CLOSEFILE

8a · 5 marks

  • 1 mark

    NOT gate connected to input S

  • 1 mark

    NOT gate connected to input T

  • 1 mark

    OR gate connected to R and NOT S

  • 1 mark

    AND gate connected to NOT S and NOT T

  • 1 mark

    XOR gate connected to outputs of OR gate and AND gate to produce Z

8b · 4 marks

  • 4 marks

    Four marks for eight correct outputs (Three marks for 6-7, Two marks for 4-5, One mark for 2-3)

9a · 1 mark

  • 1 mark

    None of the fields are likely to contain unique data.

9b · 5 marks

  • 1 mark

    SUM

  • 1 mark

    NumberInStock

  • 1 mark

    SoftDrinks

  • 1 mark

    Container

  • 1 mark

    'Can'

10 · 15 marks

  • 9 marks

    AO2: Apply knowledge and understanding of the principles and concepts of computer science to a given context, including the analysis and design of computational or programming problems (Level 3: 7-9 marks; Level 2: 4-6 marks; Level 1: 1-3 marks)

  • 6 marks

    AO3: Provide solutions to problems by evaluating computer systems, making reasoned judgements, and presenting conclusions (Level 3: 5-6 marks; Level 2: 3-4 marks; Level 1: 1-2 marks)

Questions

  1. 2
    Question 29 marks
    Mark scheme ›
  2. 3
    Question 34 marks
    Mark scheme ›
  3. 4
    Question 410 marks
    Mark scheme ›
  4. 5
    Question 55 marks
    Mark scheme ›
  5. 6
    Question 610 marks
    Mark scheme ›
  6. 7
    Question 76 marks
    Mark scheme ›
  7. 8
    Question 89 marks
    Mark scheme ›
  8. 9
    Question 96 marks
    Mark scheme ›
  9. 10
    Question 1015 marks
    Mark scheme ›

More 2210 papers

Other papers from May/June 2024

Solve it on ExamPalStart