Introduction to Computing PDF
Document Details
Uploaded by WellReceivedEpigram622
Tags
Related
- 01-01- تمثيل البيانات (11-23) PDF
- Binary Number System Explained
- Chapter 1 Data Representation & Digital Logic PDF
- Computer Organization and Architecture Lecture 2: Data Representation - Fall 2024 - Mansoura University PDF
- Data Representation Inside Computer PDF
- Computer Fundamentals Lecture Notes PDF
Summary
This document provides an introduction to computing, focusing on various number systems and their applications. It covers data representation in computers, how computers process data, and conversions between different number systems such as binary, octal, and hexadecimal. The document uses examples and diagrams to clarify concepts.
Full Transcript
INTRODUCTION TO Data Representation COMPUTING Week 2 TODAY’S OUTLINE ▪How computer process data? ▪How computer stores data? ▪Data representation in computers ▪Conversion between different number systems INTRODUCTION ▪A bit is a unit of information used in computing and digital communica...
INTRODUCTION TO Data Representation COMPUTING Week 2 TODAY’S OUTLINE ▪How computer process data? ▪How computer stores data? ▪Data representation in computers ▪Conversion between different number systems INTRODUCTION ▪A bit is a unit of information used in computing and digital communications ▪A binary digit can only have one of two values “0” or “1” ▪Can also be represented as logical values “true” or “false” – “on” or “off” ▪A binary digit can convey between zero and one bit of information ▪Punched cards represented encoding of discrete data, each position of punched card carried one bit of information DATA REPRESENTATION ▪Early digital computers represented numbers as decimal (base 10) numeral system ▪Modern computers represent data in binary form ▪The number of bits that a CPU can process in one operation is known as word size ▪A word is a fixed sized piece of data handled as a unit by the instruction set or the hardware of the processor ▪The number of bits in a word is an important characteristic of any specific processor design or computer architecture ▪For example, an 8 bit CPU can directly manipulate integers represented by 8 bits which have a range of 256 (28) discrete integer values DATA REPRESENTATION ▪The memory locations the CPU can directly address is also affected by the integer range of a CPU ▪For example, a CPU uses 32 bits to represent a memory address than it can directly address 232 memory locations ▪CPUs with much larger word sizes (such as 16, 32, 64, even 128-bit) are available ▪Memory consists of millions of storage cells, each store one bit of information ▪Each n-bit group is called word, the ‘n’ describes the word length ▪Memory can be represented as collection of words NUMBER SYSTEM The number system has different bases and the most common of them are the decimal, binary, octal, and hexadecimal. The base or radix of the number system is the total number of the digit used in the number system. Suppose if the number system representing the digit from 0 – 9 then the base of the system is the 10. NUMBER SYSTEM ▪Number systems are the technique to represent numbers in the computer system architecture, every value that you are saving or getting into/from computer memory has a defined number system. ▪The computer architecture supports these numbers systems ▪Binary causes too many bits to be used – shift from binary to octal to hex ▪Hexadecimal allows to use 4x fewer bits making it useful ▪For example 1101 1010 is the 8 bit number which can be expressed a lot more cleaner as equivalent to DA ▪Hexadecimal numbers are used for the coding of microprocessors BINARY NUMBER SYSTEM(0,1) A Binary number system has only two digits that are 0 and 1. Every number (value) represents with 0 and 1 in this number system. The base of binary number system is 2, because it has only two digits. Applications: Binary is found in computer technology. All computer language and programming is based on the 2-digit number system used in digital encoding (is the process of taking data and representing it with discreet bits of information). The most common application for the binary number system can be found in computer technology. All computer language and programming is based on the 2-digit number system used in digital encoding. Digital encoding is the process of taking data and representing it with discreet bits of information. These discreet bits consist of the 0s and 1s of the binary system. OCTAL NUMBER SYSTEM (0-7) The base of octal number system is 8, because it has only 8 digits. Applications: It was used as an ideal abbreviation of binary because the bit size of the CPUs that were used at the time that being 26 and 36 bit. The source code for Linux, mac OS and android along with other operating systems Binary numbers can quickly become long and hard to transcribe without errors. Their octal equivalents are much shorter and easier to remember, and have a straight-forward way of conversion to/from binary. Unix file system permissions have three sets (user, group, others) of three bit permissions (read, write, execute), which is naturally represented in octal. The use of octal numbers has declined as most modern computers no longer base their word length on multiples of three bits HEXADECIMAL NUMBER SYSTEM A Hexadecimal number system has sixteen (16) alphanumeric values from 0 to 9and A to F. Every number (value) represents with 0,1,2,3,4,5,6, 7,8,9,A,B,C,D,E and F in this number system. The base of hexadecimal number system is 16, because it has 16 alphanumeric values. For example, the images you see on your computer screen have been encoded with a binary line for each pixel. If a screen is using a 16-bit code, then each pixel has been told what color to display based on which bits are 0s and which bits are 1s. As a result, 216 represents 65,536 different colors! HEXADECIMAL NUMBER SYSTEM Applications: ▪To define locations in memory. Hexadecimals can characterize every byte as two hexadecimal digits only compared to eight digits when using binary. ▪To define colors on web pages. Each primary color – red, green and blue is characterized by two hexadecimal digits. ▪To represent Media Access Control (MAC) addresses. MAC addresses consist of 12-digit hexadecimal numbers. The format being used is either MM:MM:MM:SS:SS:SS or MMMM-MMSS-SSSS. The first 6 digits of the MAC address represent the ID of the adapter manufacturer while the last 6 digits represent the serial number of the adapter. ▪To display error messages. Hexadecimals are used to define the memory location of the error. This is useful for programmers in finding and fixing errors. DECIMAL TO BINARY CONVERSION Example: Decimal number is 41 Divide the number by 2 to convert it into binary The Binary conversion of number 41 is 101001 4110 = 1010012 SZABIST 12 BINARY TO DECIMAL CONVERSION In the binary number system, the weight of each digit increases by a factor of 2 as shown. Therefore, converting 101100101 would be as given below By adding together ALL the decimal number values from right to left at the positions that are represented by a “1” gives us: (256) + (64) + (32) + (4) + (1) = 35710 or three hundred and fifty seven as a decimal number. SZABIST 13 DECIMAL TO OCTAL CONVERSION Example: Consider decimal number 2980 Divide the number by 8 to convert it into octal 298010 = 56448 SZABIST 14 OCTAL TO DECIMAL CONVERSION Consider below example; 2348 = ?10 The weight of each digit increases by a factor of 8 as shown 264 38 41 = (4*1) + (3*8) + (2*64) = 4 + 24 +128 = 156 2348 = 15610 SZABIST 15 DECIMAL TO HEX CONVERSION Example: Decimal number is 3479 Divide the number by 16 to convert it into hex number 13 is represented as D in Hex number system. Therefore, 3479 = D9716 10 SZABIST 16 HEX TO DECIMAL CONVERSION Consider below example; 9C16 = __________10 The weight of each digit increases by a factor of 16 as shown 916 C1 = (C*1) + (9*16) = (12*1)+ 144 = 12+ 144 = 156 9C16 = 15610 SZABIST 17 BINARY TO OCTAL Consider below example for conversion: 100111002 = __________8 Divide the binary number into 3 digits pair starting from the right as; 010 011 100 041201 041211 140201 Calculate values for 1 – on switch 2 2+1 4 100111002= 2348 2 3 4 SZABIST 18 OCTAL TO BINARY CONVERSION Consider below example for conversion: 2348 = ___________2 2 3 4 010 011 100 2348 = 100111002 SZABIST 19 BINARY TO HEX CONVERSION Consider below example for conversion: 100111002 = __________16 Divide the binary number into 4 digits pair starting from the right as; 1001 1100 18040211 18140201 Calculate values for 1 – on switch 8+1 8+4 100111002= 9C16 9 12 SZABIST 20 HEX TO BINARY CONVERSION For any hex number to be converted into binary find the equivalent in the chart. ABCD16=_______2 A B C D 1010 1011 1100 1101 ABCD16=10101011110011012 SZABIST 21 HEX TO OCTAL CONVERSION First convert hex number into binary Then convert binary into octal Consider this number 9C in base 16 to be converted in base 10 9 C 01001 1100 2 3 4 9C16 = 2348 SZABIST 22 OCTAL TO HEX CONVERSION First convert octal number into binary Then convert binary into hex Consider example octal number 234: 2 3 4 010 011 100 9 C 2348 = 9C16 SZABIST 23 EXERCISE Convert the below in required base; No. of Binary Octal Decimal Hex questions i 100001010111 4127 2135 857 ii 111001010 712 458 1CA iii 101110010011100 56234 23708 5C9C iv 10011010 232 154 9A v 101010010001 5221 2705 A91