Number systems used in computer science: binary, denary, and hexadecimal
Binary number system is based on the number 2, using only the values 0 and 1
Denary number system uses ten separate digits, 0-9, and is known as a base 10 number system
Binary number with eight digits would have headings: 128, 64, 32, 16, 8, 4, 2, 1
Converting binary to denary involves adding the column value each time a 1 appears in a binary number column
Example conversions from binary to denary: 11101110 = 238, 011110001011 = 19314, 0011000111100110 = 12774
Converting denary to binary can be done by successive subtraction of powers of 2 or by successive division by 2
Example conversions from denary to binary: 142 = 10001110, 59 = 00111011, 35000 = 1000100011011000
Converting from binary to hexadecimal involves splitting the binary number into groups of 4 bits and converting each group into the equivalent hexadecimal digit using Table 1.1
Converting from hexadecimal to binary is done by taking each hexadecimal digit and writing down the 4-bit code which corresponds to the digit
Converting from hexadecimal to denary involves multiplying each hexadecimal digit by its heading value (4096, 256, 16, 1) and adding the totals together to get the denary number
Converting from denary to hexadecimal requires successive division by 16 until reaching 0, then reading the remainders in reverse order to get the hexadecimal number
The hexadecimal system uses 16 different 'digits' to represent each value, including numbers 0-9 and letters A-F
A computer can work with binary data, but hexadecimal is more convenient for humans as one hex digit represents four binary digits
Media Access Control (MAC) addresses uniquely identify devices on a network, usually made up of 6 groups of two hexadecimal digits
MAC addresses consist of the manufacturer's identity number and the device's serial number
Internet Protocol (IP) addresses are given to each device connected to a network
Devices made by Cisco 00 – a0 – c9 identify devices made by Intel
Each device connected to a network is given an Internet Protocol (IP) address
An IPv4 address is a 32-bit number written in denary or hexadecimal form
IPv4 has been improved upon by the adoption of IPv6
An IPv6 address is a 128-bit number broken down into 16-bit chunks, represented by a hexadecimal number
HyperText Mark-up Language (HTML) is used when writing and developing web pages
HTML isn’t a programming language but is simply a mark-up language
HTML uses <tags> to bracket a piece of text for example, <h1> and </h1> surround a top-level heading
HTML colour codes are used to represent colours of text on the computer screen
The # symbol always precedes hexadecimal values in HTML code
There are 16,777,216 possible colours represented by 256 values for red, green, and blue
Addition of binary numbers
Binary addition involves carry and sum values
Carrying occurs whenever the sum is greater than 1
Overflow error can occur when the sum exceeds the maximum value that can be stored
Logical binary shifts
Logical shift means moving the binary number to the left or right
Each shift left is equivalent to multiplying the binary number by 2 and each shift right is equivalent to dividing the binary number by 2
There is a limit to the number of shifts that can be carried out if the binary number is stored in an 8-bit register
Shifting the original binary number 00010101 four places left results in losing the left-most 1-bit
In an 8-bit register, the result of 21 × 2^4 is 80, which is incorrect due to exceeding the maximum number of left shifts possible
The denary number 200 in binary is 11001000 in an 8-bit register
Shifting the bits in the register one place to the right results in the left-most bit being lost