Category: Challenges

Byte Insight

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.

More info to follow.

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.

Sith 2005

This is an algorithm trace task. No implementation is required.

Read the following algorithm.

Mystery 2005

This is an algorithm trace task. No implementation is required.

Read the following algorithm for the recursive function called Mystery. X( ) is a one-dimensional array.

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

Egyptian Fractions (08)

When the ancient Egyptians wrote fractions they were only able to use ones of the form 1/a called unit fractions. An Egyptian wanting to write the fraction b/c, where b was not 1, had to write it as the sum of different unit fractions, For example, they would write 5/6 as 1/2 + 1/3 Write a program which converts a normal fraction into an Egyptian fraction. 

Informatics (09)

In 2009 the games were sponsered by Lionheart Studios and it was all about a game. Taken from the 2009 Informatics Olympiad.  Click here to view all the competition tasks. © British Informatics Olympiad

Word Play (10)

In a word game each letter has a score based on its position in the alphabet. A scoring 1 through to Z scoring 26.  The object of the game is to split the letters of a word into two groups so that the total score in each group is the same. For example LIONHEAD can be split into LIHAD and ONE, both scoring 34. Write a program that determines if it is possible to win the game and, if so, says how to split the word.