Introduction
The numerals 0 to 9 are commonly used to represent numbers in everyday life, but they are not the only way to represent a number. Numerous number base systems exist, each of which determines which digits are used to represent a number. Denary or decimal (base-10) is the most commonly used number system, but computers also employ binary (base-2) and hexadecimal (hex or base-16) systems. You can do arithmetic calculations and even convert numbers between bases on numbers expressed in different base notations.
Now, we will discuss some questions on number representation.
Question 1: The smallest integer that can be represented by an 8-bit number in 2’s complement form is
Gate CS 2013
- -256
- -128
- -127
- 0
Solution: (B)-128
Explanation:
The range of numbers for n bit 2's complement numbers is -(2(n-1) to +(2(n-1)-1).
Question 2: P is a 16-bit signed integer. The 2's complement representation of P is (F87B)16.The 2's complement representation of 8*P is:
Gate CS 2010
- (C3D8)16
- (187B)16
- (F878)16
- (987B)16
Solution: (A)- (C3D8)16
Explanation:
It's worth noting that the binary representation's most significant bit is 1, implying that the number is negative. The 2's complement of the number is used to determine its value. P is -1925, and 8P is -15400.
We must discover the 2's complement of 8P because it is similarly negative (-15400)
15400 in binary = 0011 1100 0010 1000
2's Complement = (C3D8)16 = 1100 0011 1101 1000
Question 3: Consider the equation (123)5 = (x8)y with x and y is unknown. The number of possible solutions is _____.
GATE-CS-2014
- 1
- 2
- 3
- 4
Solution: (C)-3
Explanation:
1*25+2*5+3*1=38 when converting (123) base 5 to base 10. In decimal, changing x8 base y= x*y+8 When we add them together, we obtain xy+8=38 xy=30 possible combinations =(1,30),(2,15),(3,10), but we have an '8' in x8 thus base y>8 as all three matches the conditions, so total solutions =3 and the answer is (C) part.
Question 4: The possible values of x and y if 73x (in base-x number system) is equal to 54y (in base-y number system) are
GATE CS 2004
- 8, 16
- 10, 12
- 9, 13
- 8, 11
Solution: (D)-8, 11
Explanation:
We can solve it by the converting both to decimals. 3 + 7*8 = 4 + 11*5
Question 5: The 2' s complement representation of the decimal value - 15 is
GATE CS 2008
- 1111
- 11111
- 111111
- 10001
Solution: (D)- 10001
Explanation:
We have -1510 = 1 11112 1's complement of -15 = 1 0000 (Here, 1 represents negative sign) 2's complement of -15 = 1 0001.
Hence, D is the correct choice.
Question 6: Assuming all numbers are in 2's complement representation, which of the following numbers is divisible by 11111011?
GATE CS 2003
- 11100111
- 11100100
- 11010111
- 11011011
Solution: (A)- 11100111
Explanation:
As most significant bit is 1, all numbers are negative. 2's complement of divisor (11111011) = 1's complement + 1 = 00000100 + 1 = 00000101 So the given number is -5 The decimal value of option A is -25.
Question 7: The 2’s complement representation of (−539)10 in hexadecimal is
GATE CS 2001
- ABE
- DBC
- DE5
- 9E7
Solution: (C)- DE5
Explanation:
-53910 = 1 010 0001 10112 ( Leftmost 1 denotes negative ) One's complement = 1 101 1110 0100 Two's complement = 1 101 1110 0101 Converting this two's complement to hexadecimal form, we get DE5. Thus, C is the correct choice.
Question 8: Consider the values A = 2.0 x 1030, B =-2.0 x 1030, C= 1.0, and the sequence
X: =A+B Y: =A+C
X: =X+C Y: =Y+B
executed on a computer where floating-point numbers are represented with 32 bits. The values for X and Y will be
GATE CS 2000
- X = 1.0, Y = 1.0
- X = 1.0, Y = 0.0
- X = 0.0, Y = 1.0
- X = 0.0, Y = 0.0
Solution: (B)- X = 1.0, Y = 0.0
Explanation:
Given 32 bits representation. So, the maximum precision can be 32 bits. Therefore, A + C should make the 31st digit to 1, which is surely outside the precision level of A (it is the 31st digit and not the 31st bit). So, this addition will return the value of A which will be assigned to Y. So, Y + B will return 0.0 while X + C will return 1.0. Note that there is a difference in 2000 and 2*103 representation. The result depends on an available number of digits for the magnitude part. We can not adjust the magnitude in the exponent part. So, option (B) is correct.
Question 9: Consider the equation (43)x = (y3)8 where x and y are unknown. The number of possible solutions is ________.
GATE CS 2015
- 3
- 4
- 5
- 6
Solution: (C) - 5
Explanation:
3 + 4x = 3 + 8y where 0<= y <= 7 and x >= 5 (because the number in base x is 34)
x = 2y and 0 <= y <= 7
The given below are possible solutions:
y = 3, 4, 5, 6, 7
x = 6, 8, 10, 12, 14
Question 10: The following bit pattern represents a floating-point number in IEEE 754 single-precision format 1 10000011 101000000000000000000000 The value of the number in decimal form is
GATE IT 2018
- -10
- -13
- -26
- -56
Solution: (C) -26
Explanation:
In a 32-bit floating-point format, we have three elements to convert the floating-point to decimal: i. sign ii. exponent iii. mantissa The first bit of the binary representation is the sign bit. '1' denotes a negative number, while '0' denotes a positive number. The next 8 bits of binary encoding determine the exponent. 131-127=4 As a result, the exponent of 2 will be 4, resulting in 24=16. For 32-bit floating-point representation, 127 is the only number that exists. Bias is the term for it. 2k-1-1, where 'k' is the number of the bits in the exponent field, determines it. Thus, for an 8-bit conversion, bias equals 3, and for a 32-bit conversion, bias equals 127. (128-1=127) (28-1-1 = 128-1=127) The remaining 24 bits of the binary representation are used to calculate the mantissa. The fractional part of the mantissa is calculated by: 1*(1/2) + 0*(1/4) + 1*(1/8) + 0*(1/16) +.........=0.625. Thus, the mantissa is 1+0.625=1.625. The decimal number is thus given as Sign*Exponent*Mantissa = (-1)*(16)*(1.625) = -26.
Question 11: Zero has two representations in 1) Sign magnitude 2) 1's complement 3) 2's complement d) None of the above.
GATE CS 1999
- Only a
- a and b
- a and c
- a, b, and c
Solution: (B)- a and b
Explanation:
Zero has two representations in sign's magnitude: 1 - MSB is 0, 2 - MSB is 1. Both of these representations have an equal value, that is, 0. Also, zero has two representations in 1's complements: 1 - All bits are Zero. 2 - All bits are 1. So, option (B) is correct.
Question 12: (342)8 is the octal form of an integer. In an 8085-based computer, this would be regarded as an eight-bit integer, with the decimal equivalent of
GATE CS 1998
- 226
- -98
- 76
- -30
Solution: (D)- -30
Explanation:
(342)8=(011100010)2=(11100010)2. If we take this as an 8-bit integer, the first bit becomes the sign bit, and the number is negative because it is "1."
Because 8085 utilises the 2's complement representation for integers, the decimal equivalent is (00011110)= -30
As a result, option (D) is the correct answer.
Question 13: Which of the following options is correct regarding number conversion from a base to another base?
GATE CS Mock 2018
- If a number has k digits in hex, then k/4 digits (bits) can have in binary.
- If a number has k digits in decimal, then roughly k/2 digits can have in binary.
- If a number has k digits base a, then roughly k*loga(b) digits can be in base b?
- None of the above
Solution: (B)- If a number has k digits in decimal, then roughly k/2 digits can have in binary.
Explanation:
If a number has k digits in decimal, then roughly k / (log2(10)) = k/3 digits can have in binary. Only option (B) is false.
Question 14: The IEEE-754 single-precision 32-bit floating-point format, which employs 1 bit for sign, 8 bits for the biassed exponent, and 23 bits for mantissa, is used to express the value of a float type variable. The decimal value of 25.75 is given to a float type variable X. In hexadecimal notation, X is represented as
GATE CS 2018
- 61CD0000
- C1640000
- C1CD0000
- C1CE0000
Solution: (D)- C1CE0000
Explanation:
As the number is negative S bit will be 1
Convert -25.75 into binary 11001.11
Normalize it then : 1.100111 X 24
In Biased Exponent (Add 127) : 4 + 127 = 131 (In binary 10000011)
Mantissa: 100111.....0 (Total 23 bits)
The number is represented in IEEE 754 single-precision format: 1 10000011 10011100000000000000000
For Hexadecimal (Group of Four bits) - 1100 0001 1100 1110 0000 0000 0000 0000
The number becomes C1CE0000.
Question 15: What is the radix of the number if the solution to the quadratic equation x2 − 10x + 31 = 0 is x = 5 and x = 8?
GATE CS Mock 2018
- 10
- 9
- 6
- 13
Solution: (D)- 13
Explanation:
If equation ax2 + bx + c = 0, then sum of roots = -b/a and product of equations = c/a. Given equation x2 − 10x + 31 = 0 and roots are 5 and 8.
Therefore, the sum of roots = -b/a = -(-10)/1 = (10)b = 5b + 8b implies b = 13.
Also, product of roots = c/a = 31/1 = (31)b = 5b * 8b implies b = 13.
Answer is 13.
Question 16: The Octal equivalent of the binary number 1011101011 is :
UGC-NET CS 2017
- 7353
- 1353
- 6598
- 1556
Solution: (B) 1353
Explanation:
First, we'll create a pair of three bits from the LSB: 1 011 101 011. Now convert these bits to decimal, which is
yielding 1353 as the solution. As a result, option (B) is the correct answer.
Question 17: The number of 1's in the binary representation of (3*4096 + 15*256 + 5*16 + 3) are:
ISRO CS 2015
- 8
- 5
- 10
- 36
Solution: (C)- 10
Explanation:
Given expression = 3*4096 + 15*256 + 5*16 + 3
= (2 + 1)*4096 + (8 + 4 + 2 + 1)*256 + (4 + 1)*16 + 2 + 1
= (2 + 1)*212 + (23 + 22 + 2 + 1 )*28 + (22 + 1)*24 + 2 + 1
= (213 + 212) + (211 + 210 + 29 + 28) + (26 + 24) + 2 + 1
As 213 is 1 followed by 12 zeros, 212 is 1 followed by 11 zeros, and so on,
adding all these numbers gives a total of 10 ones.
Question 18: There are 64 digits in the decimal number. What is the amount of bits required to represent it in binary?
- (212.5)10 and (D6.8))16
- (214.2)10 and (D6.8))16
- (214.5)10 and (D6.8))16
- (214.5)10 and (D6.4))16
Solution: (C ) (214.5)10 and (D6.8))16
Explanation:
To answer this question, we'll take the following approach: (326.4)8 = 82 * 3 + 81 * 2 + 80 * 6. (214.5)10 = 8-1 * 4 = 82 * 3 + 81 * 2 + 80 * 6. The decimal representation is 10. Group binary sequence (214.5) = (011010110.100)2 into a group of 4 for hexadecimal representation, i.e. 0 1101 0110. 1000 (0 can be padded after decimal) this is equivalent to- (D6.8)16. As a result, option (C) is the correct answer.
Question 19: Which of the following is the most efficient to perform arithmetic operations on the numbers?
UGC NET CS 2016
- Sign-magnitude
- 9’s complement
- 2’s complement
- 1’s complement
Solution: (C) 2’s complement
Explanation:
The magnitude of a sign is exclusively used for sign convention (MSB is 1, then no is negative, and if 0 then no is positive). The main distinction is that when adding numbers with 1′ s complement, we conduct binary addition first, then add an end-around carry value. However, 2′ s complement requires no carry values and just has one value for zero. A decimal number's 9's complement is obtained by subtracting each of its digits from 9. 9's complement is used to remove an integer using addition, the same as 1's complement. For 0 (i.e., only positive 0), the 2's complement representation is unambiguous, but the Sign-magnitude, 1's complement, and 9's complement representations are ambiguous (i.e., both positive and negative 0). As a result, option (C) is the correct answer.
Question 20: How many different BCD numbers can be stored in 12 switches? (Assume two-position or on-off switches)
ISRO CS 2014
- 212
- (212)-1
- 1012
- 103
Solution: (D) 103
Explanation:
Each decimal number (0-9) is represented by its equivalent binary pattern in the Binary Coded Decimal (BCD) encoding technique (which is generally of 4-bits). A switch may store one bit, either 0 (off) or 1 (on), and each BCD digit uses four bits; therefore, there will be 12/4 = three BCD digits. A BCD digit can be any number between 0 and 9. (a total of 10 possibilities). As a result, there are 12 different potential BCD numbers: = 10 * 10 * 10 = 1000 = 103 As a result, option ( D) is the correct answer.
Must read decimal to binary c++
Frequently Asked Questions
How can information be represented in numbers?
Data is stored in computers using binary, which consists of the digits 0 and 1. In computing, a binary digit, often known as a bit, is the smallest unit of data. A 0 or a 1 is used to symbolise it. Binary numbers are made up of binary digits (bits), such as 1001 in this example.
What are the 3 number representation methods?
For digital number representation, there are numerous sorts of number representation approaches, such as the Binary number system, octal number system, decimal number system, hexadecimal number system, and so on. But the Binary number system is most relevant and popular for representing numbers in the digital computer system.
Why do we use floating-point representation?
Floating-point representation makes numerical computation much easier. You could write all your programs using integers or fixed-point representations, but this is tedious and error-prone.
How can we represent information in a binary format?
Binary is a base-2 number system that uses two mutually exclusive states to represent information. A binary number is made up of elements called bits where each bit can be in one of the two possible states. Generally, we represent them with the numerals 1 and 0.
What is the difference between float and double?
A float has 7 decimal digits of precision and occupies 32 bits. A double is a 64-bit IEEE 754 double-precision floating-point number. 1 bit for the sign, 11 bits for the exponent, and 52 bits for the value. A double has 15 decimal digits of precision and occupies a total of 64 bits.
Also Read - Strong number in c