Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

An integer overflow is the condition that occurs when the result of an arithmeti

ID: 3810518 • Letter: A

Question

An integer overflow is the condition that occurs when the result of an arithmetic operation, such as multiplication or addition, exceeds the maximum size of the integer type used to store it. If the integer in question is incremented past the maximum possible value, it may wrap to become a very small, or negative number, therefore providing a very incorrect value. It is often a critical security flaw in software.

For example, in a 16-bit integer system, 19458*37=64586. The result is supposed to be 719946, but has more than 16 bits. Therefore, the result is wrapped, i.e. only the least significant 16 bits of the result remain.

Consider in a 32-bit integer system,

(1) Let Z = 0xFEDCBA98. What is the result of Z + 0x10000000 ? Note that the result must be a 32-bit integer, because this is a 32-bit integer system.
(2) Let Y = 0xFEDCBA98. What is the result of Y * 0x10 ? Note that the result must be a 32-bit integer, because this is a 32-bit integer system.
(3) Find "X" that satisfies the following equations.


Please show work

Explanation / Answer

1)

Given Z = 0xFEDCBA98 and we have to add  0x10000000 to Z

0xFEDCBA98 in binary can be written as 1111 1110 1101 1100 1011 1010 1001 1000

0x10000000 in binary can be written as 0001 0000 0000 0000 0000 0000 0000 0000

so the sum will be 1 0000 1110 1101 1100 1011 1010 1001 1000

so the result in 32 bit will be 0000 1110 1101 1100 1011 1010 1001 1000 (249346712 in decimal).

2)

   Y * 0x10 means the result will be a 0 appended to the end of Y hence the result is

FEDCBA980 in binary form

  1111 1110 1101 1100 1011 1010 1001 1000 0000

in 32 bit 1110 1101 1100 1011 1010 1001 1000 0000 (3989547392 in decimal).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote