A viticultural scientist wants to log hourly soil acidity (pHpHpH) levels in a vineyard over a 7-day period (168 hours) to ensure optimal grape-growing conditions.
The pseudocode of an algorithm they have written is shown below:
50 h = 0 WHILE h < 168 SET h TO h + 1 RECEIVE p FROM KEYBOARD IF p < 5.5 THEN OUTPUT h, "ACID" ELSE OUTPUT h, "SAFE" ENDIF ENDWHILE
In some programming languages, if a program is written like this on a single line, it could be translated and executed.
Discuss the suitability of this code for humans and how it could be improved.
51 exam-style questions on Edexcel GCSE Computer Science Develop code, covering Decomposition and abstraction to solve problems, Read, write, analyse and refine programs, Converting algorithms into programs, Techniques for readable, maintainable code, Identifying and correcting program errors, and Evaluating program fitness and efficiency. Each one has a worked solution and a mark scheme showing where the marks go.