Category: Challenges

Byte Insight

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.

Sith 2006

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

Read the following algorithm, which operates on numbers held in an array Sift, where the size of the array is 10. All of the variables used in the algorithm are integers.

In the algorithm, DIV is an operator that divides one integer by a second integer and truncates the result to its integer part. This means that

  • 15 DIV 4 is 3
  • 19 DIV 2 is 9

Curiosity 2006

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

Read the following algorithm for the recursive function called Curiosity that needs two integers as inputs and returns an integer value.

In the algorithm, MOD is an operator. It works with two integers to give the remainder when the first integer is divided by the second. This means that

  • 17 MOD 7 is 3
  • 72 MOD 15 is 12

Press Cutting Service

This is a software development task and an implementation task.

A group of Sixth Form students have decided to run a press cutting service for the students in their school. They intend to identify and take cuttings of topics related to each examination subject taught at the school.

They propose to hold basic information about each cutting on a database. Students will be able to access this database.

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

School Tie (11)

A school tie with a non-repeating pattern of coloured strips has been produced with the stripes in the wrong order.  The board of governors proposes to fix the ties by repeating cutting them into two pieces, reversing the bottom piece then sewing them back together. See poster for example Write a program which given the correct and incorrect order of the strips calculates how to cut the ties. Taken from the 2011 Informatics Olympiad.  Click here to view all the competition tasks. © British Informatics Olympiad

Pizza Pandemonium (12)

A rectangular pizza has been divided into squares.  Having been covered in tasty-brand cheese and tomato sauce, some of the squares have had olives placed on them leaving other squares free. Write a program to find out how many ways anchovies can be placed onto the pizza assuming no square is allowed to contain both olives and anchovies and no row (or column) in the pizza is allowed to contain more than one anchovy.

Informatics (13)

In the 2013 competition students were challenged by the Tower of London and a Coup! Taken from the 2013 Informatics Olympiad.  Click here to view all the competition tasks. © British Informatics Olympiad