Examveda
Examveda

If integer needs two bytes of storage, then maximum value of an unsigned integer is

A. 216 – 1

B. 215 – 1

C. 216

D. 215

E. None of these

Answer: Option A

Solution(By Examveda Team)

An integer is a number with no fractional part; it can be positive, negative or zero. In ordinary usage, one uses a minus sign to designate a negative integer. However, a computer can only store information in bits, which can only have the values zero or one. We might expect, therefore, that the storage of negative integers in a computer might require some special technique. As you might imagine, an unsigned integer is either positive or zero. Consider a single digit decimal number: In a single decimal digit, you can write a number between 0 and 9. In two decimal digits, you can write a number between 0 and 99, and so on. Since nine is equivalent to 101 - 1, 99 is equivalent to 102 - 1, etc. In n decimal digits, you can write a number between 0 and 10n - 1. So, analogously, in the binary number system, An unsigned integer containing n bits can have a value between 0 and 2n - 1 (which is 2n different values).

This Question Belongs to C Program >> C Fundamentals

Join The Discussion

Comments ( 4 )

  1. Somnath Sardar.
    Somnath Sardar. :
    6 years ago

    How???

  2. Dakshika Erangi
    Dakshika Erangi :
    7 years ago

    PLS EXPLAIN THIS

  3. Dakshika Erangi
    Dakshika Erangi :
    7 years ago

    PLS EXPLAIN THIS

  4. Surabhi Nalamwar
    Surabhi Nalamwar :
    7 years ago

    please explain the answer of this question
    i dont understand

Related Questions on C Fundamentals