Multiple choice technology programming languages

"05 X PIC 99 VALUE 10. SUBTRACT 20 FROM X. DISPLAY X The result would be?"

  1. 1}

  2. It will give error

  3. 10

  4. -10

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

X is defined as PIC 99 (2-digit integer). When SUBTRACT 20 FROM X executes, X starts at 10, and 10 - 20 = -10. Since PIC 99 cannot hold negative values, COBOL truncates/ignores the sign, resulting in 10. No error occurs - this is how COBOL handles overflow in unsigned fields.