Category: Challenges

Byte Insight

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.

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.

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

Einee-Meenie-Minee-Mo (04)

A group of friends are standing in a circle playing a game.  They proceed around the circle, chanting the rhyme and pointing to the next person (clockwise) on each word.  When the rhyme finishes whoever is being pointed at leaves the circles.  Then they start again, pointing where they left off, and the game continues until only one person is left.

The version of the rhyme they are using is

Eeny, meeny, miny, moe,

Catch a tiger by the toe.

If he hollers, let him go,

Eeny, meeny, miny, moe.

Write a program, which given the number of friends and the length of the rhyme, can determine who wins. 

Morse

Introduction

This challenge is based around conversions between text and morse code.   It could be done as a straightforward Python program but if completed on a Raspberry Pi, Arduino or similar then it could be linked into the GPIO pins and a LED output could be produced. You can use the morse code files located here.

Games (06)

In the Mayan calendar there were 20 days (called Kins) in a Uinal, 18 Uinals in a Tun, 20 tuns in a Katan and 20 Katans in a Baktun.   We write our dates in the order day, month and then year,  The Maya write their dates in reverse order giving the baktun, katun, tun, uinal then kin. The Mayan date 13-20-7-16-3 corresponds to 1-1-2000.  Write a program which converts between the Mayan calendar and our own.