You are on page 1of 2

Ασκήσεις Προγραμματισμού 30/10/20

Άσκηση 1
State the output of the following algorithm. INT gives the integer part of a number, e.g.
INT(3.2) = 3, INT (3.8) = 3 [8]

FOR N = 5 to 12
FOR X = 1 TO INT (N/2)
Y = N/X

Άσκηση 2
A group of 6 schools runs a sports day. In each event there is one competitor from each
You have been asked to design a computerised system that will help the organiser to record
_ The results of each event will be entered into an event results screen.
_ The staff must be able to enter each competitor’s time/distance/height.
_ The system will calculate and display the ranking order of the competitors for each event.

Άσκηση 3
The mean of a group of numbers is calculated by dividing the total of the numbers by how
many numbers there are in the group.
A computer program is to be written which will allow the user to input nine numbers and
output the mean, maximum and minimum values of the group.
(a) Draw a top-down diagram to show how this problem may be broken down.
(b) Write an algorithm for this problem, explaining, where necessary, the variables and the
commands that you have used.
(c) Explain clearly what changes you would make to your algorithm if the number of
numbers is unknown.

Άσκηση 4
A manufacturer wishes to make a new calculator, for use by young children, with the
following facilities.
• User is able to enter positive and negative decimal numbers.
• The numbers appear in a display on the calculator.
• User can enter the operations add, subtract, multiply and divide.
• User can clear the display, which then shows the number zero.
• When an operation is entered, the display shows the result of the previous calculation.
• When a new number is entered, the display clears the previous contents and shows the
• When an equals sign is pressed, the display shows the result of the previous calculation.
You are advised to familiarise yourself with displays on a calculator.
The manufacturer wishes to use a simulation of the new calculator so that the user interface
can be tested.
(a) Design a user interface that can be used to test the above facilities. Provide hard copy
showing this design. (A screen dump is acceptable.) [5]
(b) Using a high-level language of your choice, implement and test your design to show that
the above facilities work correctly.
(i) Provide hard copy of your annotated program, stating the language and version used. [5]
(ii) Provide a table showing your test data and the expected and actual results. [6]
(iii) Supply hard copy evidence of testing your solution. (Screen dumps are acceptable, but
must show the data entered and the results.)