Cambridge O Level Computer Science
Cambridge International (CAIE) O-Level Computer Scienceの試験勉強用ノート35件。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=151.
Binary to denary
Write the place values above the bits, then add up the values where there is a 1.
| Place | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|
| Bits | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 1 |
The 1s are in the 128, 16, 4, 2 and 1 places, so the value is 128+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:
- 151≥128, so write 1 in the 128 place. Remainder 151−128=23.
- 23<64, so write 0 in the 64 place.
- 23<32, so write 0 in the 32 place.
- 23≥16, so write 1 in the 16 place. Remainder 23−16=7.
- 7≥8 is false, so write 0 in the 8 place.
- 7≥4, so write 1 in the 4 place. Remainder 7−4=3.
- 3≥2, so write 1 in the 2 place. Remainder 3−2=1.
- 1≥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:
| Binary | Hex | Denary | Binary | Hex | Denary |
|---|---|---|---|---|---|
| 0000 | 0 | 0 | 1000 | 8 | 8 |
| 0001 | 1 | 1 | 1001 | 9 | 9 |
| 0010 | 2 | 2 | 1010 | A | 10 |
| 0011 | 3 | 3 | 1011 | B | 11 |
| 0100 | 4 | 4 | 1100 | C | 12 |
| 0101 | 5 | 5 | 1101 | D | 13 |
| 0110 | 6 | 6 | 1110 | E | 14 |
| 0111 | 7 | 7 | 1111 | F | 15 |
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, and 11010110 is 128+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=47.
The conversion from denary to hexadecimal uses repeated division by 16, keeping the remainders. For 151, 151÷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件あります。上のリストから開けます。
レビュー
文章でのレビューはまだありません。このノートを自分のノートに追加して、最初のレビューを投稿できます。