Positive Binary Numbers (OCR A Level Computer Science)

Revision Note

Callum Davies

Expertise

Computer Science

Binary

What is Binary?

  • binary refers to a system of representing information using only two digits: 0 and 1.

Bits

  • A bit is the smallest unit of digital information, representing either an "off" (0) or an "on" (1) state.

computer-bit

The status of a computer bit being on or off.

Bytes

  • Bits are grouped into larger structures to form bytes (8 bits), words, and long words

  • These groupings allow us to represent more complex information, like numbers, text, and instructions

bytesandbits

Groups bits to store more complex information

What do the 0s and 1s represent?

  • In binary, each level is based on powers of 2

  • In the 8-bit binary number below, each of the 8 columns represents values of 2n , e.g.

  • 20 = 1

  • 21 = 2

  • 22 = 4

  • 23 = 8

  • 24 = 16

  • 25 = 32

  • 26 = 64

  • 27 = 128

powers-of-two

Binary powers of two

Encoding and representation

  • Various encoding schemes, like ASCII for text or JPEG for images, map these binary values to human-readable forms

  • For example, the binary value 01001000 represents the letter 'H' in ASCII

  • In the example below, an image is shaded black or white depending on the binary value for each pixel

  • Each row in the image requires 1 byte of storage

pixel-shading

Pixel-shading in a bitmap image

Abstraction layers

  • Computers handle large volumes of basic numeric data

  • To create meaningful representations of data, layers of abstraction exist so that basic data can be interpreted upwards into other forms, e.g. images, sound, video

  • The same principle applies to programming languages that compile down into binary code

  • At the bottom, you have binary, and each layer above it allows for more meaningful information to be represented

abstractions-of-binary

Abstractions of binary

Converting Between Binary & Denary

  • Within computer science, two common number systems are:

    • Denary numbers – This is also known as base-10. These are used by humans and consist of 10 digits ranging from 0 to 9

    • Binary numbers - Computer systems store data using 1s and 0s. This is known as binary or base-2. Computer systems store data in binary format because computers are made up of circuits and switches that are either on (1) or off (0)

  • Binary numbers can be converted into denary and vice-versa

  • For example the 8-bit binary number 01101001 can be converted into denary using the following method:

binary-to-decimal

Binary to decimal conversion

Therefore the 8-bit binary number 01101001 is 105 as a denary value.

Converting Between Denary & Binary

  • To convert the denary number 101 to binary, we firstly write out binary number system

128

64

32

16

8

4

2

1

 

 

 

 

 

 

 

 

  • Then we start at the left and look for the highest number that is less than or equal to 101 and if so, place a 1 in that column. Otherwise, place a 0 in the column

  • 128 is bigger than 101 and therefore we place a 0 in that column

  • 64 is smaller than 101 so we place a 1 in that column. 101 - 64 = 37. This now means we have 37 left to find

  • 32 is smaller than 37 so we place a 1 in that column. 37 - 32 = 5. This now means we have 5 left to find

  • 16 is bigger than 5 and therefore we place a 0 in that column

  • 8 is bigger than 5 and therefore we place a 0 in that column

  • 4 is smaller than 5 so we place a 1 in that column. 5 - 1 = 1. This now means we have 1 left to find

  • 2 is bigger than 1 and therefore we place a 0 in that column

  • 1 is equal to the number we have left so we place a 1 in that column

  • 64 + 32 + 4 + 1 = 101. Therefore the denary number 101 in binary is 01100101

128

64

32

16

8

4

2

1

0

1

1

0

0

1

0

1

You've read 0 of your 0 free revision notes

Get unlimited access

to absolutely everything:

  • Downloadable PDFs
  • Unlimited Revision Notes
  • Topic Questions
  • Past Papers
  • Model Answers
  • Videos (Maths and Science)

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Did this page help you?

Callum Davies

Author: Callum Davies

Callum is an experienced teacher of GCSE and A-Level Computer Science. He has 4 years of teaching experience and has detailed knowledge of how to achieve exam success, having marked for OCR A-Level. Callum is now a software engineer and regularly mentors new engineers.