This section contains carefully selected MCQs and Previous Year Questions with explanations to help students understand concepts and prepare effectively for examinations, interviews, and competitive tests.
Q: 1Which of the following is not a weighted code?
Option A
A weighted code is a binary code in which each bit position has a fixed weight, and the value of a digit is obtained by adding the weights of the bits that are 1.
In the 8421 Code, the weights of the four bits are 8, 4, 2, and 1, and the decimal value is calculated directly from these weights.
E.g.:
BCD (Binary Coded Decimal) is also based on the 8421 code, so it is a weighted code as well.
| DECIMAL | 4-BIT BCD |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
Note:
In BCD, each decimal digit from 0 to 9 is represented using 4 bits. Only 10 combinations are valid from 0000 to 1001. The remaining combinations (1010 to 1111) are invalid. Therefore, BCD is strictly limited to digits 0 to 9.
In Excess-3 Code, we first add 3 to the decimal digit and then convert it into binary. For example, to represent decimal 4, we add 3 and get 7, whose binary form is 0111.
| DECIMAL | BINARY | DECIMAL + 3 | EXCESS-3 CODE |
|---|---|---|---|
| 0 | 0000 | 0+3=3 | 0011 |
| 1 | 0001 | 1+3=4 | 0100 |
| 2 | 0010 | 2+3=5 | 0101 |
| 3 | 0011 | 3+3=6 | 0110 |
| 4 | 0100 | 4+3=7 | 0111 |
| 5 | 0101 | 5+3=8 | 1000 |
| 6 | 0110 | 6+3=9 | 1001 |
| 7 | 0111 | 7+3=10 | 1010 |
| 8 | 1000 | 8+3=11 | 1011 |
| 9 | 1001 | 9+3=12 | 1100 |
Although Excess-3 follows a fixed procedure, the bit positions themselves do not have fixed weights, so it is treated as a Non-Weighted Code.
In Gray code, there are no positional weights at all. Its main feature is that consecutive numbers differ by only one bit.
For example, decimal 2 is 010 in binary but 011 in gray code, and decimal 3 is 011 in binary but 010 in gray code.
RULE FOR GENERATING GRAY CODE:
For example, obtained the gray code for the number 13.
Binary Number : 13 : 1101
| Step | Binary Bits | Gray Bit |
|---|---|---|
| MSB | 1 | 1 |
| Next Bit | 1⊕1 | 0 |
| Next Bit | 0⊕1 | 1 |
| Last Bit | 1⊕0 | 1 |
So Gray code for binary 1101 is 1011.
| Decimal | Gray Code |
|---|---|
| 0 | 000 |
| 1 | 001 |
| 2 | 011 |
| 3 | 010 |
| 4 | 110 |
| 5 | 111 |
| 6 | 101 |
| 7 | 100 |
In Gray code, consecutive numbers (next higher number) differ by only one bit. Means only one bit position changes either from 0 to 1 or from 1 to 0. All other bits remain the same. This property is called the Unit Distance property.
E.g.:
BINARY VS GRAY (3-BIT NUMBERS):
| DECIMAL | BINARY | BITS CHANGED | GRAY CODE | BITS CHANGED |
|---|---|---|---|---|
| 0 | 000 | - | 000 | - |
| 1 | 001 | 1 | 001 | 1 |
| 2 | 010 | 2 | 011 | 1 |
| 3 | 011 | 1 | 010 | 1 |
| 4 | 100 | 3 | 110 | 1 |
| 5 | 101 | 1 | 111 | 1 |
| 6 | 110 | 1 | 101 | 1 |
| 7 | 111 | 1 | 100 | 1 |
We cannot calculate the decimal value by adding bit weights, which shows that Gray Code is not a weighted code.
Here both Excess-3 and Gray Code are Non-Weighted Code, but the most standard and commonly expected answer in exams is GRAY CODE, as it is clearly and purely non-weighted.
Q: 2What is the full form of EBCDIC?
Option D
EBCDIC stands for Extended Binary Coded Decimal Interchange Code. It is an 8-bit character encoding system developed by IBM for representing letters, numbers, punctuation marks, and other special characters in computers.
EBCDIC was primarily used in IBM mainframe and midrange computer systems. It can represent up to 28 (256) different character codes.
| Encoding System | Size | Description |
|---|---|---|
| BCD Binary Coded Decimal | 4 bits | BCD represents each decimal digit from 0 to 9 separately using a 4-bit binary code. |
| ASCII American Standard Code for Information Interchange | 7 bits | ASCII uses 7 bits and provides 128 codes for letters, digits, punctuation marks, and control characters. |
| Extended ASCII | 8 bits | Extended ASCII uses 8 bits and provides 256 possible codes, adding more characters and symbols to the original ASCII set. |
| EBCDIC Extended Binary Coded Decimal Interchange Code | 8 bits | EBCDIC is an 8-bit character encoding system developed by IBM and was mainly used in IBM mainframe and midrange computer systems. |
| Unicode | Variable | Unicode is a universal character standard designed to represent characters from different languages and writing systems around the world. |
| UTF-8 Unicode Transformation Format-8 | 1–4 bytes | UTF-8 is a variable-length Unicode encoding in which a character can use 1 to 4 bytes. It is widely used on the Internet and is backward-compatible with ASCII for the standard ASCII characters. |
| UTF-16 Unicode Transformation Format-16 | 2 or 4 bytes | UTF-16 represents Unicode characters using 2 or 4 bytes and is used in various operating systems, applications, and programming environments. |
| UTF-32 Unicode Transformation Format-32 | 4 bytes | UTF-32 uses a fixed 4 bytes for each Unicode code point, making character indexing straightforward but requiring more storage. |
| ISCII Indian Script Code for Information Interchange | 8 bits | ISCII is an 8-bit character encoding standard designed for Indian scripts, including Devanagari and several other Indian writing systems. |
Q: 3The range of numbers that can be stored in 8-bits, if negative numbers are stored in 2’s complement form is?
Option B
In 2’s complement form, one bit is used as the sign bit and the remaining bits are used to represent the magnitude. For an n-bit 2’s complement number, the range of values that can be represented as -2n−1 to +(2n−1 -1).
Now, for 8 bits, -27 to + (27-1) = -128 to +127
So, the smallest number that can be stored is -128, and the largest number is +127.
Q: 4Which of the following is the representation of decimal number (-147) in 2’s complement notation of a 12-bit machine?
Option C
In a 2’s complement representation, a negative number is obtained by taking the 1’s complement of its positive binary form and then adding 1.
First convert (147)10 to binary and write in 12-bit representation.
(147)10=(000010010011)2
1’s complement of 000010010011 = 111101101100
2’s complement = 111101101100 + 1 = 111101101101
Finally, (-147)10=(111101101101)2
Q: 5What is 6’s complement of (1543)7 of the computer?
Option C
In a number system of base r, the (r-1) complement is found by subtracting each digit from (r-1). Here the number is in base 7. So, r-1 = 7-1 = 6.
Therefore, to find the 6’s complement of (1543)7, subtract each digit from 6.
| Original Digit | Calculation | Result |
|---|---|---|
| 1 | 6-1 | 5 |
| 5 | 6-5 | 1 |
| 4 | 6-4 | 2 |
| 3 | 6-3 | 3 |
Thus, 6’s complement of (1543)7 is (5123)7.
Q: 6How many bits are required to store an ASCII character?
Option A
ASCII (American Standard Code for Information Interchange) is a character encoding scheme used to represent letters, digits, and special symbols in computers. In its original and standard form, ASCII defines 128 different characters.
To represent 128 different characters, we need a minimum number of bits such that 2n=128. Since 27=128, 7 bits are sufficient to store one ASCII character. That is why standard ASCII uses 7 bits per character.
Q: 7What is the representation of (4589)10 in Binary coded Decimal (BCD) form?
Option B
In Binary Coded Decimal (BCD), each decimal digit is represented separately by its 4-bit binary equivalent. Given decimal number: (4589)10. Now convert each digit into 4-bit binary form.
| Decimal Digit | BCD Representation |
|---|---|
| 4 | 0100 |
| 5 | 0101 |
| 8 | 1000 |
| 9 | 1001 |
Therefore, the BCD representation becomes: 0100010110001001
Q: 8Given, √(224)r = (13)r, the value of radix r is?
Option D
A number written with a subscript r means it is expressed in base (radix) r.
First remove the square root by squaring both sides and then convert both numbers into decimal form.
(224)r=(13)2r
Convert each side into decimal:
Left-hand side: (224)r = 2r2+2r1+4r0 = 2r2+2r+4
Right-hand side: (13)r = 1r1+3r0 = (r+3)
After squaring (r+3)2 = r2+6r+9
Now the equation,
= 2r2+2r+4 = r2+6r+9
= 2r2+2r+4-r2-6r-9=0
= r2-4r-5=0
=(r−5)(r+1)=0
=r=5 or r=−1
The r can be either 5 or -1 but the radix cannot be negative and also the largest digit used is 4, so radix must be greater than 4.
Therefore, r=5.
Q: 9The decimal equivalent of the hexadecimal operation (A10+B21) is?
Option A
To find the decimal equivalent of the hexadecimal operation (A10+B21)16, we first convert each hexadecimal number into decimal form and then add the results.
(A10)16 = 10*162+1*161+0*160=2560+16+0 = (2576)10
(B21)16 = 11*162+2*161+1*160=2816+32+1 = (2849)10
Now, adding 2576+2849 = 5425.
Q: 10In order to store floating point numbers in computers using the normalized representation and 32-bit single precision, the number of bits used for exponent and fraction are _______, _________ respectively.
Option D
Computers store real (floating-point) numbers using the IEEE 754 standard. In 32-bit single-precision floating-point representation, the total 32 bits are divided into three parts:
| Field | Number of Bits |
|---|---|
| Sign | 1 |
| Exponent | 8 |
| Fraction (Mantissa) | 23 |
Thank you so much for taking the time to read my Computer Science MCQs section carefully. Your support and interest mean a lot, and I truly appreciate you being part of this journey. Stay connected for more insights and updates! If you'd like to explore more tutorials and insights, check out my YouTube channel.
Don’t forget to subscribe and stay connected for future updates.