Back to 课程

Computer-Science-A-level-Ocr

0% Complete
0/0 Steps
  1. 3-3-networks
    8 主题
  2. 3-2-databases
    7 主题
  3. 3-1-compression-encryption-and-hashing
    4 主题
  4. 2-5-object-oriented-languages
    7 主题
  5. 2-4-types-of-programming-language
    4 主题
  6. 2-3-software-development
    5 主题
  7. 2-2-applications-generation
    6 主题
  8. 2-1-systems-software
    8 主题
  9. 1-3-input-output-and-storage
    2 主题
  10. 1-2-types-of-processor
    3 主题
  11. 1-1-structure-and-function-of-the-processor
    1 主题
  12. structuring-your-responses
    3 主题
  13. the-exam-papers
    2 主题
  14. 8-2-algorithms-for-the-main-data-structures
    4 主题
  15. 8-1-algorithms
    10 主题
  16. 7-2-computational-methods
    11 主题
  17. 7-1-programming-techniques
    14 主题
  18. 6-5-thinking-concurrently
    2 主题
  19. 6-4-thinking-logically
    2 主题
  20. 6-3-thinking-procedurally
    3 主题
  21. 6-2-thinking-ahead
    1 主题
  22. 6-1-thinking-abstractly
    3 主题
  23. 5-2-moral-and-ethical-issues
    9 主题
  24. 5-1-computing-related-legislation
    4 主题
  25. 4-3-boolean-algebra
    5 主题
  26. 4-2-data-structures
    10 主题
  27. 4-1-data-types
    9 主题
  28. 3-4-web-technologies
    16 主题
课 Progress
0% Complete

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

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注