Aptitude | GATE CS 1998 | Question 55

Suppose the domain set of an attribute consists of signed four digit numbers. What is the percentage rate of reduction in storage space of this attribute if it is stored as an integer rather than in character form?
(A) 80%
(B) 20%
(C) 60%
(D) 40%

Answer: (C)

Explanation: I assume byte addressable memory- nothing smaller than a byte can be used.

We have four digits. So, to represent signed 4 digit numbers we need 5 bytes- 4 for four digits and 1 for the sign (like -7354).
So, required memory = 5 bytes

Now, if we use integer, the largest number needed to represent is 9999 and this requires 2 bytes of memory for signed representation (one byte can represent only 256 unique integers).

So, memory savings while using integer is,

= (5−2)/5
= 3/5
= 60 % 

So, option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up

Improved By : Shubham Kumar 21