1. Understanding Programs and Languages
A computer program is a sequence of instructions that a computer follows to perform a specific task. These instructions are written by programmers using a programming language. There are two main types of programming languages: high-level and low-level. High-level languages, like Python or Java, use English-like commands and are easier for humans to read, write, and debug. They are 'portable', meaning they can run on different types of computers with little or no modification. Low-level languages, like assembly language, are much closer to the computer's native language (machine code) and give the programmer very direct control over the computer's hardware. Machine code itself is the lowest level, consisting of binary digits (1s and 0s) that the CPU can execute directly.
Key term
Examiner insight
Common pitfall
Fun fact
Worked example 14 marks
Compare two characteristics of high-level languages and low-level languages. [4]
- 1
Characteristic 1: Readability. High-level languages use English-like statements (e.g., 'PRINT name'), making them easy for humans to read and understand. Low-level languages use mnemonics (e.g., 'LDA #10') or binary, which is difficult to read.
- 2
Characteristic 2: Portability. High-level language programs are generally portable and can run on different computer systems with minimal changes. Low-level language programs are often specific to a particular CPU architecture and are not portable.
- 3
Characteristic 3: Hardware Control. Low-level languages provide direct control over the system hardware and memory, which is useful for creating device drivers or operating systems. High-level languages abstract away the hardware, making this level of control difficult.
- 4
Characteristic 4: Debugging. It is easier to find and fix errors (debug) in high-level languages because the code is more understandable and they have better built-in tools. Debugging low-level code is a more complex and time-consuming process.
Recap
- A program is a set of instructions for a computer to execute.
- High-level languages are human-friendly, portable, and easier to debug.
- Low-level languages are machine-specific and offer direct hardware control.
- Assembly language is a low-level language that uses mnemonics.
- Machine code is binary data that the CPU executes directly.
Quick check
- State two advantages of writing a program in a high-level language.2 marks