binary addition

Cards (2)

    • 0 + 0 = 0
    • 1 + 0 = 1
    • 1 + 1 = 10 (binary for denary 2)
    • 1 + 1 + 1 = 11 (binary for denary 3)
    A) 1
    B) 0
    C) 0
    D) 1
    E) 0
    F) 0
    G) 1
    H) 1
    • Overflow error occurs when the result of a calculation requires more bits than r in the available range.
    • eg when using 8 bits, the largest number is 11111111 (255).
    • when the result requires more than eight bits to hold it eg 11111110 (254) + 00000010 (2) = 10000000 (256), requiring 9 bits.
    • when the most significant bit exceeds the available range, it "overflows" Since there's no higher bit position available in this case (8 bits), the overflow bit is discarded. so the result is reduced to 00000000 (0)
    • can cause data corruption, security vulnerability, crashing, incorrect program behaviour