Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/thegatebook.in/public_html/qa/qa-include/qa-theme-base.php on line 177

# CO-Grand Test -Q3

Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/thegatebook.in/public_html/qa/qa-include/qa-theme-base.php on line 177
+1 vote

In a certain implementation of strings, characters are 8 bits long and words are 36 bits long. Characters are packed into double words so that no space is lost. How many words of memory does a k-character string require? (If the string does not occupy an integral number of double words, enough binary zeros are appended to reach the next single word boundary.)

(A).

(B).

(C).

(D). asked Jun 14, 2020
reshown Jun 18, 2020

Char size = 1 Byte

Word size = 36 bits

Double word size = 72 bits = 9 Bytes.

Characters are packed into double words so that no space is lost (because 36 bits is Not a multiple of 8 But 72 is a multiple of 8)

If the string does not occupy an integral number of double words, enough binary zeros are appended to reach the next single word boundary. This means that memory is word aligned i.e. Next string starts at the beginning of a new word.

For example, if K=1 i.e. One character string S then we need to start next string from next word onwards and for this string S, we need to append zeroes to make it reach the next single word boundary. So, when K=1 then we need 1 word.

So, for K=1, answer will be 1. Hence we can eliminate option A,B,C. So, answer is option D.

Option C would be true if the memory was "double word aligned". In that case, for K=1, we would need 2 words. answered Jun 18, 2020 by (226,240 points)