PU11 Computer Science Notes - Data Representation
PU11 Computer Science Notes - Data Representation
PU11 Computer Science Notes - Data Representation
1.
Define number system. A number system identifies the system of numbers which we are using to perform our calculations.
2.
How are number systems classified? Number systems are classified as Non-Positional and Positional number systems.
3.
What is the drawback of non-positional number system? In a non-positional number system it is very difficult to represent a large numbers, because there is no definite positional value defined for each digit in a number.
4.
What are the factors on which the effective value of a number is calculated in positional number systems? The effective value is calculated on the factors, the face value of the digit, the place value of the digit and the base of the number system.
5.
What is the base of different number systems? The base of binary system is 2, Octal system is 8, decimal system is 10 and hexadecimal system is 16.
6.
7.
Give an example for positional number system Decimal number system or binary or octal or hexadecimal number system
8.
Define the base (or radix) of the number system The base of the number system defines the total number of different symbols available in the number system.
9.
What is a binary number system? A binary number system is a base-2 system which consists of two digits (or symbol) 0 and 1
10. What is a hexadecimal number system? A hexadecimal number system is a base-16 system this number system consists of 16 symbols, digits 0,1,2,3,4,5,6,7,8,9 and alphabets A,B,C,D,E,F representing values 10,11,12,13,14,15 11. Find the binary equivalent of 18(10)
18(10) 10010(2)
2 18 2 90 2 41 2 20 2 10 01
010 101
25(8) 010101(2)
A 161 4 160
10 16 4 11 (Substitute the value of A ) 160 4
164(10)
010 111 2 7
111 7 010 2
010111(2) 27(8)
15. Expand ASCII American standard code for information interchange 16. What is he expansion of EBCDIC? Extended binary coded decimal interchange code 17. What is 1s complement? The is complement of a binary number is obtained by changing each O to a 1 and each 1 to a O 18. What is 2s complement? Give an example The 2s complement of a number its formed by taking the 1s complement of the number and adding 1 to the least. Significant bit position Ex:
101001(2) 10 10 0 1
1011011
0100100
1011 0 1 1 1 1 0 10
10010(2)
1 1 1 1
21. What is expansion of bit? The expansion of bit is Binary DigIT. 22. Define MSB. MSB stands for Most Significant Bit, it is the bit that has the largest weight in the number. It can also be defined as leftmost bit in the number. 23. Define LSB. LSB stands for Lease Significant Bit, it is the bit that has the lease weight in the number. It can also be defined as rightmost bit in the number. 24. Convert 171(10) to hexadecimal.
1011(2) 1 23 0 22 1 21 1 20 1 8 0 4 1 2 1 1 8 0 2 1 11(10)
26. What is the weight of the LSB of a 8-bit number? The weight of the LSB of an 8-bit number is 0. 27. What is the weight of the MSB of a 16-bit number? The weight of the MSB of an 16 bit number is 15. 28. What is the rules for binary subtraction? The rule for binary subtraction are 0 -0 =0 1 -0 =1 1 -1 =0 0 - 1 = 0 with a borrow from the previous position (column) 29. What are the methods of representing negative integers? There are three different techniques to represent a negative integer. Sign and magnitude representation
TWO MARK QUESTION AND ANSWER: 1. Explain non-positional number system. When counting started human beings used their fingers to count. When ten fingers were not enough he started using stones, pebbles and sticks which indicated values. For example, five objects can be represented as I IIII or * ****. The overall value was the sum of all the individual values of the elements used. Such an approach is called the additive approach or the non positional number system. 2. What is meant by positional number system? A number system in which each symbol has a weight is called positional number system. For example in a positional number system, positional weight is allotted to each digit in the number. 3. Specify the general rule for representing number using positional notation in any number system. The three main factors used for representing the number in positional number system is a) The Face value of the digit. b) The Place value of the digit in the number c) The base of the number system. 4. How is the effective value calculated in positional number system? Explain with an example. Example in the number 427(10) . The base of the number is 0. The face value of 7 is 7 and its Place value is 7 100 7
1673(10) to hexadecimal.
16 1673 16 104 16 6 remainder 9 remainder 8
BCD(16) B [11 16
2
C 12 16
1
D 13] 16
0
Positional value
9.
1 1 1 1 1
2 3 2 2 2 1 2 0 2 1 2 2 2 3
Positional value
1 23 1 22 1 21 1 21 1 22 1 23
8 4 2 1 0.5 0.25 0.125
15.875(10)
10. Write a note on Binary addition. Binary addition is performed in the same manner as decimal addition. However, since binary system has only two digits, the addition table for binary arithmetic consisting of only four entries. The complete table for binary addition is shown in below. 0+0=0 0+1=1 1+0=0 1 + 1 = 0 + a carry of 1 to next higher position (column) 11. Write a note on Binary subtraction. The operation is the same as the one performed in the decimal system of any other system. This operation consists of two steps, which are repeated for each column. In the first we determine whether it is necessary for us to borrow. If the subtrahend (the lower digit) is larger than the minuend (the upper digit), it is necessary to barrow from the column to the left. The table for binary subtraction is 00=0 10=1 11=0 0 1 = 1 with a borrow from the next higher column
12. Write a note on representation of signed number. In the decimal number system we use + or sign before a number to represent its sign. In digital computer system such notation cannot be adopted instead a special technique has been introduced. This is usually done by adding another bit to the number called the sign bit. In general, the common convention which has been adopted is that a 0 in t sign bit represents a positive integer and a 1 in the sign bit represents a negative integer. 13. How do we find the twos complement of a number? The 2s complement of a binary number is formed by taking the 1s complement of the number and adding 1 to the least-significant bit (LSB) position. The general procedure to find twos complement is given by : Twos complement = ones complement + 1 14. Subtract 10(10) 5(10) using is complement A: Binary equivalent 10(10) 1010(2)
5(10) 101(2)
reminder
0.752 2 1.504 1
8 A 8 16' 10 160
8 16 10 1
128 10 138(10)
(2) 3FE2(16) ____(10)
FOUR MARK QUESTION AND ANSWERS: 1. Give the radix of (a) Decimal system system (a) Radix of decimal system = 10 (b) Radix of binary system = 2 (c) Radix of octal system = 8 (d) Radix of Hexadecimal system = 16 (b) Binary system (c) Octal system (d) Hexadecimal
2. Expalin 1's and 2's complement with example. 1's complement : The is complement of a binary number is obtained by changing each O to a 1 and each 1 to a O Example :
1011011
0100100
1's complement of 1011011(2) 0100100(2) 2's Complement : The 2s complement of a number its formed by taking the 1s complement of the number and adding 1 to the least. Significant bit position Ex:
3. What are number system ? What are the different types ? Explain. A number system identifies the system of numbers which we are using to perform our calculations. Number systems are classified as Non-Positional and Positional number systems. Non-positional number system : When counting started human beings used their fingers to count. When ten fingers were not enough he started using stones, pebbles and sticks which indicated values. For example, five objects can be represented as I IIII or * ****. The overall value was the sum of all the individual values of the elements used. Such an approach is called the additive approach or the non-positional number system. Eg: ROMAN NUMBER SYSTEM. Positional number system : A number system in which each symbol has a weight is called positional number system. For example in a positional number system, positional weight is allotted to each digit in the number. Eg : Decimal Number, Octal number.
4. Explain Binary addition in detail with suitable example. Binary addition is performed in the same manner as decimal addition. However, since binary system has only two digits, the addition table for binary arithmetic consisting of only four entries. The complete table for binary addition is shown in below. 0+0=0 0+1=1 1+0=0 1 + 1 = 0 + a carry of 1 to next higher position (column) Example: Add 75(10) and 18(10) in binary 75 (10) = 1001011 (2) 18(10) = 10010(2)
carry
---------->
-----------> 1011101
15 10
FACE(10) ?(2)
F 1111
A 1010
C 1100
E 1110
175316(8) 64206(10)
2. Explain subtraction using 1's complement with an example. The is complement of a binary number is obtained by changing each 0 to a 1 and each 1 to a 0. The subtraction using 1s complement system actually invades the oberation of addition. The procedure is as follows Step: 1 Add the minuend to the 1s complement of the subtrahend. Step:2 Inspect the result obtained in step 1 for an end-around carry. (a) If an end-carry occurs, add 1 to the least significant bit. (b) If an end-carry does not occur, take 1s complement of the number obtained in step -1 and place a negative sign in front
Example: (1) Subtract 4(10) from 9(10) Binary equivalent 4(10) 0100(2) subtrahend
9(10) 1001(2) -minuend
1s complement of subtrahend=1011
10
3. Write a brief note on computer codes. Computer codes are used for internal representation of data in computers. As computer use binary numbers for internal data representation, computer code use binary coding system. In binary coding every symbol that appears in the data is represented by group of bits. The commonly used codes are Binary coded decimal (BCD), Extended binary coded decimal (EBCDIB), American standard code for information interchange (ASCII), Excess- 3 code.
Binary coded decimal (BCD) : BCD is the early and widely used code. In this each digit of the decimal number is independently converted to 4-bit binary number. The BCD equivalent of each decimal digit 47(10) is shown as 0100 0111. Decimal: 0 1 2 3 4 5 6 7 8 9
BCD: 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 In 4-bit BCD only 64 character could be represented which was not sufficient, so it was extended to 6- bit code by adding two zone positions with which it was possible to represent 64 characters. Excess - 3 code : Excess-3, also called XS3, is a non-weighted code used to express decimal numbers. It is another important binary code. The name excess-3 code derived from the fact that each binary code is the corresponding BCD code plus 0011(2) (i.e. decimal 3). It is particularly significant for arithmetic operations a it overcomes the short comings encountered while using the 4-bit BCD code to add two decimal digits whose sum exceeds 9. This code is used in some old computers.
Extended binary coded decimal interchange code : The major problem with the BCD is that only 64 different characters can be represented in it, which was insufficient. Hence it was extended from 6 bit to 8 bit code. This coding system is called Extended Binary Coded Decimal Interchange Code (EBCDIC). EBCDIC code is an 8 bit-code, it can be easily divided into two 4-bit groups. Four bit groups represents 1 hexadecimal digit. Thats why hexadecimal number system is used for memory by
11
Step: 2 Add to minuend 1 0 1 0 1 0 0 +0 1 1 0 1 0 0 0 0 0 1 0 0 0 Discard end-around carry Thus, the result 0001000(2) 8(10)
12