CIE IGCSE COMPUTER SCIENCE
Practical problem-solving and programming
Chapter 11 – Programming concepts
11.1 Introduction
Chapters 9 and 10 enabled to develop computational thinking by writing algorithm to perform various tasks.
This chapter will show how to put computational thinking to the ultimate test by writing computer programs to
perform tasks.
So far algorithms were tested by dry run tests. Once a program for an algorithm is written, and when there are
no syntax errors, a computer has to be used to run the program to complete the task specified. The computer
will perform the task exactly as it has been written; some changes may need to be made before it work exactly
as intended.
11.2 Programming
Programs can be written in high- or low-level languages then translated and run. This chapter introduces the
programming concepts required for practical use if high-level language.
There are many high-level programming languages to choose from. Any high-level programming may be used
but Visual Basic, Pascal/Delphi or Python is recommended.
Many programming languages are free to download and use. This chapter shows the use of programming and
should be used in conjunction with learning the syntax of an appropriate programming language.
Programs developed in the chapter will be illustrated using the following freely available languages:
Scratch: a good basic introduction to programming for beginners that is freely available from MIT.
Scratch makes programming easy and fun to learn as it uses visual building blocks. It is useful as an
introduction.
JavaScript: a scripting language that works in any browser, no download needed. JavaScript works with
the HTML.
Python: a general purpose, open source programming language that promotes rapid program
development and readable code.
The traditional introduction to programming in any language is to display the words ‘Hello World’ on a computer
screen. The programs looks very different:
Scratch and Python work in their own Integrated Development Environments (IDEs).
1
,Python IDE is below.
Scratch program running is below.
Scratch IDE is below.
2
, JavaScript works in a browser.
JavaScript working in a browser is below.
11.3 Declaration and use of variables and constants
A VARIABLE in a computer program is a names data store that contains a value that may change during the
execution of the program. In order to make programs understandable to others, variables should be given
meaningful names.
A CONSTANT in a computer program is a named data store that contains a value that does not change during
the execution of the program. In order to make programs understandable to others, constants should be given
meaningful names.
Not all programming languages explicitly differentiate between constants and variables but programmers
should be clear which data stores can be changed and which cannot be changed. There are several ways of
doing this, for example:
use of capital letters: PI = 3.142
meaningful names that begin with Const: ConstPi = 3.142
It is considered good practice to declare at the start of a program the constants and variables to be used in that
program.
Below are variable and constant declarations in Scratch.
Below are variable and constant declarations in JavaScript.
3
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller anyiamgeorge19. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for £11.37. You're not tied to anything after your purchase.