SORT RAFFLES_FILE ON ASCENDING KEY IBM-MAIN Y2K-MAINUSING INPUT-FILE GIVING OUTPUT-FILE.Which one the following is true?

  1. The sorted file will contain all Raffles records in ascending order of Y2K-MAIN.

  2. IBM-MAIN is the major key and Y2K-MAIN is the minor key

  3. The statement is wrong as there should be only one key since the clause ascending key appears only once.

  4. Both INPUT-FILE and OUTPUT-FILE must be described in the DATA DIVISION with SD entries.


Correct Option: B

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) The sorted file will contain all Raffles records in ascending order of Y2K-MAIN. This option is incorrect. The SORT statement in the question specifies that the file should be sorted in ascending order of the key "IBM-MAIN," not "Y2K-MAIN."

Option B) IBM-MAIN is the major key and Y2K-MAIN is the minor key. This option is correct. In the SORT statement, "IBM-MAIN" is specified as the ascending key, which means it is the major key. "Y2K-MAIN" is not mentioned in the ascending key clause, so it is the minor key.

Option C) The statement is wrong as there should be only one key since the clause ascending key appears only once. This option is incorrect. It is possible to have multiple ascending keys in a SORT statement. In this case, "IBM-MAIN" is specified as the ascending key, and "Y2K-MAIN" is not mentioned in the ascending key clause.

Option D) Both INPUT-FILE and OUTPUT-FILE must be described in the DATA DIVISION with SD entries. This option is incorrect. The INPUT-FILE and OUTPUT-FILE mentioned in the SORT statement are not required to be described in the DATA DIVISION with SD entries. The SORT statement is used to sort data from the input file and write the sorted data to the output file, but it does not require explicit description in the DATA DIVISION.

The correct answer is B) IBM-MAIN is the major key and Y2K-MAIN is the minor key. This option is correct because the SORT statement specifies "IBM-MAIN" as the ascending key, making it the major key, and "Y2K-MAIN" is not mentioned in the ascending key clause, making it the minor key.

Find more quizzes: