Tag: mainframe

Questions Related to mainframe

  1. No Blocks

  2. Block size is unlimited

  3. The block size is determined at run time from the DD parameters

  4. The block size is determined at compile time from the DD parameters


Correct Option: C
  1. It marks the end of certain Procedure Division statements.

  2. It marks the end of certain looping condition statements.

  3. It marks the end of program.

  4. There is nothing like EXPLICIT SCOPE TERMINATOR in COBOL


Correct Option: A
  1. Alphanumeric

  2. Numeric

  3. Alphabetic

  4. all the above


Correct Option: D
  1. 1-6 and 7-72

  2. 8-11 and 12:72

  3. 1-15 and 16:80

  4. None of the above


Correct Option: B

What is the no. of bytes occupied for a variable if it’s defined as PIC S9(7) COMP-3 and PIC S9(10) COMP

  1. 2 and 3

  2. 4 and 5

  3. 7 and 6

  4. none of the above


Correct Option: D

AI Explanation

To determine the number of bytes occupied for a variable in COBOL, you need to consider the data type and the storage format.

In COBOL, the PIC clause is used to define the data type and format of a variable. The S9 format is used for signed numeric variables, and the COMP-3 format is used for packed decimal variables.

For the given variable definitions:

  1. PIC S9(7) COMP-3:

    • The S9(7) indicates a signed numeric variable with a maximum of 7 digits.
    • The COMP-3 format represents packed decimal, which stores each digit using half a byte (nibble).
    • For a packed decimal variable, each digit requires 4 bits (half a byte) of storage.
    • The number of digits in the variable (7) multiplied by the storage required per digit (4 bits) gives us the total storage required.
    • Therefore, the total storage required for this variable is 7 * 4 bits = 28 bits, which is equivalent to 4 bytes.
  2. PIC S9(10) COMP:

    • The S9(10) indicates a signed numeric variable with a maximum of 10 digits.
    • The COMP format represents binary storage, which uses full bytes to store the data.
    • For a binary variable, each byte can store 8 bits.
    • The number of digits in the variable (10) multiplied by the storage required per digit (1 byte) gives us the total storage required.
    • Therefore, the total storage required for this variable is 10 * 1 byte = 10 bytes.

Based on the above explanations, the correct answer is D) none of the above, as the given options do not match the correct number of bytes occupied for the variables.

  1. Alphanumeric

  2. Numeric

  3. Alphabetic

  4. all the above


Correct Option: D