TutorChase logo
Login
AQA A-Level Computer Science

5.5.1 Character code vs binary representation

Binary representation and character codes are two distinct methods of representing information in computers. Understanding their differences is essential for accurate data handling in digital systems.

What is binary representation?

Binary representation is the system used by computers to store and process numerical data. It relies on a base-2 number system that only uses two digits: 0 and 1. These digits are known as bits (binary digits), and every piece of information stored in a computer is ultimately broken down into combinations of these two values.

Unlike the decimal system (base-10), which uses ten digits from 0 to 9, the binary system uses powers of two to represent values. Each position in a binary number corresponds to a power of 2, increasing from right to left. The first position represents 2⁰ (which is 1), the second represents 2¹ (which is 2), the third 2² (which is 4), and so on.

Binary representation of whole numbers

To convert a decimal number to binary, determine which powers of 2 add up to the number.

Example: Convert decimal 7 to binary

Step-by-step process:

  • The largest power of 2 less than or equal to 7 is 2² = 4.

  • 7 minus 4 = 3 → next largest power is 2¹ = 2.

  • 3 minus 2 = 1 → next is 2⁰ = 1.

Take your grades to the next level!

UPGRADING TO PREMIUM UNLOCKS
AI Tutor
AI-powered study assistant
instant feedback and guidance
Predicted Papers
Examiner-style predicted papers
based on recent exam trends
Practice Questions
All exam practice questions
by topic for each subject
Study Notes
All detailed revision notes
written by expert teachers
Cheat Sheets
Quick revision summaries
perfect for last-minute review
Past Papers
Complete collection
of practice and past exam papers
Email
Password
Confirm Password
Already have an account?

Practice Questions

FAQ

Character codes for digits in ASCII begin at 48 because the ASCII standard was designed to include a wide range of printable and control characters, each with a unique binary pattern. The codes 0 to 31 are reserved for non-printing control characters (such as newline, backspace, and tab). Codes 32 to 47 are assigned to various punctuation symbols like space, exclamation mark, and parentheses. This means the first available block of codes suitable for digits starts at 48, which is assigned to the character '0'. From there, digits increment in both decimal and binary by 1, so '1' is 49, '2' is 50, up to '9' as 57. This placement allows a logical and consistent grouping of characters, simplifying string manipulation and comparisons. For example, checking if a character is a digit can be done by checking if its ASCII value lies between 48 and 57. This structure is widely used in programming and text encoding systems.

Yes, it is possible for the binary representation of a character to match that of a number by coincidence, but this does not mean they are functionally equivalent. For example, the binary pattern 00000111 could represent the number 7 if interpreted as a numeric value, but there is no ASCII character assigned to ASCII code 7 that is printable—it is a control character known as 'bell'. Similarly, the binary value 00110111 represents both the decimal number 55 and the character '7' in ASCII. If this value is used in a mathematical context, it will be treated as 55; if used in a text context, it will be displayed as '7'. The same binary pattern can represent different types of data depending on context and interpretation, but that does not mean it is intended to be used interchangeably. Correct data handling requires careful type checking and consistent interpretation.

Computers do not inherently know whether a binary pattern represents a number or a character. Instead, the interpretation depends entirely on the context in which the data is being used. Programs, programming languages, and data formats define how to treat specific chunks of binary data. For example, in a string processing function, a binary value like 00110111 will be interpreted as the character '7' based on ASCII. In contrast, in a mathematical calculation, the same binary value may be treated as the integer 55. Variables in programming languages are typically typed (explicitly or implicitly), which informs the processor how to interpret the binary data during operations. Memory itself stores just binary values; it is the instructions executed by the processor and the software logic that determine their type. Misinterpreting the type—treating a character as a number or vice versa—can lead to logic errors, crashes, or corrupted output.

Leading zeros are added to binary numbers to standardise the length of binary representations, typically to match the number of bits allocated for storage, such as 8-bit, 16-bit, or 32-bit values. For instance, the number 7 can be written as 111 in binary, but if we are storing it in an 8-bit system, it becomes 00000111. These leading zeros do not affect the value of the number; they simply ensure that the data fits into the expected format. This standardisation is important for alignment in memory, simplifying arithmetic, bitwise operations, and ensuring consistency in data transmission. However, interpretation of the value still depends on context. For instance, in character encoding, 00110111 represents '7', whereas 00000111 is interpreted as the numeric 7. Leading zeros ensure that binary values conform to fixed-width standards, which is essential in low-level programming, networking protocols, and binary file formats, all of which rely on predictable binary structures.

Yes, both numeric digits and alphabetic characters are stored in consecutive order in ASCII, but they are in separate sections of the ASCII table. The digits '0' to '9' are assigned decimal values 48 to 57, and their binary equivalents range from 00110000 to 00111001. Uppercase alphabetic characters 'A' to 'Z' follow, starting from ASCII code 65 to 90, and lowercase letters 'a' to 'z' start at 97 to 122. This ordering is intentional and was designed to make programming tasks such as looping through letters or digits easier. For example, checking if a character is a digit can be done by verifying if its ASCII code falls between 48 and 57. Similarly, converting a lowercase letter to uppercase can be done by subtracting 32 from its ASCII value. This predictable ordering supports efficient character comparisons, sorting, and conversions, and remains a fundamental feature of ASCII and its extended character encodings.

Hire a tutor

Please fill out the form and we'll find a tutor for you.

1/2
Your details
Alternatively contact us via
WhatsApp, Phone Call, or Email