Вы находитесь на странице: 1из 12

PU11 Computer Science Notes Data Representation

ONE MARK QUESTION AND ANSWERS:

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.

Give an example for non-positional number system Roman number system

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

PU11 Computer Science Notes Data Representation


12. Convert 25(8) to its binary equivalent

010 101
25(8) 010101(2)

13. Find the decimal equivalent of A4(16) Decimal equivalent is obtained by

A 161 4 160
10 16 4 11 (Substitute the value of A ) 160 4

164(10)

14. Convert 010111(2) to octal A:

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

0 10 110 it complement 2s complement 1 0 10 111


19. Find the 1's complement of 1011011(2)

1011011

0100100

Complement each bit

Is complement of 1011011(2) 0100100(2)

PU11 Computer Science Notes Data Representation


20. Add the following binary numbers 1011(2) 0111(2)

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.

16 171 16 10 remainder 11 B 16 0 remainder 10 A


Thus 171(10) AB(16) 25. Convert 1011(2) to decimal.

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

PU11 Computer Science Notes Data Representation


Ones complement technique and Twos complement technique 30. How do you represent a signed data? Signed data is represented by adding another bit to the number in the MSB. If 0 is added to MSB, then it is a positive number, if 1 is added to LSB, then it is a negative number. 31. Why are computer codes useful? Computer codes help us to represent characters in a coded form in the memory of the computer. 32. Name any two popular computer codes. Two popular computer codes ae ASCII and EBCDIC. 33. What is BCD code? Binary Coded which makes use of 4 bits to represent each digit of a number. 34. What is the expansion of ASCII? ASCII stands of American Standard Code for Information Interchange. 35. Give the excess 3 code of 5. First three is added to 5 to get 8 the binary equivalent of 8 is 1000. So 1000 is Excess-3 code. 36. What is Excess-3 code also known as? Excess-3 code is also known as self complementing or reflective code.

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

PU11 Computer Science Notes Data Representation


The face value of 2 is 2 and its Place value is 2 101 20 The face value of 4 is 4 and its Place value is 4 102 400 5. What is the use of binary number system over decimal number system. The digital device cannot process decimal number which contain 10 digits. It is difficult to design device that work with 10 different voltage levels. Hence forth it again needs to be converted to binary digits 0 (low voltage) and 1 (high voltage), which is suitable to represent the two states of the electronic devices. 6. What are the steps in converting from decimal system to any other system? The steps in converting from decimal system to any other system are Step 1 : Divide the decimal number to be converted by the value of new base. Step 2 : Record the remainder from Step 1 as the rightmost digit and quotient. Step 3 : Divide the quotient of the divided number by the new base. Step 4 : Note down the remainder as the next digit. Step 5 : Repeat steps 3 and step 4 until the quotient becomes 0. 7. Convert 1673(10) to hexadecimal.

1673(10) to hexadecimal.
16 1673 16 104 16 6 remainder 9 remainder 8

Thus 1673(16) 689(10) 8. Convert BCD(16) to decimal

BCD(16) B [11 16
2

C 12 16
1

D 13] 16
0

Positional value

B 162 C 161 D 160 11 162 12 161 13 160


11 256 12x16 13 1 2816 192 13
3021(10)

9.

Convert 1111.111(2) to decimal

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)

PU11 Computer Science Notes Data Representation

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)

1s complement of 5(10) 0101(2)


1010(2)

PU11 Computer Science Notes Data Representation


Add: 1010 1010 101000 + 0101 The result is 0101(2) 5(10) 15. Convert 0.752(10) to binary equivalent The binary equivalent of 0.753(10) Integral part
0.504 2 1.008 1 0.008 2 0.016 0 0.016 2 0.032 0 0.032 2 0.064 0

reminder

0.752 2 1.504 1

0.064 2 0.128 0 0.128 2 0.256 0


0.752(10) 0.1100000(2)

16. Add 1111 111.111 and 10000.001 Carry 1 1 1 1 1 1 1. 1 1 1 1 1 1 1 1 1 .1 1 1 + 10000.00 1 1 0 0 1 0 0 0 0 .0 0 0


10010000.000(2)

17. Convert 8 A(16) and 3FE2(16) to their decimal equivalent


(1) 8 A(16) _______(10)

8 A 8 16' 10 160
8 16 10 1

128 10 138(10)
(2) 3FE2(16) ____(10)

3 163 15 162 14 161 2 160 3 40963 15 256 14 16 2 1


12288 3840 224 2 1635(10)

PU11 Computer Science Notes Data Representation


18. Write a note an EBCDIC 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 computer that use EBCDIC for internal representation of characters. The two portion of 4-bit each are called as ZONE and DIGIT portions. 19. Write a note on 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.

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

Complement each bit

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:

PU11 Computer Science Notes Data Representation


101001(2) 10 10 0 1

0 10 110 it complement 2s complement 1 0 10 111

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

---------->

addend 1 ----------> 1001011 addend 2 -----------> Sum 10010

-----------> 1011101

PU11 Computer Science Notes Data Representation


FIVE MARK QUESTIONS AND ANSWERS: 1. FACE(16) ?(2) ?(8) ?10 F A C 12 E (16) 14 Equivalent digit

15 10

FACE(10) ?(2)

Hexadecimal number Binary number

F 1111

A 1010

C 1100

E 1110

FACE(16) 1111101011001110(2) 1111101011001110(2) ?(8)

Binary number Octal number

001 111 101 011 001 110 1 7 5 3 1 6

1111101011001110(2) 175316(8) ?(10)

1 85 7 84 5 83 3 82 1 81 6 80 (1 32,768) (7 4096) (5 512) (3 64) (1 8) (6 1)


32768 28672 2560 192 8 6

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

PU11 Computer Science Notes Data Representation


end-around 10 0 1 +1 0 1 1 1 0 100 + 0101 Thus, the result is 0101 5(10) 1

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

PU11 Computer Science Notes Data Representation


computer that use EBCDIC for internal representation of characters. The two portion of 4-bit each are called as ZONE and DIGIT portions. American standard Code for Information Interchange : Computer handles numeric and alphanumeric data. Alphanumeric data is a combination of numeric and text values. To represent alphanumeric data in the computer, ASCII is used. It a 7bit code , which means it can store 128 code groups. The first 3 bit s are used as zone bits and the last 4 bit indicate the digit. 4. Explain subtraction using 2s complement with an example A: The 2s complement of a binary number is formed by taking the 1s complement of the number and adding 1 to the LBS. the subtraction operation using 2s complement system actually involves the operation of addition. The procedure is as follows. Step1: Negate the subtrahend. This will change the subtrahend to its equivalent value of opposite sign. Step2: Add this to the minuend. The result of this addition will represent the difference between the subtrahend and minuend. Example: Subtract 76(10) from 84(10) Binary 84(10) 1010100(2) minuend Equivalent 76(10) 1001100(2) subtrahend Step: 1: Negate the subtrahend (76(10) ) using 2s complement

1001100(2) 01100111 1 0 110 10 0


1s complement add 1to LSB 2s complement or 76(10)

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