Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction
2.
Frequently Asked Questions
2.1.
How can information be represented in numbers?
2.2.
What are the 3 number representation methods?
2.3.
Why do we use floating-point representation?
2.4.
How can we represent information in a binary format?
2.5.
What is the difference between float and double?
3.
Conclusion
Last Updated: Mar 27, 2024
Easy

Number Representation

Author Aditya Singh
0 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

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 

  1. -256
  2. -128
  3. -127
  4. 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

  1. (C3D8)16
  2. (187B)16
  3. (F878)16
  4. (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. 1
  2. 2
  3. 3
  4. 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

  1. 8, 16
  2. 10, 12
  3. 9, 13
  4. 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

  1. 1111
  2. 11111
  3. 111111
  4. 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

  1. 11100111
  2. 11100100
  3. 11010111
  4. 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

  1. ABE
  2. DBC
  3. DE5
  4. 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

  1. X = 1.0, Y = 1.0
  2. X = 1.0, Y = 0.0
  3. X = 0.0, Y = 1.0
  4. 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

  1. 3
  2. 4
  3. 5
  4. 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

  1. -10
  2. -13
  3. -26
  4. -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

  1. Only a
  2. a and b
  3. a and c
  4. 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

  1. 226
  2. -98
  3. 76
  4. -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

  1. If a number has k digits in hex, then k/4 digits (bits) can have in binary.
  2. If a number has k digits in decimal, then roughly k/2 digits can have in binary.
  3. If a number has k digits base a, then roughly k*loga(b) digits can be in base b?
  4. 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

  1. 61CD0000
  2. C1640000
  3. C1CD0000
  4. 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

  1. 10
  2. 9
  3. 6
  4. 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

  1. 7353
  2. 1353
  3. 6598
  4. 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

  1. 8
  2. 5
  3. 10
  4. 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?

  1. (212.5)10 and (D6.8))16
  2. (214.2)10 and (D6.8))16
  3. (214.5)10 and (D6.8))16
  4. (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

  1. Sign-magnitude
  2. 9’s complement
  3. 2’s complement
  4. 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

  1. 212
  2. (212)-1
  3. 1012
  4. 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

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Conclusion

In this article, we have seen and discussed some gate questions on combinational circuits and learned combinational circuits concepts. We wish that this blog has helped you enhance your knowledge regarding the concepts of Combinational Circuits.

If you want to learn more, check out our article on Boolean Algebra-IMathematical Logic, and K Maps. Propositional and First Order Logic - Part 2Propositional and First Order Logic - Part 3 and Sequential circuits.

 

Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. Enroll in our courses and refer to the mock test and problems available. Take a look at the interview experiences and interview bundle for placement preparations.

Do upvote our blog to help other ninjas grow.

Happy Learning!

Previous article
Sequential circuits Gate Questions
Next article
K Maps
Live masterclass