InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Consider a scenario where we have a program having an array of 20 items. When the program tries to access the 21st item, the program fails to abend. What is the reason for this? |
|
Answer» The DEFAULT compiler option NOSSRANGE MUST have been USED which does not allow the program to abend. If we want the program to abend WHENEVER accessing an array element that is out of bounds, we need to use the compiler option of SSRANGE. Using this option, the program abends with SOC4 error which indicates that it tried to access an invalid address by using the WRONG index. |
|
| 2. |
Why is S9(4) COMP needed despite knowing that Comp-3 would utilise less space? |
|
Answer» S9(4) COMP represents that the item is a small integer which MEANS two words of 1 byte each can occupy a total of 2 bytes. In S9(4) COMP-3, ONE word is equal to half a byte which means 4 words can occupy 2 bytes and ADDITIONALLY, the sign occupies another half byte which results in a maximum of 3 bytes usage. More can be accommodated in S9(4) COMP when COMPARES to COMP-3. |
|
| 3. |
What do you understand by the following terminologies? |
Answer»
All 4 are the OPTIONS that are available in COMPILE or link editing. AMODE expands to ADDRESSING Mode. AMODE(31) and AMODE(24) REPRESENTS that the addressing mode used is 31-bit and 24-bit respectively. When we use AMODE(ANY), it indicates that either 31-bit mode or 24-bit addressing mode can be used and it is dependent on the value of RMODE. RMODE represents Resident Mode within the virtual storage. RMODE(24) represents that the mode can reside within virtual storage below the 16 Meg line. RMODE(ANY) represents that the mode can reside below or above 16 Meg line and the ADDRESS bit can be either 24-bit or 31-bit depending on the RMODE. |
|
| 4. |
How is INCLUDE different from COPY? |
|
Answer» The main similarity between INCLUDE and COPY is that both HELP in expanding the program variables or codes. The important difference between them is that INCLUDE is used for expanding the code at the time of pre-compilation. WHEREAS the COPY expands the code at compilation time. DB2 pre-compilers won’t be ABLE to PROCESS COPY statements which is why the statements involving the validation of table attributes and DCL statements are embedded USING INCLUDE. |
|
| 5. |
What are the problems associated with using ordered sequential files? |
|
Answer» The main nature of ordered sequential files is that the records are arranged BASED on some key field(s). When a user wants to perform OPERATIONS like insert or deletion, then the order based on the field(s) should be maintained at all times. This is attained only by creating a new file where we insert or update or delete the records within the new file and then maintain the ordered nature. All these take PLACE on the disk directly and the time required to access data on disk is the main bottleneck while processing any functionality. This reduces the SPEED of computation and slows down the SYSTEM unnecessarily if we try to use ordered sequential files whenever not needed. |
|
| 6. |
Under what circumstances are scope terminators mandatorily needed? |
|
Answer» When we are using in-line PERFORMS or EVALUATE statements, we NEED to USE scope terminators. It is recommended because it HELPS to read the CODE better and is DEEMED as a good coding practice. |
|
| 7. |
What are the causes of S0C7, S0C5 and S0C1? |
|
Answer» S0C7 is caused mainly DUE to the following reasons:
S0C5 is caused mainly due to the following reasons:
S0C1 is caused mainly due to the following reasons:
|
|
| 8. |
What are the differences between Structured COBOL and Object-Oriented COBOL programming? |
||||||||
Answer»
|
|||||||||
| 9. |
How can we reference or make COBOL program realise that about the following file formats? |
|
Answer» 1. Fixed Block File Following are the explanation to the POINTS one by one:
|
|
| 10. |
How can we process two files by comparing key fields? |
|
Answer» There are 2 possible APPROACHES for this:
To make the process easier, we can avoid a lot of I-O operations by reading data to the local array table and then processing the records from there. |
|
| 11. |
How do we remove the spaces at end of every record in an output file that is of variable length? |
|
Answer» Spaces that are PRESENT at the end of the record are called trailing spaces. COBOL does not provide the functionality to remove such trailing spaces. But it can be achieved by using the RECORD-LENGTH field as FOLLOWS:
|
|
| 12. |
Why should the file be opened in I-O mode when it is being used for REWRITE purposes? |
|
Answer» When the file REWRITE of the RECORD needs to be performed, the file should first be OPENED and then the record must be READ from the file. This is why the file should always be opened in I-O mode. |
|
| 13. |
How is sorting achieved in the COBOL program? |
|
Answer» It is done by using the SORT command whose syntax goes as follows: SORT file_1 ON ASCENDING/DESCENDING KEY key…USING file_2GIVING file_3.where
All THREE files are not supposed to be opened explicitly. Note:
|
|
| 14. |
What are the different divisions in COBOL programs? |
|
Answer» There are mainly 4 divisions in a COBOL program, they are:
|
|
| 15. |
What are some of the guidelines that can be followed while developing a structured COBOL program? |
|
Answer» Certain guidelines need to be FOLLOWED while writing a structured COBOL PROGRAM.
|
|