Your COBOL application needs to create a new file and write data to it. Which file access mode should be used for this purpose?

  • EXTEND
  • I-O
  • INPUT
  • OUTPUT
For creating a new file and writing data to it, the correct file access mode is OUTPUT. This mode is used to write records to a file and create a new file if it does not exist. It does not allow reading or updating existing records.

A ____________ array is one where the OCCURS clause is nested within another OCCURS clause in COBOL.

  • Dynamic
  • Hierarchical
  • Multidimensional
  • Nested
A nested array in COBOL is created when the OCCURS clause is used within another OCCURS clause. This allows for the creation of more complex data structures, such as tables of tables or matrices.

Which COBOL file control verb is used to establish a connection between a COBOL program and an external file?

  • FILE
  • OPEN
  • READ
  • WRITE
The OPEN verb in COBOL is used to establish a connection between a COBOL program and an external file. It prepares the file for subsequent READ or WRITE operations.

_____ is the process of creating a new object from a class in Object-Oriented COBOL.

  • CREATION
  • GENERATION
  • INSTANTIATION
  • OBJECTIFICATION
In Object-Oriented COBOL, the process of creating a new object from a class is known as "INSTANTIATION." It involves creating an instance of a class with its own set of data and behavior.

In COBOL, what are the typical sorting criteria you can specify while using the SORT verb?

  • One or more keys from the record
  • Only alphabetic fields
  • Only literal values
  • Only numeric fields
The SORT verb in COBOL allows you to specify one or more keys from the record as sorting criteria. These keys determine the order in which the records are sorted.

In a COBOL program, you are tasked with processing a file containing variable-length records representing student transcripts. You need to determine the total number of records and their average length. Which COBOL construct would you use to achieve this?

  • FILE STATUS
  • LINAGE IS 66
  • OCCURS
  • RECORDING MODE IS V
The OCCURS clause in COBOL is used to define a table, and it can be leveraged to process variable-length records. By using OCCURS, you can iterate through the records, calculate the total length, and determine the average length based on the number of records processed.

The _____ clause in COBOL allows you to declare a variable as a subordinate item of another variable.

  • GROUP
  • OCCURS
  • REDEFINES
  • RENAMES
The GROUP clause in COBOL is used to declare a variable as a subordinate item of another variable. It helps in organizing related data items under a common name, making the structure of the data more readable and manageable.

Which COBOL data type is appropriate for representing fixed-point decimal numbers?

  • PIC 9(5)V9(2)
  • PIC S9(5)V9(2)
  • PIC S9(5)V9(2) COMP
  • PIC S9(5)V9(2) COMP-3
The data type PIC S9(5)V9(2) COMP-3 in COBOL is used to represent fixed-point decimal numbers. The COMP-3, or packed decimal, format is suitable for efficient storage of decimal data, with each digit represented by half a byte.

In a large COBOL application, you have multiple programs that need to share a common data structure. How can subprograms help in managing this data sharing efficiently?

  • COPY statement
  • Global Data Section
  • Parameter Passing
  • Redefine Clause
Subprograms can efficiently manage data sharing by using Parameter Passing. By passing parameters, data can be exchanged between the main program and subprograms, ensuring modularity and reducing dependencies on global data.

When using the EXTERNAL clause in COBOL, how can you ensure variable visibility across different programs?

  • By declaring the variable as REDEFINES in each program
  • By declaring the variable in each program using the EXTERNAL clause
  • By using the ENTRY statement in the calling program
  • By using the GLOBAL clause along with the EXTERNAL clause
To ensure variable visibility across different programs, you can use the GLOBAL clause along with the EXTERNAL clause. This combination allows the variable to have global visibility, making it accessible across various program units.