{"base":{"id":"cs10-01","subject":"Data representation","title":"Binary and denary","scene":"bin10","steps":[{"mode":"switches","eyebrow":"Why binary?","title":"Billions of tiny switches","body":"A processor contains billions of transistors: switches that are either off (0) or on (1). One switch gives 2 patterns. Add more switches and count how fast the patterns grow.","controls":[{"id":"bits","label":"Number of bits","min":1,"max":8,"step":1,"value":3}]},{"mode":"place","eyebrow":"Place values","title":"Columns that double","body":"In denary, columns are worth 1, 10, 100… In binary each column is worth double the one to its right: 1, 2, 4, 8 … up to 128. Add the columns that hold a 1.","controls":[{"id":"n","label":"Number","min":0,"max":255,"step":1,"value":178}]},{"mode":"tobin","eyebrow":"Denary to binary","title":"Does it fit? Write 1 and subtract","body":"Start at 128. If the place value fits into the number, write 1 and subtract it; otherwise write 0. Move right and repeat until you reach the 1s column.","controls":[{"id":"n","label":"Denary number","min":0,"max":255,"step":1,"value":200}]},{"mode":"div2","eyebrow":"Another method","title":"Keep dividing by 2","body":"Divide by 2 again and again, writing down each remainder (0 or 1). Read the remainders from the bottom up: that is the binary number. Check it agrees with the first method.","controls":[{"id":"n","label":"Denary number","min":1,"max":255,"step":1,"value":37}]},{"mode":"quiz","look":"place","eyebrow":"Check yourself","title":"Read a byte","body":"A sensor sends the byte 01101001 to a computer.","question":"What is 01101001 in denary?","options":["69","105","150"],"answer":1,"right":"Correct. 64 + 32 + 8 + 1 = 105.","wrong":"Not quite. Write 128, 64, 32, 16, 8, 4, 2, 1 above the bits and add the columns with a 1."}],"more":[{"type":"cards","id":"worked","eyebrow":"Worked examples","title":"Step by step","intro":"Always write the place values above the bits. It takes five seconds and prevents most mistakes.","items":[{"tag":"Binary → denary","title":"10110110","body":"128 64 32 16  8  4  2  1\n  1  0  1  1  0  1  1  0\n= 128 + 32 + 16 + 4 + 2\n= 182","code":true},{"tag":"Denary → binary","title":"143","body":"143 ≥ 128 → 1, left 15\n 15 < 64, 32, 16 → 0 0 0\n 15 ≥ 8 → 1, left 7\n  7 ≥ 4 → 1, left 3\n  3 ≥ 2 → 1, left 1\n  1 ≥ 1 → 1, left 0\n= 10001111","code":true},{"tag":"In Python","title":"Converting with code","body":"bin(143)          # '0b10001111'\nint('10001111', 2) # 143\nformat(143, '08b') # '10001111'","code":true},{"tag":"In pseudocode","title":"An algorithm for denary → binary","body":"INPUT Number\nBinary ← \"\"\nWHILE Number > 0\n  Binary ← STRING(Number MOD 2) & Binary\n  Number ← Number DIV 2\nENDWHILE\nOUTPUT Binary","code":true}]},{"type":"cards","id":"mistakes","eyebrow":"Common mistakes","title":"Watch out for these","items":[{"tag":"Mistake","title":"Reading the remainders top to bottom","body":"With the divide-by-2 method the FIRST remainder is the 1s column, so read upwards."},{"tag":"Mistake","title":"\"10 in binary is ten\"","body":"Binary 10 means one 2 and no 1s: two. Say it 'one zero', not 'ten'."},{"tag":"Mistake","title":"Dropping leading zeros in a byte","body":"5 is 101, but as a byte it is 00000101. Questions often want all 8 bits."},{"tag":"Mistake","title":"\"8 bits can store 256\"","body":"8 bits give 256 different patterns, but they run from 0 to 255. The biggest value is 2⁸ − 1."}]},{"type":"cards","id":"method","eyebrow":"Set out your answer","title":"Getting full marks","items":[{"tag":"1 · Show the grid","title":"Place values above, bits below","body":"Even if your final answer slips, a correct grid earns method marks."},{"tag":"2 · Check by reversing","title":"Convert back","body":"Changed 143 into 10001111? Add up its place values: 128 + 8 + 4 + 2 + 1 = 143 ✓."},{"tag":"3 · Explain 'why binary'","title":"Two clear points","body":"\"Computers are made of switches (transistors) with two states, on and off, so data is stored using two digits, 1 and 0.\""}]},{"type":"bars","id":"bits","eyebrow":"Data","title":"How many values can n bits store?","intro":"Each extra bit doubles the number of patterns (stretched scale for the big ones).","items":[{"label":"1 bit","value":5,"display":"2 values","color":"#7c3aed"},{"label":"4 bits","value":15,"display":"16 values","color":"#2f6fdb"},{"label":"8 bits (1 byte)","value":30,"display":"256 values","color":"#0e9aa7"},{"label":"16 bits","value":55,"display":"65 536 values","color":"#1f9d55"},{"label":"32 bits","value":80,"display":"over 4 billion values","color":"#d9a020"},{"label":"64 bits","value":100,"display":"about 18 quintillion","color":"#e0463e"}],"facts":[{"title":"Counting on your fingers","body":"Treat each finger as a bit: up = 1, down = 0. Ten fingers can count from 0 to 1023 in binary instead of just 0 to 10."},{"title":"The 32-bit address problem","body":"The old internet address system (IPv4) uses 32 bits: about 4.3 billion addresses. There are more devices than that now, so IPv6 uses 128 bits."}]},{"type":"cards","id":"deeper","eyebrow":"Go deeper","title":"More than the lesson","items":[{"tag":"History","title":"Binary is older than computers","body":"Gottfried Leibniz described binary numbers in 1703. In 1937 Claude Shannon showed that switching circuits could do logic and arithmetic in binary: the idea behind every computer since."},{"tag":"How it works","title":"What is a transistor?","body":"A transistor is a tiny electronic switch with no moving parts. A small voltage on one connection lets current flow through the other two (1) or blocks it (0). A modern phone chip has over 15 billion of them, each smaller than a virus."},{"tag":"Careers","title":"Who thinks in binary?","body":"Chip designers, embedded-systems engineers (who program washing machines and cars), network engineers working with addresses, and cyber-security analysts reading raw data all use binary daily."},{"tag":"Coming next","title":"Where this leads","body":"Next: hexadecimal, a shorthand for binary. Then binary addition, overflow, shifts and negative numbers."}]},{"type":"cards","id":"challenge","eyebrow":"Challenge yourself","title":"Stretch your brain","intro":"Try each one before opening the card.","items":[{"tag":"Challenge","title":"Without converting, how can you tell if a binary number is odd?","body":"Look at the rightmost bit (the 1s column). Every other column is a multiple of 2, so the number is odd exactly when the last bit is 1. 10110111 is odd; 10110110 is even."},{"tag":"Challenge","title":"What denary number is 11111111, and why is it one less than 256?","body":"128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255.\nAdd 1 more: every column overflows and you get 1 00000000 = 256 = 2⁸. So 11111111 = 2⁸ − 1."}]},{"type":"activities","id":"try","eyebrow":"Try it at home","title":"Binary you can hold","items":[{"title":"Binary cards","time":"15 minutes","need":["8 pieces of card","A pen"],"steps":["Write 1, 2, 4, 8, 16, 32, 64, 128 dots on the cards, one number each.","Lay them in a row with 128 on the left.","Turn cards face up (1) or face down (0) to make 9, 37, 100 and 200.","Write each pattern as a binary number."],"why":"Each card is one bit with its place value. Any number up to 255 can be made in exactly one way.","safety":"No safety risks."},{"title":"Binary bracelet","time":"20 minutes","need":["Beads of two colours","String"],"steps":["Find the code for your initial (capital A = 65, B = 66 …).","Convert it to 8-bit binary.","Thread one colour for 1 and the other for 0.","Ask a friend to decode it."],"why":"Every character in a computer is stored as a binary number like this one.","safety":"Small beads are a choking risk for young children."}]},{"type":"quiz","id":"quiz","eyebrow":"Quiz","title":"Eight more questions","questions":[{"question":"What is binary 1010 in denary?","options":["10","1010","5"],"answer":0,"right":"Correct. 8 + 2 = 10.","wrong":"Not quite. The columns are 8, 4, 2, 1."},{"question":"What is denary 19 in 8-bit binary?","options":["00011001","00010011","00010111"],"answer":1,"right":"Correct. 16 + 2 + 1 = 19.","wrong":"Not quite. Which place values add up to 19?"},{"question":"How many different values can 6 bits store?","options":["12","36","64"],"answer":2,"right":"Correct. 2⁶ = 64.","wrong":"Not quite. Each bit doubles the number of patterns."},{"question":"What is the largest number 4 bits can store?","options":["15","16","8"],"answer":0,"right":"Correct. 1111 = 8 + 4 + 2 + 1 = 15.","wrong":"Not quite. Set all four bits to 1 and add."},{"question":"Why do computers use binary?","options":["It is shorter than denary","Their switches have two states","It uses less electricity"],"answer":1,"right":"Correct. Transistors are either on or off.","wrong":"Not quite. Think about what a computer is built from."},{"question":"What is 1 byte?","options":["4 bits","1024 bits","8 bits"],"answer":2,"right":"Correct. 8 bits make a byte.","wrong":"Not quite. A nibble is 4 bits; a byte is double that."},{"question":"What is binary 11001000 in denary?","options":["200","100","208"],"answer":0,"right":"Correct. 128 + 64 + 8 = 200.","wrong":"Not quite. Add 128, 64 and 8."},{"question":"Which binary number is odd?","options":["10110110","01010101","11111110"],"answer":1,"right":"Correct. Its last bit is 1.","wrong":"Not quite. Look only at the rightmost bit."}]},{"type":"checklist","id":"check","eyebrow":"Self-check","title":"I can…","items":["explain why computers store data in binary","say how many patterns n bits can make (2ⁿ)","write the 8 binary place values from memory","convert binary to denary","convert denary to binary by subtracting place values","convert denary to binary by dividing by 2","check a conversion by working backwards","use the words bit, nibble and byte correctly"]},{"type":"keywords","id":"words","eyebrow":"Key words","title":"Words to know","items":[{"word":"binary","meaning":"Base 2: a number system using only 0 and 1."},{"word":"denary","meaning":"Base 10: our everyday number system."},{"word":"bit","meaning":"A binary digit: 0 or 1."},{"word":"nibble","meaning":"4 bits."},{"word":"byte","meaning":"8 bits."},{"word":"place value","meaning":"What a column is worth. Binary: 1, 2, 4, 8, 16, 32, 64, 128."},{"word":"transistor","meaning":"A tiny electronic switch: on or off."},{"word":"base","meaning":"How many digits a number system uses."},{"word":"convert","meaning":"Change a number from one base to another."},{"word":"MOD and DIV","meaning":"Remainder and whole-number result of a division."}]},{"type":"sources","id":"sources","title":"Sources","items":["BBC Bitesize, GCSE Computer Science: Binary","Isaac Computer Science: Number bases","Computer History Museum: Claude Shannon and switching circuits","Python documentation: built-in functions bin() and int()"]}]},"overlay":null}