Binary Codes Viva Questions
Binary Codes Viva Questions, Viva Questions on Binary Codes, Short Questions on Binary Codes, XS-3 Codes Viva Questions, EX-3 Codes Viva Questions, Digital Electronics Viva Questions, Engineering Viva Questions
Short Questions and Answers
Q.1. How are binary codes classified?
Ans. Binary codes are classified as numeric codes and alphanumeric codes.
Q.2. What do you mean by alphanumeric codes?
Ans. Alphanumeric codes are codes which represent alphanumeric information i.e. the letters of the alphabet and decimal numbers as sequence of 0s and 1s.
Q.3. What do you mean by numeric codes?
Ans. Numeric codes are codes which represent numeric information, i.e. only numbers as a series of 0s and 1s.
Q.4. What do you mean by straight binary coding?
Ans. Straight binary coding means writing the numbers in binary number system.
Q.5. What do you mean BCD codes?
Ans. Numeric code used to represent decimal digits are called binary coded decimal (BCD) codes.
Q.6. Why are BCD codes required?
Ans. We are very comfortable with the decimal number system, but digital systems force us to use the binary system. Although the binary number system has many practical advantages and is widely used in digital computers, in many cases it is very convenient to work with decimal numbers especially when communication between man and machine is extensive. Since most of the numerical data generated by man are in decimal numbers, to simplify the communication process between man and machine BCD codes are used.
Q.7. What do you mean by coding?
Ans. The representation of decimal digits and letters by a sequence of 0s and 1s is called coding.
Q.8. What do you mean by a code word?
Ans. A sequence of binary digits which represents a decimal digit is called a code word.
Q.9. What are the two basic types of BCD codes?
Ans. The two basic types of BCD codes are (a) Weighted codes and (b) Non-weighted codes.
Q.10. What do you mean by weighted codes? Give three examples.
Ans. Weighted codes are the codes which obey the position-weighting principle. 8421, 2421, 84-2-1 codes are weighted codes.
Q.11. What are the two types of weighted codes?
Ans. The two types of weighted codes are (a) positively-weighted codes and (b) negatively weighted codes.
Q.12. What do you mean by positively-weighted codes? Give three examples.
Ans. Positively-weighted codes are the codes in which all the weights assigned to the binary digits are positive. 2421, 5211, 8421 codes are positively weighted codes.
Q.13. What do you mean by negatively-weighted codes? Give three examples.
Ans. Negatively-weighted codes are the codes in which some of the weights assigned to the binary digits are negative. 84-2-1, 74-2-1, 631-1 are negatively weighed codes.
Q.14. What is the minimum number of bits required to encode the decimal digits 0 through 9? Justify your answer.
Ans. From 0 to 9 there are 10 bits. With an n-bit code, the maximum number of code words possible is 2n. For a 3-bit code only 8 distinct codes are possible and with a 4-bit code, 16 distinct codes are possible. Since 10-code words are required, therefore, a minimum of 4 bits are required to encode decimal digits 0 through 9.
Q.15. What do you mean by non-weighted codes? Give examples.
Ans. Non-weighted codes are codes which do not obey the position-weighting principle. XS-3 code and 2-out-of-5 code are non-weighted codes.
Q.16. What do you mean by a sequential code? Name two sequential codes.
Ans. A sequential code is one in which each succeeding code word is one binary number greater than its preceding code word. The 8421 and XS-3 codes are sequential codes.
Q.17. Which codes facilitate mathematical manipulation of data?
Ans. Sequential codes facilitate mathematical manipulation of data.
Q.18. What do you mean by self-complementing codes? Give examples.
Ans. A self-complementing code is one in which the code word for 9’s complement of N. i.e. of 9-N can be obtained from the code word of N by interchanging all the 0s and ls. The 2421, 642-3, 84-2-l and XS-3 are self-complementing codes.
Q.19. For a code to be self complementing what must be the sum of all its weights and why?
Ans. For a code to be self-complementing, the sum of all its weights must be 9. This is because whatever may be the weights, 0 is to be represented by 0000 and since in a self-complementing code, the code for 9 is the complement of the code for 0, 9 has to be represented by 1111.
Q.20. Why is the self-complementing property of a code useful?
Ans. In digital circuits subtraction operation is performed using adder circuits. The 9’s complement of a decimal digit is obtained by simply complementing each bit of a digit which makes it easier to perform subtraction operation.
Q.21. What do you mean by cyclic code? What is its other name? Give an example. Mention as applications.
Ans. Cyclic codes are the codes in which each successive code word differs from the preceding one in only one bit position. They are also called unit distance codes. The Gray code is a cyclic code. It is often used for translating an analog quantity such as shaft position into a digital form.
Q.22. Which BCD code is called natural binary code and why?
Ans. The 8421 BCD code is called the natural binary code. It is because the 8, 4, 2 and 1 weights attached to it represent natural binary weights.
Q.23. What are the advantages and disadvantages of the 8421 BCD code?
Ans. The main advantage of the 8421 BCD code is its ease of conversion to and from decimal. It is a weighted code and is also sequential. Therefore, it is used for mathematical operations. The disadvantages are
- it is less efficient than the pure binary in the sense that it requires more bits
- the arithmetic operations are more complex in BCD than they are in pure binary
- the rules of binary addition and subtraction do not apply to the 8421 number, but only to the individual 4-bit groups.
Q.24. How is BCD addition performed?
Ans. The BCD addition is performed by individually adding the corresponding digits of the decimal numbers expressed in 4-bit binary groups starting from the LSD. If there is a carry out of one group to the next group, or if the result is an illegal code, then 610 (0110) is added to the sum term of that group and the resulting carry is added to the next group (this is done to skip the 6 illegal states).
Q.25. How is BCD subtraction performed?
Ans. The BCD subtraction is performed by subtracting the digits of each 4-bit group of the subtrahend from the corresponding 4-bit group of the minuend in binary starting form the LSD. If there is a borrow from the next group, then 610 (0110) is subtracted from the difference term of this group (this is done to skip the 6 illegal states).
Q.26. How many illegal states does each one of the 4-bit BCD codes have?
Ans. Each one of the 4-bit BCD cods has 6 illegal states.
Q.27. What do you mean by an invalid (illegal) state? Give examples.
Ans. An invalid state is a state which does not actually exist. For example, to encode decimal digits 0-9, we require a 4-bit word, 4-bits can be combined in 24 = 16 possible ways. Out of these 16 states, 10 are used to represent the decimal digits. The remaining are invalid states. For 8421 BCD code 1010, 1011, 1100, 1101, 1110 and 1111 are invalid states.
Q.28. What is an XS-3 code?
Ans. An XS-3 code is a BCD code in which each binary code word is the corresponding 8421 code plus 0011.
Q.29. How is addition performed in XS-3 code?
Ans. To add in XS-3, add the XS-3 numbers by adding the 4-bit groups in each column starting from the LSD. If there is no carry out from the addition of any of the 4-bit groups, subtract 0011 from the sum term of those groups (because when two decimal digits are added in XS-3 and there is no carry, the result is in excess-6). If there is a carry out, add 0011 to the second term of those groups (because when there is a carry, the 6 invalid states are skipped and the result is in normal binary).
Q.30. How is subtraction performed in XS-3?
Ans. To subtract in XS-3, subtract the XS-3 numbers by subtracting each 4-bit group of the subtrahend from the corresponding 4-bit group of the minuend starting from the LSD. If there is no borrow from the next 4-bit group, add 0011 to the difference term of such groups (because when decimal digits are subtracted in XS-3 and there is no borrow, the result is in normal binary). If there is a borrow, subtract 0011 from the difference term (because taking a borrow is equivalent to adding 6 invalid states, so, the result is in excess-6).
Thanks for the post.