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.
In COBOL, when dealing with variable-length records, which data structure is used to determine the length of each record?
- Data Division
- File Section
- Record Description Table (RDT)
- Record Descriptor Entry (RDE)
In COBOL, the Record Descriptor Entry (RDE) is used to specify the length and structure of variable-length records. It contains information such as the starting position and length of each field within the record.
In Object-Oriented COBOL, _____ allows a class to provide different implementations of a method based on the specific object type.
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
Polymorphism in Object-Oriented COBOL allows a class to provide different implementations of a method based on the specific object type. It enhances flexibility by enabling a single method name to have different behaviors in different classes.
_____ is the file access mode used when you only need to read records from a file in COBOL.
- EXTEND
- I-O
- INPUT
- OUTPUT
"INPUT" is the file access mode used in COBOL when you only need to read records from a file. This mode allows the program to read data from the specified file but does not allow writing or updating records.
What is the purpose of a "core dump" in COBOL debugging?
- A log of input/output operations
- A report of compilation errors
- A snapshot of the program's memory contents
- A summary of executed COBOL statements
In COBOL debugging, a "core dump" refers to a snapshot of the program's memory contents at a specific point in time. It helps developers analyze the state of the program's variables and memory structures, aiding in identifying the cause of issues.
To access a specific element within a table, you typically use an _____ variable.
- INDEX
- OCCURS
- RANGE
- SIZE
To access a specific element within a table in COBOL, you typically use an INDEX variable. The INDEX variable represents the position of the element within the table and is used to navigate and retrieve data from the array.
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.
When working with external files, the _____ clause is used for file access control.
- ACCESS
- CONTROL
- FILE
- ORGANIZATION
In COBOL, the ACCESS clause is used for file access control when working with external files. It specifies the type of access (e.g., sequential or random) that the program will have to the file.