What is the difference between COMP and COMP-3?

  1. (A) COMP is a Binary storage format while COMP-3 is Packed decimal format

  2. (B) COMP is a Packed decimal format while COMP-3 is Binary storage format

  3. (C) Both COMP and Comp-3 are Binary storage format

  4. (D) Both COMP and COMP-3 are Packed decimal format.


Correct Option: A

AI Explanation

To answer this question, you need to understand the difference between COMP and COMP-3 data types in COBOL.

Option A) COMP is a Binary storage format while COMP-3 is a Packed decimal format - This option is correct.

  • COMP is a binary storage format used for storing numeric values as binary integers. It uses one byte for each digit of the number.
  • COMP-3, also known as packed decimal or packed numeric, is a format used for storing decimal numbers in a packed format. It uses half a byte (nibble) for each digit of the number, with the last nibble used for storing the sign of the number.

Option B) COMP is a Packed decimal format while COMP-3 is a Binary storage format - This option is incorrect.

  • The statement in this option is reversed. COMP is a binary storage format, not a packed decimal format.

Option C) Both COMP and COMP-3 are Binary storage format - This option is incorrect.

  • COMP-3 is not a binary storage format. It is a packed decimal format.

Option D) Both COMP and COMP-3 are Packed decimal format - This option is incorrect.

  • COMP is not a packed decimal format. It is a binary storage format.

The correct answer is A) COMP is a Binary storage format while COMP-3 is a Packed decimal format. This option is correct because it accurately describes the difference between COMP and COMP-3 data types in COBOL.

Find more quizzes: