Chapter 17 Programming
![Up](../_derived/up_cmp_blends010_hbtn.gif)
![2003 F4 EOY](../_derived/2003_f4_eoy.htm_cmp_blends010_hbtn.gif)
- 1. What is LOGO
It is a high level programming language that is suitable for teaching programming to beginners and in particular children - 2. What does the command FORWARD n mean?
This command would move the LOGO turtle forward n units on the screen. - 3. What does the command REPEAT 4 (forward 5, RIGHT 90) do?
This command would make a square with side length 5 units. - 4. What does PEN UP do
This will allow the turtle to move without moving drawing a line - 5. What does PEN DOWN do?
This will ensure that when the turtle moves it will leave a line behind it. - 6. Make a program to make a square. The side length is 45.
REPEAT 4 (forward 45, RIGHT 90) - 7. Make a program to make a parallelogram (4 sides) . The side length is 45 and the acute inside angle is 57
REPEAT 2 (FD 45 RT 57 FD 45 RT 135) - 8. How would you get the turtle to create a flag shape
FD 50 REPEAT 3 (RT 90 FD 25) - 9. Write down an algorithm that you could use to control a burglar alarm.
DO WHILE Alarm is ON
INPUT signal from Motion Sensor
IF signal indicates intruder
Sound Alarm
END IF
END WHILE - 10. Generate an algorithm that will control an air conditioning unit.
DO WHILE air-con is ON
INPUT Temperature from Sensor
IF Temperature > Preset Temperature AND Motor is OFF
Turn On Air Con motor
End IF
IF Temperature < Preset Temperature AND Motor is ON
Turn OFF Air Con motor
End IF
END WHILE
- 11. Describe what a feasibility report is.
This is a report produced at an early stage of a system development life cycle. It is an important report that is prepared for the sponsors of a proposed project. The sponsors must use this report as the basis for making a decision about whether to go ahead with development of a system or not. They will need to weigh up advantages of a new system against disadvantages. The system analyst will hopefully be able to identify the chance of creating a system successfully and will be able to roughly estimate the costs and benefits of any proposed system. In real life initial estimates are often very far away from what eventually transpires. It is not uncommon for initial estimates of costs to be out by more than 50%. Fortunately, costs and benefits are refined and reviewed many times as the project gets further developed. - 12. What are two things that would need to be tested before a control system is put into place
(i) The system must function correctly. This would mean making sure that the software controlling actuators does indeed start and stop motors when it is supposed to given input form sensors. (ii) A control system can cost a lot of money. We would need to determine that there are going to be advantages in having such a system and that our high initial investment in equipment is going to be worthwhile. (iii) We would need to ensure that the sensors used in the system have been calibrated correctly. We should ensure that a thermocouple which is producing a different voltage depending on temperature, is going to be able to be translated into the correct digital value that is used as input for a controlling computer program.
- 13. Describe how a control system for traffic lights would work.
Your system is to have a camera that takes pictures of cars that go through red lights at intersections so that these people can be prosecuted and can have their cars taken off them.
A camera will take a picture whenever it detects a car. The camera will have a sensor to detect if a car has gone past or not. The camera would be linked up to the traffic lights. The camera is only activated when the lights are red. Thus the camera will only take pictures of people who have driven through a red light. The pictures, which are digital, can be sent back electronically to the police station where they can be used as evidence for prosecution.
![Links](../_derived/links.htm_cmp_blends010_gbtn.gif)