The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+12 votes

Suppose the domain set of an attribute consists of signed four digit numbers. What is the percentage of reduction in storage space of this attribute if it is stored as an integer rather than in character form?

  1. $\text{80%}$
  2. $\text{20%}$
  3. $\text{60%}$
  4. $\text{40%}$
asked in Digital Logic by Veteran (59.5k points)
edited by | 1.2k views

2 Answers

+22 votes
Best answer
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 $\frac{(5 - 2)}{5} = \frac{3}{5} = 60\%$
answered by Veteran (355k points)
selected by
9999 in binary requires 14 bits. so, 2 bits are remaining and 1 we can use for sign.

I didn't get this please somebody explain.

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

Why are we not using BCD instead of binary?

Arjun sir, here integer size as 2B is an assumption???

Not an assumption - taking the minimum possible size required for an integer for the given problem.

but @ Arjun Sir nowhere maximum reduction is mentioned, so how can we assume only 2B??

If I take 4B, then (5-4)/5 gives 20% savings. How to avoid such dilemma?

And 20 or 60 is maximum? :)
alright sir, thanks!
+3 votes
answer - C

numbers stored as characters

total numbers to be represented 20K

each number represented using 5B

total space required 100KB

numbers stored as integers

every number can be represented using 2B

total space required 40KB

saving 60KB
answered by Loyal (9k points)
You assumed 20K entries to be stored rt?

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

37,996 questions
45,492 answers
48,590 users