Lesson 5 of 10 · Computer Knowledge

Programming Languages, Translators, Number Systems and Character Codes

Drafted with AI assistance and fact-checked on 28 October 2026; not yet read line by line by a human editor. Spotted a mistake? Tell us. Editorial standards & corrections

Generations of languages

A computer directly understands only machine language, strings of 0s and 1s; this is the first generation (1GL). It runs fastest and needs no translation, but it is machine-dependent and very hard to write. Assembly language (2GL) uses short mnemonics such as ADD, SUB and MOV in place of binary codes. Machine and assembly languages are called low-level languages. Third-generation (3GL) high-level languages use English-like words and run on many machines: FORTRAN (1957, John Backus at IBM, for science), COBOL (1959, for business), BASIC (1964), Pascal (1970), C (1972, Dennis Ritchie at Bell Labs), C++ (Bjarne Stroustrup), Python (1991, Guido van Rossum) and Java (1995, James Gosling at Sun Microsystems). Fourth-generation languages (4GL) such as SQL state what result is wanted rather than how to get it, and fifth-generation languages (5GL) such as PROLOG are used in artificial intelligence.

Translators

Every program not in machine code must be translated. An assembler converts assembly language into machine code. A compiler translates the whole high-level program (the source code) at once into machine code (the object code) and lists all errors together; the compiled program then runs fast without the compiler, as with C and C++. An interpreter translates and executes one line at a time and stops at the first error, so it is slower but handy for testing; Python and BASIC are usually interpreted. Java is compiled into bytecode, which the Java Virtual Machine runs on any computer. A linker joins object files into one executable program, and a loader places it in memory to run. A mistake in a program is a bug and removing it is debugging. The terms are popularly linked with Grace Hopper, after a moth was found in 1947 stuck in the Harvard Mark II, a computer she worked on; she also built one of the first compilers.

Algorithms and flowcharts

An algorithm is a finite, step-by-step procedure for solving a problem; the word comes from the name of the ninth-century mathematician al-Khwarizmi. A good algorithm has input, output, definiteness (every step is clear), finiteness (it ends) and effectiveness. A flowchart draws an algorithm as a diagram: an oval marks start or end, a parallelogram input or output, a rectangle a process, a diamond a decision with yes and no branches, arrows the flow, and a small circle a connector. Pseudocode writes the same steps in plain, structured English.

Number systems

The base (radix) of a number system is the number of digits it uses. Binary has base 2 (0 and 1), octal base 8 (0 to 7), decimal base 10 (0 to 9) and hexadecimal base 16 (0 to 9 and A to F, where A is 10 and F is 15). Computers work in binary because electronic circuits have two states, on and off. Octal and hexadecimal are short ways of writing binary, since one octal digit stands for 3 bits and one hexadecimal digit for 4 bits.

Worked conversions

To change decimal to binary, divide by 2 again and again and read the remainders from bottom to top; 25 gives remainders 1, 0, 0, 1, 1, so 25 is 11001. To change binary to decimal, multiply each bit by its place value (1, 2, 4, 8, 16, 32 from the right) and add; 101101 is 32 + 8 + 4 + 1 = 45. For binary to octal, group the bits in threes from the right: 101 101 is 55 in octal. For binary to hexadecimal, group them in fours: 0010 1101 is 2D. Hexadecimal 1A is 1 × 16 + 10 = 26, and the largest 8-bit number, 11111111, is 255 in decimal, FF in hexadecimal and 377 in octal. In binary addition, 1 + 1 = 10 (write 0, carry 1).

Character codes

Letters and symbols are stored as numbers using a code. ASCII (American Standard Code for Information Interchange) is a 7-bit code for 128 characters, in which A is 65, a is 97, the digit 0 is 48 and the space is 32; extended ASCII uses 8 bits for 256 characters. EBCDIC (Extended Binary Coded Decimal Interchange Code) is an 8-bit code made by IBM for its mainframes. Unicode gives a unique number to every character of every script, including Devanagari, and is stored in forms such as UTF-8 and UTF-16; its first 128 characters are the same as ASCII. BCD (Binary Coded Decimal) writes each decimal digit as 4 bits.

Bits, nibbles and bytes

A bit is one binary digit, a nibble is 4 bits (one hexadecimal digit), a byte is 8 bits (one ASCII character) and a word is the group of bits the CPU handles at once. With n bits, 2 to the power n different values can be shown, so one byte can hold 256 values, from 0 to 255.

Key facts

  • 1GL machine language (0s and 1s, no translator); 2GL assembly (mnemonics, assembler); 3GL high-level (FORTRAN, COBOL, C, Java); 4GL (SQL); 5GL (PROLOG, artificial intelligence).
  • FORTRAN (1957) was the first widely used high-level language; COBOL (1959) is for business; C (1972) was written by Dennis Ritchie at Bell Labs; Java (1995) by James Gosling.
  • A compiler translates the whole program at once and the result runs fast; an interpreter translates line by line and stops at the first error; an assembler translates assembly language.
  • Flowchart symbols: oval for start or end, parallelogram for input or output, rectangle for a process, diamond for a decision, small circle for a connector.
  • Decimal 25 = binary 11001; binary 101101 = decimal 45 = octal 55 = hexadecimal 2D.
  • 255 in decimal = 11111111 in binary = FF in hexadecimal = 377 in octal.
  • Bases: binary 2, octal 8, decimal 10, hexadecimal 16 (A = 10 up to F = 15); one octal digit = 3 bits, one hexadecimal digit = 4 bits.
  • ASCII is a 7-bit code for 128 characters (A = 65, a = 97); extended ASCII is 8-bit (256); EBCDIC is IBM's 8-bit code; Unicode covers all scripts including Devanagari.
  • Nibble = 4 bits, byte = 8 bits; n bits can represent 2 to the power n values, so a byte holds 0 to 255.

Quick revision

Languages: machine (1GL), assembly (2GL), high-level (3GL: FORTRAN 1957, COBOL 1959, C 1972, Python 1991, Java 1995), 4GL (SQL), 5GL (PROLOG); assembler, compiler (whole program), interpreter (line by line); algorithm and flowchart symbols; bases 2, 8, 10, 16; 25 = 11001; 101101 = 45 = octal 55 = hex 2D; ASCII 7-bit, 128 characters, A = 65; EBCDIC 8-bit (IBM); Unicode; nibble 4 bits, byte 8 bits.

Practise this topic

All 10 lessons on Computer Knowledge