#### Category: Challenges ## Examination Centre This is an algorithm trace task. No implementation is required.

Read the algorithm below, which validates an Examination Centre number and determines whether it is an overseas or a UK Centre.

The function Len(code) returns the number of characters in code. For example, if code = JA3451,
Len(code) = 6.

The algorithm refers to the one dimensional array err, which has been dimensioned to five cells.

Each output starts on a new line.

## Push Pop This is an algorithm trace task. No implementation is required.

The following algorithm uses one procedure and five functions.

## Mystery 2008 This is an algorithm trace task. No implementation is required.

Read the following algorithm for the recursive procedure called Mystery.

Where

• LEN(aSTRING) returns the number of characters in the string held in aString,
• MID\$(aString, n,m) returns m characters of aString starting at the nth,
• LEFT\$(aString, n) returns the first n characters of aString,
• RIGHT\$(aString, n) returns the last n characters of aString,
• & joins two strings together (concatenation).

## The Pundit In this task you should use libraries such as Cheetah and Plotly to analyse data for a game or competition producing useful statistics and chats that could be used by a Pundit.

## The Dice Game The dice simulator and subsequent dice playing game was a Pre-2015 GCSE CS Controlled Assessment task from OCR.   It is probably their most exciting coursework ever and is here so everyone gets a chance.  It also contains hints on completing the CA well.

## University Databases Courses at a university consist of modules. Each module is taught by one or more lecturers and each lecturer teaches at least one module. Each module has a book list consisting of one or more books. A book may be used on more than one module.

Modules have a code and a name. The code consists of two letters followed by 4 digits, for example CP1051 is called An Introduction to Visual Basic.

Each lecturer has a telephone extension number and an office; these may be shared with other lecturers. The telephone extension is a four-digit number and all offices have a five-character identification consisting of two letters and three digits, for example, MU217. Other than the names of lecturers, no personal details of lecturers are to be held.

A database is required that holds details of lecturers, modules and books. It has already been decided to hold the data in the following five tables.

• Lecturer – holds details of each lecturer.
• Module – holds details of each module.
• LecturerModule – acts as a link between the Lecturer and Module tables. Book – holds details of each book.
• ModuleBook – acts as a link between the Module and Book tables.

## Area Calculator In this challenge you should write a program that calculates the area of different shapes. It is a chance for you to practice basic maths inside a program amongst other skills.  I would approach it something like:

• Create a program that will calculate the area of a rectangle.
• Use an IF statement to ask the user which shape they would like to calculate the area of.
• Add an option for a Triangle.
• Import the maths library and use it to calculate the area of a Circle.
• At this point you might think about using methods to split your code up into small manageable chunks.

Flowchart Description of the Algorithm.

### Extension

Write a program to calculate the surface area of the following shapes: a square, a cube, a pyramid, and a cylinder.  Ask the user which shape he would like to calculate the area for, and the dimensions that are needed for the calculation.

The formulæ for each shape follows.

• Area of a cube: 6 X (Length of side)2
• Area of a pyramid: (Number of faces X Length of base X Height) / 2
• Area of cylinder : 2?Radius X Height

## Hello World There are a number of advantages to writing Hello World as your first program including the simplicity of it.  In Python it would look like:

```print ( "Hello World" )

```

Type this into a Python command prompt and press enter.

## Informatics (03) The ninth year of the UK Informatics Competition organised by Richard Forster and Antony Rix. The students had to complete a series of challenges including ISBN and Virtual Lakes.

## Middle Character One of my favourites.  Write a program that tests the length of a string.  If the String is even it will output ‘even’.  If the string is odd it will output ‘odd’.

You will need to use an IF statement and find the length of the string using the String.length() method.

Note:  The modulus of the string’s length e.g. length % 2 will return either 0 or 1 which you can use to determine odd or even