1.

What method does the int datatype use for storing negative numbers?(a) 1’s Complement(b) 2’s Complement(c) 3’s Complement(d) 4’s ComplementThis question was posed to me during a job interview.The above asked question is from Datatypes topic in chapter Arduino Programming of Arduino

Answer»

The correct answer is (b) 2’s Complement

To elaborate: The int DATATYPE STORES 16 bits of data. The way it handles negative numbers is by a method called the 2’s complement WHEREIN a sign bit is added to the binary equivalent of the number and then all the bits are INVERTED and then added by one.



Discussion

No Comment Found

Related InterviewSolutions