Suppose the domain set of an attribute consists of signed four-digit numbers.…

1998

Suppose the domain set of an attribute consists of signed four-digit numbers. Assuming one byte per character and the minimum whole-byte signed-integer representation sufficient for this domain, what is the percentage reduction in storage space for this attribute if it is stored as an integer rather than in character form?

Answer: C. 60%ConceptTo compare two storage representations, find the bytes required by each and measure the saving relative to the original representation: percentage…

  1. A.

    80%

  2. B.

    20%

  3. C.

    60%

  4. D.

    40%

Attempted by 185 students.

Show answer & explanation

Correct answer: C

Concept

To compare two storage representations, find the bytes required by each and measure the saving relative to the original representation: percentage reduction = (original size − new size) ÷ original size × 100. For a domain of N distinct values, the minimum bit width is b = ⌈log2 N⌉, and the minimum whole-byte storage is ⌈b ÷ 8⌉ bytes. A fixed-width character representation uses one byte per stored character.

Application

  1. A signed four-digit decimal value uses four digit characters and one sign character. At one byte per character, its character representation occupies 5 bytes.

  2. The domain −9999 to +9999 contains 19,999 values. Because 214 = 16,384 patterns are too few but 215 = 32,768 patterns are enough, the domain requires at least 15 bits; the minimum whole-byte representation is therefore 2 bytes. A 16-bit signed integer covers −32768 to +32767.

  3. The saving per value is 5 − 2 = 3 bytes.

  4. The percentage reduction is (3 ÷ 5) × 100 = 60%.

Cross-check

The integer form retains 2 ÷ 5 = 40% of the character storage, so the reduction is 100% − 40% = 60%. This independently matches the direct saving calculation. The calculation uses the minimum whole-byte signed-integer representation needed for the stated domain; a platform-fixed integer width would be a separate implementation assumption.

Result

The storage-space reduction is 60%.

Explore the full course: Iocl Engineers Officers Grade A Paper 2

Loading lesson…