Class 11 Exam  >  Class 11 Notes  >  Textbook - Data Representation, Computer Science (Python), Class 11

Textbook - Data Representation, Computer Science (Python), Class 11 PDF Download

Download, print and study this document offline
Please wait while the PDF view is loading
 Page 1


 37 
 
Data Representation in Computers 
After studying this chapter the student will be able to: 
*Learn about binary, octal, decimal and hexadecimal number systems 
*Learn conversions between two different number systems 
*Understand internal storage encoding of characters: ASCII, ISCII and UNICODE 
Binary Representation of Data 
In order to work with data, the data must be represented inside the computer. Digital 
computers represent data by means of an easily identified symbol called a digit.  
Numbering Systems 
Each number system has a base also called a Radix. A decimal number system is a 
system of base 10; binary is a system of base 2; octal is a system of base 8; and 
hexadecimal is a system of base 16. What are these varying bases? The answer lies in 
what happens when we count up to the maximum number that the numbering system 
allows. In base 10, we can count from 0 to 9, that is,10 digits. 
Number System Base Symbols used 
Binary 2 0,1 
Octal 8 0,1,2,3,4,5,6,7 
Decimal 10 0,1,2,3,4,5,6,7,8,9 
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F  
where A = 10; B = 11; C = 12; D = 13;  
E = 14; F = 15 
 
 
 
Page 2


 37 
 
Data Representation in Computers 
After studying this chapter the student will be able to: 
*Learn about binary, octal, decimal and hexadecimal number systems 
*Learn conversions between two different number systems 
*Understand internal storage encoding of characters: ASCII, ISCII and UNICODE 
Binary Representation of Data 
In order to work with data, the data must be represented inside the computer. Digital 
computers represent data by means of an easily identified symbol called a digit.  
Numbering Systems 
Each number system has a base also called a Radix. A decimal number system is a 
system of base 10; binary is a system of base 2; octal is a system of base 8; and 
hexadecimal is a system of base 16. What are these varying bases? The answer lies in 
what happens when we count up to the maximum number that the numbering system 
allows. In base 10, we can count from 0 to 9, that is,10 digits. 
Number System Base Symbols used 
Binary 2 0,1 
Octal 8 0,1,2,3,4,5,6,7 
Decimal 10 0,1,2,3,4,5,6,7,8,9 
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F  
where A = 10; B = 11; C = 12; D = 13;  
E = 14; F = 15 
 
 
 
 38 
Converting a number from one Base to another: 
Binary to Decimal 
Method to convert Binary to Decimal: 
1.    Start at the rightmost bit. 
2.    Take that bit and multiply by 2
n
 where n is the current position beginning at 0 and 
increasing by 1 each time.  This represents a power of two. 
3.    Sum each terms of product until all bits have been used. 
Example 
Convert the Binary number 101011 to its Decimal equivalent.  
 1 * 2
5
 + 0 * 2
4
 + 1 * 2
3
 + 0 * 2
2 
+
 
1 * 2
1
 + 1 * 2
0
 
 32 + 0 + 8 + 0 +2 + 1 = (43)10 
Example 
Convert the Binary number 1001 to its Decimal equivalent.  
 1 * 2
3
 + 0 * 2
2
 + 0 * 2
1
 + 1 * 2
0
 
 8 + 0 + 0 + 1 = (9)10 
Binary fraction to decimal 
Example 
Convert (11011.101)2  to decimal 
 2
4 
2
3 
2
2 
2
1 
   .
 
2
0 
2
-1 
2
-2 
2
-3 
 1 1 0 1  1 1 0  1 
 = (1 x 2
4
)+
 
(1 x 2
3
)+
 
(0 x 2
2
)+
 
(1 x 2
1
)+
 
(1 x 2
0
)+
 
(1 x 2
-1
)+
 
(0 x 2
-2
)+
 
(1 x 2
-3
) 
 = 16+8+0+2+1+0.5+0+0.125 
 = (27.625)10 
Decimal to Binary 
Method to convert a Decimal number into its Binary equivalent: 
 
 
Page 3


 37 
 
Data Representation in Computers 
After studying this chapter the student will be able to: 
*Learn about binary, octal, decimal and hexadecimal number systems 
*Learn conversions between two different number systems 
*Understand internal storage encoding of characters: ASCII, ISCII and UNICODE 
Binary Representation of Data 
In order to work with data, the data must be represented inside the computer. Digital 
computers represent data by means of an easily identified symbol called a digit.  
Numbering Systems 
Each number system has a base also called a Radix. A decimal number system is a 
system of base 10; binary is a system of base 2; octal is a system of base 8; and 
hexadecimal is a system of base 16. What are these varying bases? The answer lies in 
what happens when we count up to the maximum number that the numbering system 
allows. In base 10, we can count from 0 to 9, that is,10 digits. 
Number System Base Symbols used 
Binary 2 0,1 
Octal 8 0,1,2,3,4,5,6,7 
Decimal 10 0,1,2,3,4,5,6,7,8,9 
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F  
where A = 10; B = 11; C = 12; D = 13;  
E = 14; F = 15 
 
 
 
 38 
Converting a number from one Base to another: 
Binary to Decimal 
Method to convert Binary to Decimal: 
1.    Start at the rightmost bit. 
2.    Take that bit and multiply by 2
n
 where n is the current position beginning at 0 and 
increasing by 1 each time.  This represents a power of two. 
3.    Sum each terms of product until all bits have been used. 
Example 
Convert the Binary number 101011 to its Decimal equivalent.  
 1 * 2
5
 + 0 * 2
4
 + 1 * 2
3
 + 0 * 2
2 
+
 
1 * 2
1
 + 1 * 2
0
 
 32 + 0 + 8 + 0 +2 + 1 = (43)10 
Example 
Convert the Binary number 1001 to its Decimal equivalent.  
 1 * 2
3
 + 0 * 2
2
 + 0 * 2
1
 + 1 * 2
0
 
 8 + 0 + 0 + 1 = (9)10 
Binary fraction to decimal 
Example 
Convert (11011.101)2  to decimal 
 2
4 
2
3 
2
2 
2
1 
   .
 
2
0 
2
-1 
2
-2 
2
-3 
 1 1 0 1  1 1 0  1 
 = (1 x 2
4
)+
 
(1 x 2
3
)+
 
(0 x 2
2
)+
 
(1 x 2
1
)+
 
(1 x 2
0
)+
 
(1 x 2
-1
)+
 
(0 x 2
-2
)+
 
(1 x 2
-3
) 
 = 16+8+0+2+1+0.5+0+0.125 
 = (27.625)10 
Decimal to Binary 
Method to convert a Decimal number into its Binary equivalent: 
 
 
 39 
1. Divide the decimal number by 2. 
2. Take the remainder and record it on the side. 
3. Divide the quotient by 2.  
4.  REPEAT UNTIL the decimal number cannot be divided further. 
5. Record the remainders in reverse order and you get the resultant binary number. 
Example 
Convert the Decimal number 125 into its Binary equivalent.  
 125 / 2 = 62  1 
 62 / 2 = 31  0 
 31 / 2 = 15  1 
 15 / 2 = 7   1 
 7 / 2 = 3   1 
 3 / 2 = 1   1 
 1 / 2 = 0   1 
Answer: (1111101)2 
Converting Decimal fraction to Binary 
Example 
 Convert (0.75)10  to binary 
Multiply the given fraction by 2. Keep the integer in the product as it is and multiply 
the new fraction in the product by 2. Continue the process till the required number of 
decimal places or till you get zero in the fraction part. Record the integers in the 
products from top to bottom. 
 Given fraction 0.75 
 Multiply 0.75 by 2 1.50 
 Multiply 0.50 by 2 1.00 
Reading the integers from top to bottom 0.75 in decimal number system is 0.11 in binary 
number system. 
 
 
Page 4


 37 
 
Data Representation in Computers 
After studying this chapter the student will be able to: 
*Learn about binary, octal, decimal and hexadecimal number systems 
*Learn conversions between two different number systems 
*Understand internal storage encoding of characters: ASCII, ISCII and UNICODE 
Binary Representation of Data 
In order to work with data, the data must be represented inside the computer. Digital 
computers represent data by means of an easily identified symbol called a digit.  
Numbering Systems 
Each number system has a base also called a Radix. A decimal number system is a 
system of base 10; binary is a system of base 2; octal is a system of base 8; and 
hexadecimal is a system of base 16. What are these varying bases? The answer lies in 
what happens when we count up to the maximum number that the numbering system 
allows. In base 10, we can count from 0 to 9, that is,10 digits. 
Number System Base Symbols used 
Binary 2 0,1 
Octal 8 0,1,2,3,4,5,6,7 
Decimal 10 0,1,2,3,4,5,6,7,8,9 
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F  
where A = 10; B = 11; C = 12; D = 13;  
E = 14; F = 15 
 
 
 
 38 
Converting a number from one Base to another: 
Binary to Decimal 
Method to convert Binary to Decimal: 
1.    Start at the rightmost bit. 
2.    Take that bit and multiply by 2
n
 where n is the current position beginning at 0 and 
increasing by 1 each time.  This represents a power of two. 
3.    Sum each terms of product until all bits have been used. 
Example 
Convert the Binary number 101011 to its Decimal equivalent.  
 1 * 2
5
 + 0 * 2
4
 + 1 * 2
3
 + 0 * 2
2 
+
 
1 * 2
1
 + 1 * 2
0
 
 32 + 0 + 8 + 0 +2 + 1 = (43)10 
Example 
Convert the Binary number 1001 to its Decimal equivalent.  
 1 * 2
3
 + 0 * 2
2
 + 0 * 2
1
 + 1 * 2
0
 
 8 + 0 + 0 + 1 = (9)10 
Binary fraction to decimal 
Example 
Convert (11011.101)2  to decimal 
 2
4 
2
3 
2
2 
2
1 
   .
 
2
0 
2
-1 
2
-2 
2
-3 
 1 1 0 1  1 1 0  1 
 = (1 x 2
4
)+
 
(1 x 2
3
)+
 
(0 x 2
2
)+
 
(1 x 2
1
)+
 
(1 x 2
0
)+
 
(1 x 2
-1
)+
 
(0 x 2
-2
)+
 
(1 x 2
-3
) 
 = 16+8+0+2+1+0.5+0+0.125 
 = (27.625)10 
Decimal to Binary 
Method to convert a Decimal number into its Binary equivalent: 
 
 
 39 
1. Divide the decimal number by 2. 
2. Take the remainder and record it on the side. 
3. Divide the quotient by 2.  
4.  REPEAT UNTIL the decimal number cannot be divided further. 
5. Record the remainders in reverse order and you get the resultant binary number. 
Example 
Convert the Decimal number 125 into its Binary equivalent.  
 125 / 2 = 62  1 
 62 / 2 = 31  0 
 31 / 2 = 15  1 
 15 / 2 = 7   1 
 7 / 2 = 3   1 
 3 / 2 = 1   1 
 1 / 2 = 0   1 
Answer: (1111101)2 
Converting Decimal fraction to Binary 
Example 
 Convert (0.75)10  to binary 
Multiply the given fraction by 2. Keep the integer in the product as it is and multiply 
the new fraction in the product by 2. Continue the process till the required number of 
decimal places or till you get zero in the fraction part. Record the integers in the 
products from top to bottom. 
 Given fraction 0.75 
 Multiply 0.75 by 2 1.50 
 Multiply 0.50 by 2 1.00 
Reading the integers from top to bottom 0.75 in decimal number system is 0.11 in binary 
number system. 
 
 
 40 
Example 
Convert (105.15)10  to binary 
Let us convert 105 first. 
 (105)10   = (1101001)2 
Let us convert (0.15) 10 
 Multiply 0.15 by 2 0.30 
 Multiply 0.30 by 2 0.60 
 Multiply 0.60 by 2 1.20 
 Multiply 0.20 by 2 0.40 
 Multiply 0.40 by 2 0.80 
 Multiply 0.80 by 2 1.60 
Reading the integers from top to bottom (0.15)10 = (0.001001)2 
Final result (105.15) 10 = (1101001.001001)2 
Decimal to Octal 
The method to convert a decimal number into its octal equivalent: 
1. Divide the decimal number by 8. 
2. Take the remainder and record it on the side. 
3.  Divide the quotient by 8. 
4. REPEAT UNTIL the decimal number cannot be divided further. 
5. Record the remainders in reverse order and you get the resultant binary 
Example 
Convert the Decimal number 125 into its Octal equivalent.  
 125 / 8 = 15  5 
 15/ 8 = 1              7 
 1/8  =0   1 
 
 
Page 5


 37 
 
Data Representation in Computers 
After studying this chapter the student will be able to: 
*Learn about binary, octal, decimal and hexadecimal number systems 
*Learn conversions between two different number systems 
*Understand internal storage encoding of characters: ASCII, ISCII and UNICODE 
Binary Representation of Data 
In order to work with data, the data must be represented inside the computer. Digital 
computers represent data by means of an easily identified symbol called a digit.  
Numbering Systems 
Each number system has a base also called a Radix. A decimal number system is a 
system of base 10; binary is a system of base 2; octal is a system of base 8; and 
hexadecimal is a system of base 16. What are these varying bases? The answer lies in 
what happens when we count up to the maximum number that the numbering system 
allows. In base 10, we can count from 0 to 9, that is,10 digits. 
Number System Base Symbols used 
Binary 2 0,1 
Octal 8 0,1,2,3,4,5,6,7 
Decimal 10 0,1,2,3,4,5,6,7,8,9 
Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F  
where A = 10; B = 11; C = 12; D = 13;  
E = 14; F = 15 
 
 
 
 38 
Converting a number from one Base to another: 
Binary to Decimal 
Method to convert Binary to Decimal: 
1.    Start at the rightmost bit. 
2.    Take that bit and multiply by 2
n
 where n is the current position beginning at 0 and 
increasing by 1 each time.  This represents a power of two. 
3.    Sum each terms of product until all bits have been used. 
Example 
Convert the Binary number 101011 to its Decimal equivalent.  
 1 * 2
5
 + 0 * 2
4
 + 1 * 2
3
 + 0 * 2
2 
+
 
1 * 2
1
 + 1 * 2
0
 
 32 + 0 + 8 + 0 +2 + 1 = (43)10 
Example 
Convert the Binary number 1001 to its Decimal equivalent.  
 1 * 2
3
 + 0 * 2
2
 + 0 * 2
1
 + 1 * 2
0
 
 8 + 0 + 0 + 1 = (9)10 
Binary fraction to decimal 
Example 
Convert (11011.101)2  to decimal 
 2
4 
2
3 
2
2 
2
1 
   .
 
2
0 
2
-1 
2
-2 
2
-3 
 1 1 0 1  1 1 0  1 
 = (1 x 2
4
)+
 
(1 x 2
3
)+
 
(0 x 2
2
)+
 
(1 x 2
1
)+
 
(1 x 2
0
)+
 
(1 x 2
-1
)+
 
(0 x 2
-2
)+
 
(1 x 2
-3
) 
 = 16+8+0+2+1+0.5+0+0.125 
 = (27.625)10 
Decimal to Binary 
Method to convert a Decimal number into its Binary equivalent: 
 
 
 39 
1. Divide the decimal number by 2. 
2. Take the remainder and record it on the side. 
3. Divide the quotient by 2.  
4.  REPEAT UNTIL the decimal number cannot be divided further. 
5. Record the remainders in reverse order and you get the resultant binary number. 
Example 
Convert the Decimal number 125 into its Binary equivalent.  
 125 / 2 = 62  1 
 62 / 2 = 31  0 
 31 / 2 = 15  1 
 15 / 2 = 7   1 
 7 / 2 = 3   1 
 3 / 2 = 1   1 
 1 / 2 = 0   1 
Answer: (1111101)2 
Converting Decimal fraction to Binary 
Example 
 Convert (0.75)10  to binary 
Multiply the given fraction by 2. Keep the integer in the product as it is and multiply 
the new fraction in the product by 2. Continue the process till the required number of 
decimal places or till you get zero in the fraction part. Record the integers in the 
products from top to bottom. 
 Given fraction 0.75 
 Multiply 0.75 by 2 1.50 
 Multiply 0.50 by 2 1.00 
Reading the integers from top to bottom 0.75 in decimal number system is 0.11 in binary 
number system. 
 
 
 40 
Example 
Convert (105.15)10  to binary 
Let us convert 105 first. 
 (105)10   = (1101001)2 
Let us convert (0.15) 10 
 Multiply 0.15 by 2 0.30 
 Multiply 0.30 by 2 0.60 
 Multiply 0.60 by 2 1.20 
 Multiply 0.20 by 2 0.40 
 Multiply 0.40 by 2 0.80 
 Multiply 0.80 by 2 1.60 
Reading the integers from top to bottom (0.15)10 = (0.001001)2 
Final result (105.15) 10 = (1101001.001001)2 
Decimal to Octal 
The method to convert a decimal number into its octal equivalent: 
1. Divide the decimal number by 8. 
2. Take the remainder and record it on the side. 
3.  Divide the quotient by 8. 
4. REPEAT UNTIL the decimal number cannot be divided further. 
5. Record the remainders in reverse order and you get the resultant binary 
Example 
Convert the Decimal number 125 into its Octal equivalent.  
 125 / 8 = 15  5 
 15/ 8 = 1              7 
 1/8  =0   1 
 
 
 41 
Answer: (175)8 
Converting Decimal fraction to Octal 
Example 
Convert (0.75)10  to Octal 
Multiply the given fraction by 8. Keep the integer in the product as it is and multiply 
the new fraction in the product by 8. Continue the process and read the integers in the 
products from top to bottom. 
 Given fraction 0.75 
 Multiply 0.75 by 8 6.00 
Reading the integers from top to bottom 0.75 in decimal number system is 0.6 in octal 
number system. 
Octal to Decimal 
Method to convert Octal to Decimal: 
1.    Start at the rightmost bit. 
2 .    Take that bit and multiply by 8
n
 where n is the current position beginning at 0 and 
increasing by 1 each time.  This represents the power of 8. 
3.    Sum each of the product terms until all bits have been used. 
Example 
Convert the Octal number 321 to its Decimal  equivalent.  
 3 * 8
2
 + 2 * 8
1
 + 1 * 8
0
  
 192+16+ 1 = (209)10 
Octal fraction to decimal 
Example 
Convert (23.25)8  to decimal 
 
8
1 
8
0  
 .
 
8
-1 
8
-2 
 
 2 3 2 5  
 
 
Read More

FAQs on Textbook - Data Representation, Computer Science (Python), Class 11

1. What is data representation in computer science?
Ans. Data representation in computer science refers to the way in which data is stored and processed in a computer system. It involves converting data into a format that can be easily understood and manipulated by the computer. This includes representing numbers, characters, and other types of data using binary digits (bits) or other encoding schemes.
2. How is data represented in Python?
Ans. In Python, data can be represented using various data types such as integers, floating-point numbers, strings, lists, tuples, dictionaries, and more. For example, integers can be represented using the int data type, and strings can be represented using the str data type. Python provides built-in functions and operators to manipulate and perform operations on these data types.
3. What are the advantages of using binary data representation in computers?
Ans. Binary data representation offers several advantages in computer systems. Firstly, it allows for efficient storage and manipulation of data since computers use binary digits (bits) as their fundamental unit of information. Secondly, binary representation simplifies digital circuit design and electronic communication, making it easier to transmit and process data. Lastly, binary representation enables compatibility and interoperability between different computer systems and architectures.
4. How does data representation affect the performance of a computer system?
Ans. The choice of data representation can significantly impact the performance of a computer system. Efficient data representation can reduce memory usage, minimize processing time, and optimize storage capacity. For example, using a more compact data representation for integers or floating-point numbers can save memory and improve computational efficiency. On the other hand, inefficient data representation can lead to increased memory consumption, slower processing speed, and decreased overall performance.
5. What are some common data representation errors in Python programming?
Ans. In Python programming, common data representation errors include type errors, precision errors, and overflow/underflow errors. Type errors occur when data is used or manipulated inappropriately, such as performing arithmetic operations on incompatible data types. Precision errors can occur when floating-point numbers are not represented accurately due to limitations in their binary representation. Overflow/underflow errors occur when the result of an arithmetic operation exceeds the range of values that can be represented by a data type, leading to incorrect results or program crashes. It is important to handle and manage these errors appropriately to ensure the correctness and reliability of the program.
Download as PDF

Top Courses for Class 11

Related Searches

Summary

,

Computer Science (Python)

,

shortcuts and tricks

,

Textbook - Data Representation

,

MCQs

,

Computer Science (Python)

,

Class 11

,

Previous Year Questions with Solutions

,

Semester Notes

,

study material

,

Free

,

Textbook - Data Representation

,

Objective type Questions

,

Important questions

,

Computer Science (Python)

,

video lectures

,

past year papers

,

Sample Paper

,

Exam

,

Viva Questions

,

Class 11

,

mock tests for examination

,

Extra Questions

,

Class 11

,

practice quizzes

,

pdf

,

ppt

,

Textbook - Data Representation

;