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: 2The 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: 3Which 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: 4What 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: 5How 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: 6What 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: 7Given, √(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: 8The 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: 9In 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 |
Q: 10The least significant bit of the binary number, which is equivalent to any odd decimal number is?
Option B
In the binary number system, the Least Significant Bit (LSB) is the rightmost bit. This bit plays an important role in determining whether a number is odd or even. If the LSB is 0, the number is even. If the LSB is 1, the number is odd.
Now consider any odd decimal number, such as 1, 3, 5, 7, or 9. When these numbers are converted into binary form, they always end with 1.
| Decimal Number | Binary Equivalent | Least Significant Bit (LSB) |
|---|---|---|
| 0 | 0000 | 0 |
| 1 | 0001 | 1 |
| 2 | 0010 | 0 |
| 3 | 0011 | 1 |
| 4 | 0100 | 0 |
| 5 | 0101 | 1 |
| 6 | 0110 | 0 |
| 7 | 0111 | 1 |
| 8 | 1000 | 0 |
| 9 | 1001 | 1 |
Q: 11Given two bytes 10101010 and 01010101. What is the result of AND operation on these two numbers?
Option A
The AND operation works by comparing corresponding bits of two binary numbers. It gives a result of 1 only when both bits are 1, otherwise, it gives 0.
Here, the two bytes are 10101010 and 01010101. If we compare them bit by bit, we notice that at every position one bit is 1 and the other is 0. Therefore, none of the bit pairs produce a 1 when AND is applied.
As a result, all bits in the output become 0, giving 00000000, which is equal to 0 in decimal.
Q: 12Which of the following binary numbers represents an invalid BCD code?
Option D
BCD (Binary-Coded Decimal) represents decimal digits 0 to 9 using 4-bit binary codes.
| Decimal | BCD Code |
|---|---|
| 0 | 0000 |
| 1 | 0001 |
| 2 | 0010 |
| 3 | 0011 |
| 4 | 0100 |
| 5 | 0101 |
| 6 | 0110 |
| 7 | 0111 |
| 8 | 1000 |
| 9 | 1001 |
🔶 BCD Valid Range: 0000 to 1001
🔶 1011 = 11 (which is not a valid decimal digit in BCD)
Q: 13Assuming all numbers are in 2’s complement representation, which of the following numbers is divisible by 11111011?
Option D
In 2’s complement representation, if the Most Significant Bit (MSB) is 1, the number represents a negative value. To find its decimal equivalent, we can use either of the following two correct methods.
In the first method, we subtract the unsigned binary value from 2n, where n is the total number of bits, and then place a negative sign before the result.
In the second, more commonly used method, we first find the 1’s complement of the binary number by inverting all bits, then add 1 to obtain the 2’s complement, and finally convert the result to decimal and assign a negative sign.
First, let us find the value of the divisor:
USING FIRST METHOD:
Given Number : (11111011)2
This is an 8-bit number with MSB = 1, so it is negative.
256-251 = 5 : Value : -5
USING SECOND METHOD:
Given Number : (11111011)2
1’s Complement : 00000100
2's Complement : 00000100 + 1 = (00000101)2
(000000101)2 = 5 : Value : -5
So, the question becomes, which option is divisible by -5? Remember, if a number is divisible by 5, it is also divisible by -5 and a number divisible by -5 must be a multiple of 5.
| OPTION | BINARY NUMBER | MSB | DECIMAL VALUE (2’S COMPLEMENT) | DIVISIBLE BY 11111011 (-5) |
|---|---|---|---|---|
| (A) | 11100100 | 1 | 256-228=28 : -28 | No |
| (B) | 11010111 | 1 | 256-215=41 : -41 | No |
| (C) | 11011011 | 1 | 256-219=37 : -37 | No |
| (D) | 11100111 | 1 | 256-231=25 : -25 | Yes |
Q: 14Binary 101110.11 is equal to -
Option D
| Number System | Value | Conversion Steps |
|---|---|---|
| Binary | 101110.11 | Given, original number. |
| Decimal | 46.75 | Integer: 101110 : 46 Fraction: .11 : 0.75 |
| Octal | 56.6 | Integer: 101110 : 101 110 : 56 Fraction: .11 : .110 : 6 |
| Hexadecimal | 2E.C | Integer: 101110 : 0010 1110 : 2E Fraction: .11 : .1100 : C |
Q: 15The number 1102 in base 3 is equivalent to 123 in which base system?
Option D
The given number is 1102 in base 3. First, convert it into decimal form:
So, the decimal value is 38.
Now we need to find in which base the number 123 is equal to 38. Checking base 5:
Therefore, 123 in base 5 is equal to 1102 in base 3.
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.