ข้ามไปยังเนื้อหา
cookie

Cambridge O Level Computer Science

O-Level · Cambridge International (CAIE)Computer Science35 โน้ต ใน 10 โฟลเดอร์, 169 KB

โน้ตทบทวน 35 รายการสำหรับ Cambridge International (CAIE) O-Level Computer Science สร้างโดย cookie แบ่งเป็น 10 ส่วนตามหัวข้อของหลักสูตร

Notes for Cambridge O Level Computer Science (2210), in folders for the syllabus's ten topics in its order, with one note per sub-topic or small group of them. Pseudocode uses the subject's standard layout. Follows the syllabus for 2026, 2027 and 2028 (version 6, September 2026).

มีอะไรอยู่ข้างใน

โน้ตรายการแรก

Data representation / Number systems and conversions

Everything a computer holds is stored as binary, so the other two systems matter only because people use them. Denary (base 10) is the everyday system, with ten digits, 0 to 9, and each place is worth ten times the place to its right. Binary (base 2) has two digits, 0 and 1, and each place is worth twice the place to its right. Hexadecimal (base 16) has sixteen digits, 0 to 9 followed by A to F, where A stands for ten and F for fifteen, and each place is worth sixteen times the place to its right.

In an 8-bit binary number the place values are 128, 64, 32, 16, 8, 4, 2 and 1. A value is the sum of the places that hold a 1, which is why 10010111 means 128+16+4+2+1=151128 + 16 + 4 + 2 + 1 = 151.

Binary to denary

Write the place values above the bits, then add up the values where there is a 1.

Place1286432168421
Bits10010111

The 1s are in the 128, 16, 4, 2 and 1 places, so the value is 128+16+4+2+1=151128 + 16 + 4 + 2 + 1 = 151.

The same method works for any length of binary number. The places double each time, so the 16-bit place values run from 32768 down to 1.

Denary to binary

Work from the largest place value downwards. If the place value fits into what is left, write a 1 and subtract it; otherwise write a 0. To convert 151:

  1. 151≥128151 \geq 128, so write 1 in the 128 place. Remainder 151−128=23151 - 128 = 23.
  2. 23<6423 < 64, so write 0 in the 64 place.
  3. 23<3223 < 32, so write 0 in the 32 place.
  4. 23≥1623 \geq 16, so write 1 in the 16 place. Remainder 23−16=723 - 16 = 7.
  5. 7≥87 \geq 8 is false, so write 0 in the 8 place.
  6. 7≥47 \geq 4, so write 1 in the 4 place. Remainder 7−4=37 - 4 = 3.
  7. 3≥23 \geq 2, so write 1 in the 2 place. Remainder 3−2=13 - 2 = 1.
  8. 1≥11 \geq 1, so write 1 in the 1 place. Remainder 0.

The result is 10010111. Every bit is a decision, and the remainder always tells you what is still to be written.

Values in an 8-bit register run from 0 to 255. A denary number above 255 cannot be stored in one register, which matters when binary addition is worked through in the note on binary addition and overflow.

Hexadecimal

Hexadecimal is used because one hexadecimal digit stands for exactly four binary digits. A group of four bits is called a nibble, and it has sixteen possible values, which are the sixteen hexadecimal digits:

BinaryHexDenaryBinaryHexDenary
000000100088
000111100199
0010221010A10
0011331011B11
0100441100C12
0101551101D13
0110661110E14
0111771111F15

To convert binary to hexadecimal, split the bits into nibbles from the right and read each nibble from the table. The binary number 11010110 splits into 1101 and 0110, which are D and 6, so the hexadecimal value is D6. To check, D6=13×16+6=214\mathrm{D6} = 13 \times 16 + 6 = 214, and 1101011011010110 is 128+64+16+4+2=214128 + 64 + 16 + 4 + 2 = 214 in denary.

To convert hexadecimal to binary, replace each digit by its four bits. The value 2F becomes 0010 1111, which is 00101111. Its denary value is 2×16+15=472 \times 16 + 15 = 47.

The conversion from denary to hexadecimal uses repeated division by 16, keeping the remainders. For 151, 151÷16=9151 \div 16 = 9 remainder 7, and 9 is 9 and 7 is 7, so the answer is 97 in hexadecimal. This agrees with the nibble method, because 1001 0111 splits into 1001 and 0111.

Why the systems are used together

Hexadecimal is shorter than binary and easier to read and copy without mistakes. A long binary string of 32 digits becomes eight hexadecimal digits, and a single mistake in the middle is easier to spot. Hexadecimal is used where a person reads or types a binary value directly: memory addresses, the bytes of a file opened in an editor, the colours of web pages, and the MAC addresses of network cards in the note on network hardware. Denary is used when a person needs to think about the size of a value, and binary is what the hardware itself works with.

Converting between the three systems is worth practising in both directions, because a question will ask for the conversion one way and expect the working the other way. Checking the answer by converting it back is the quickest way to catch a slip.

และอีก 34 รายการ: เปิดรายการใดก็ได้จากรายการด้านบน

รีวิว

ยังไม่มีรีวิวที่เขียนไว้ เพิ่มโน้ตเหล่านี้ลงในของคุณ แล้วคุณจะเป็นคนแรกที่เขียนรีวิว