Docsity

chapter 1 data representations, Study notes of Computer science

Partial preview of the text

Download chapter 1 data representations and more Study notes Computer science in PDF only on Docsity!

Information

Representation

and Multimedia

Shanza Khan Shahani

Computer Science

Number system Use of Binary in Computers: ā— Any form of data needs to be converted to binary to be processed by a computer. ā— The basic building block in all computers is the binary number system which consists of 1’s and 0’s only. ā— The data is processed using logic gates(AND, OR, XOR, NOT, NAND, NOR and XNOR) and stored in registers. ā— These switches make use of logic gates and are used to store & process data. ā— A switch in the ON position is represented by 1 and a switch in the OFF position is represented by 0 in binary.

Binary, Denary & Hexadecimal Systems:

  1. The binary system; (0,1)
  2. The denary system; (0-9)
  3. The hexadecimal system; (0-9, A-F)
  1. The Binary System: The numbers in this form are said to be in base 2 as only two values 0 and 1 are used to represent each digit; they are called binary numbers. Any positive integer (whole number) can be easily represented in binary by a sequence of 0's and 1's. This means that it counts in multiples of 2 giving us the headings such as 2^0, 2^1, 2^2 and so on
  1. The Denary System: The numbers in this form are said to be in base 10 as ten values 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 are used to represent each digit; they are called denary numbers. This means that it counts in multiples of 10 giving us the headings such as 10^0, 10^1, 10^2, 10^3 and so on.

Example:

Let's take the number 4829 as an example. Breaking Down the Digits: ā— 9 is in the 1's place. ā— 2 is in the 10's place. ā— 8 is in the 100's place. ā— 4 is in the 1000's place. Expressing it Mathematically: Using Place Values: (4Ɨ1000)+(8Ɨ100)+(2Ɨ10)+(9Ɨ1)=4000+800+20+9= (4Ɨ1000)+(8Ɨ100)+(2Ɨ10)+(9Ɨ1)=4000+800+20+9=

The binary number system works exactly the same way as the denary system, except that it contains only two digits, 0 and 1. For example, to figure out the value of binary number 1101, you use the similar method described above but with a base of 2 instead of 10 (which means that increasing powers of 2 from right-handside to the left-hand side instead of powers of 10). (1 x 8) + (1 x 4) + (0 x 2) + (1 x 1) = 8 + 4 + 0 + 1 = 13

Conversions: (i) Binary to Denary:

  1. First, draw a table like the ones above.
  2. On top of the table, simply write the powers of 2 starting from right to left in an increasing order.
  3. The binary number given to you is written underneath the powers.
  4. The powers of 2 above binary number ā€œ1ā€ are taken into consideration and those above ā€œ0ā€ are simply ignored.
  5. The powers of 2 above ā€œ1ā€ are all written and added together to obtain the denary number.

Examples: ā— The maximum binary number length for conversion to be used in this syllabus is 16-bit. ā— Convert (11101110) 2 to denary [8-bit]:

Conversions: II. Denary to Binary: This method involves successive division by 2; the remainders are then written from bottom to top to give the binary value.

  • Why is data always stored as binary in computers? The computer uses transistors/logic circuits. As a result, they can only store data in 2 states that are ON and OFF which are represented by binary digits 1 and 0. Exam Styles Questions: ā— Question 1: Explain the difference between binary number system and denary number system. (4)

Answer: