What is the representation of COMP variable ?
-
Binary storage
-
Packed Decimal
-
Hexa decimal
-
Decimal
Reveal answer
Fill a bubble to check yourself
A
Correct answer
Explanation
In COBOL, COMP (or COMPUTATIONAL) usage specifies binary storage format for numeric data items. This provides efficient computational storage as opposed to character-based DISPLAY format or packed decimal COMP-3 format.
AI explanation
In COBOL, a field defined with USAGE COMP (computational) is stored in binary format rather than as printable characters, which makes arithmetic operations on it faster and more compact than DISPLAY (character/decimal) storage. This is why COMP is chosen for counters and fields used heavily in calculations, as opposed to COMP-3 (packed decimal) or plain decimal/display formats.