COBOL - Thinkerzzz

50 Questions | Attempts: 1179
Share

SettingsSettingsSettings
COBOL Quizzes & Trivia

Description about COBOL functionalities.


Questions and Answers
  • 1. 

    In the procedure division stmt OPEN OUTPUT FILE1 ?

    • A.

      There must be a select clause for this file in the file-control paragraph of environment division.

    • B.

      There must be an FD entry in the file section of the data division.

    • C.

      There’ll be a CLOSE stmt in procedure division.

    • D.

      The file name must appear in a WRITE stmt in the procedure division.

    Correct Answer
    D. The file name must appear in a WRITE stmt in the procedure division.
  • 2. 

    Pic S9(4) results 3 bytes ?

    • A.

      Comp

    • B.

      Comp1

    • C.

      Display

    • D.

      Comp3

    Correct Answer
    D. Comp3
  • 3. 

    Redefines clause cannot be used in-

    • A.

      Working-storage section

    • B.

      66

    • C.

      Elementary

    • D.

      77

    Correct Answer
    B. 66
  • 4. 

    Total no of bytes in the following   01 rec-1      02 first-group           03 a1 pic x(4).           03 a2 pic 99.      02 second-group redefines first-group.            03 A3 pic999.            03 A4 pic 999.       02 third-group.             03 A5 occurs 5 times pic 99.

    • A.

      14

    • B.

      16

    • C.

      22

    • D.

      10

    Correct Answer
    B. 16
  • 5. 

    Determine the total no of bytes in the following  01 rec1 .     02 a pic x(6).     02 b redefines a.          03 c occurs 6 times pic 9.      02 d occurs 4 times.          03 e pic x(5).           03 f pic 999.

    • A.

      44

    • B.

      38

    • C.

      14

    • D.

      32

    Correct Answer
    B. 38
  • 6. 

    Perform P2 varying I from 1 by 1 until I >10 will execute P2.

    • A.

      9 times.

    • B.

      10 times.

    • C.

      0 times.

    • D.

      1 times.

    Correct Answer
    B. 10 times.
  • 7. 

    Move Zeroes to I       move 5 to j perform para1 varying I from 10 by -2 until I = 0    display j.  para1.   Add 5 to j. What’ll be the value after execution of display stmt.

    • A.

      35

    • B.

      30

    • C.

      25

    • D.

      40

    Correct Answer
    B. 30
  • 8. 

    Which of the following is not true about search verb ?

    • A.

      Every search stmt must contain the AT END clause

    • B.

      Any no of WHEN clause can be used with this verb

    • C.

      This verb can only applied to a table which is defined with the OCCURS clause and INDEXED phases.

    • D.

      WHEN condition is satisfied

    Correct Answer
    A. Every search stmt must contain the AT END clause
  • 9. 

    Assuming a 32-bit word , how many words does the following occupy 01 BILLS.     05 INDIVIDUAL-BILL occurs 15 times.         10 BILL-NO PIC 9(6)V99 SYNC.         10 BILL-AMOUNT PIC 9(3) SYNC.

    • A.

      5

    • B.

      4

    • C.

      2

    • D.

      1

    Correct Answer
    B. 4
  • 10. 

    The association between a filename and corresponding file medium is done in

    • A.

      Date-compiled paragraph, identification division

    • B.

      Object-computer paragraph, configuration section and environment division

    • C.

      File-control paragraph, I-O Section and environment division

    • D.

      I-O control paragraph, I-O Section and environment division

    Correct Answer
    C. File-control paragraph, I-O Section and environment division
  • 11. 

    The following is Data Division entry  01 EMP-RECORD.          02EMP-NAME.                         04 FIRST-PART.                              05 FIRST-NAME PIC X (10).                              05 MIDDLE-NAME PIC X (10).                     04  SURNAME                      PIC X(20).

    • A.

      It is not correct because first-name and middle name contain the same PIC Clauses

    • B.

      Not correct because the PIC Clause is missing for the first three data items

    • C.

      Not correct because the level number 03 is missing

    • D.

      It is correct

    Correct Answer
    D. It is correct
  • 12. 

        Indicate which one of the following is correct

    • A.

      01 level entry cannot have any picture clause

    • B.

      01 level entries may appear only in the working-storage section and that too after all 77 level entries.

    • C.

      01 level entries may appear only in the File Section

    • D.

      01 level entries may appear in any section of the Data Division

    Correct Answer
    D. 01 level entries may appear in any section of the Data Division
  • 13. 

    WRITE MASTER-REC INVALID KEY GO TO PARA-ERROR. Indicate which of the following are not valid modes of opening the INDEXED file of which MASTER-REC is a record (a)  OPEN INPUT   (b) OPEN OUTPUT  (c)  OPEN INPUT-OUTPUT              (d)     OPEN INDEXED.  

    • A.

      A and b

    • B.

      A and c

    • C.

      C and d

    • D.

      A and d

    Correct Answer
    D. A and d
  • 14. 

    The WRITE statement cannot be used when a file is OPENED in the EXTEND mode

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
  • 15. 

    Identify which one of the following is not true Identify which one of the following is not true

    • A.

      The GO TO statement is not essential in the sense that it is possible to write programs without using GO TO.

    • B.

      The target of GO TO statement being a procedure name, avoiding GO TO results in a program with no procedure name.

    • C.

      Indiscriminate use of GO TO statement can make the control structure of a program substantially complex.

    • D.

      GO TO statement is quit handy for a programs that are difficult for others to understand

    Correct Answer
    B. The target of GO TO statement being a procedure name, avoiding GO TO results in a program with no procedure name.
  • 16. 

     IF S04-MBN = '1234'    PERFORM HANDLE-SPECIAL-CUSTOMER END-IF. IF S04-MBN = '5678'    PERFORM HANDLE-REGULAR-CUSTOMER END-IF.    Which one of the following statements is equivalent to the sample code shown above?

    • A.

      EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE.

    • B.

      EVALUATE S04-MBN ALSO S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE.

    • C.

      EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE.

    • D.

      EVALUATE TRUE WHEN S04-MBN = '1234' PERFORM HANDLE-REGULAR-CUSTOMER WHEN S04-MBN = '5678' PERFORM HANDLE-SPECIAL-CUSTOMER END-EVALUATE.

    Correct Answer
    A. EVALUATE S04-MBN WHEN '1234' PERFORM HANDLE-SPECIAL-CUSTOMER WHEN '5678' PERFORM HANDLE-REGULAR-CUSTOMER END-EVALUATE.
  • 17. 

    WORKING-STORAGE SECTION. 01  FIELDA PIC S9(3)V9(2) COMP-3 VALUE +1.12. 01  FIELDB PIC S9(3)V9(2) COMP-3 VALUE +1.07. 01  FINAL-RESULT PIC S9(3)V9(3) COMP-3. PROCEDURE DIVISION.     COMPUTE FINAL-RESULT = FIELDA * FIELDB.    Considering truncation may result, upon execution of the sample code above, the field FINAL-RESULT contains which one of the following values?

    • A.

      1V19

    • B.

      1.198

    • C.

      1v198

    • D.

      1.1984

    Correct Answer
    C. 1v198
  • 18. 

    What will be the value of X  after the following statement  is executed?         Compute X = 4+6/2*3**2

    • A.

      4.33

    • B.

      22

    • C.

      31

    • D.

      5

    Correct Answer
    A. 4.33
  • 19. 

    Which of the following is true about Random Access and Alternate Keys?

    • A.

      Only the first record written of a series of records with duplicate keys can be retrieved

    • B.

      All the records with duplicate keys will be retrieved one by one in any order

    • C.

      All the records with duplicate keys will be retrieved in the order stored in the file

    • D.

      None of the above

    Correct Answer
    A. Only the first record written of a series of records with duplicate keys can be retrieved
  • 20. 

    The successful execution of OPEN INPUT or OPEN I-O statement sets  the file position indicator to

    • A.

      0

    • B.

      1

    • C.

      Null

    • D.

      Blank

    Correct Answer
    B. 1
  • 21. 

    For accessing records in KSDS file through sequential read and indexed read, which among the following statements is used in SELECT clause?

    • A.

      ORGANISATION IS INDEXED ACCESS IS RANDOM

    • B.

      ORGANISATION IS SEQUENTIAL ACCESS IS RANDOM

    • C.

      ORGANISATION IS INDEXED ACCESS IS DYNAMIC

    • D.

      ORGANISATION IS INDEXED ACCESS IS SEQUENTIAL

    Correct Answer
    C. ORGANISATION IS INDEXED ACCESS IS DYNAMIC
  • 22. 

     IF CHAR-1 < CHAR-2    WRITE  LINE-1  ELSE    WRITE  LINE-2  If  before executing  this statement, CHAR-1 contains alphanumeric literal ‘1’  and CHAR-2 contains alphanumeric literal ‘A’  then ..

    • A.

      LINE-1 is always written

    • B.

      Action depends on the computer system on which the program is run

    • C.

      LINE-2 is always written

    • D.

      Compiler error result

    Correct Answer
    A. LINE-1 is always written
  • 23. 

    Data-names BAL1, BAL2, BAL3   and  BAL4 have the following definitions in the WORKING-STORAGE  section     01 BAL1  PIC 9-   01 BAL2  PIC 9+   01 BAL3  PIC 9CR   01 BAL4  PIC ZZZ               the statement   MOVE -5 TO BAL1, BAL2, BAL3, BAL4 will produce

    • A.

      5b 5- 5CR 5bb

    • B.

      5- 5- 5bb 005

    • C.

      5- 5- 5CR bb5

    • D.

      5- 5b 5bb 500

    Correct Answer
    C. 5- 5- 5CR bb5
  • 24. 

    If  I  have  CALL  WS-CALL  in my  application  program

    • A.

      With default compiler option PARM=NODYNAM this will be static

    • B.

      With default compiler option it will throw compile error.

    • C.

      Run time abend.

    • D.

      Irrespective of compiler option the program will act as dynamic call

    Correct Answer
    A. With default compiler option PARM=NODYNAM this will be static
  • 25. 

    MOVE  ‘ABBREVIATE’  TO FIELD-A. INSPECT  FIELD-A  CONVERTING  ‘ABCDE’  TO  ‘EDCBA’.  INSPECT  FIELD-A  ALL   REPLACING   ‘ABCDE’  BY  ‘EDCBA’.             What will be the value of FIELD-A when converting and replacing option is used?

    • A.

      Eddravieta, eddravieta

    • B.

      Eddravieta, error

    • C.

      Error, eddravieta

    • D.

      Error, error

    Correct Answer
    B. Eddravieta, error
  • 26. 

    For the following COBOL code how many times para-1 will execute? Data division. Working-storage section. 01 ws-v1    pic 9(1) value 1. Procedure division.            Perform para-1 with test after until ws-v1 = 1             Stop run. Para-1.             Compute ws-v1 = ws-v1 + 1.             Display ‘we are in para-1’.

    • A.

      1

    • B.

      10

    • C.

      11

    • D.

      Infinite

    Correct Answer
    A. 1
  • 27. 

     Calculate the memory allocation for the group 01 MP-REC. 02  E-NAME   PIC  X(10).                 02   E-SALARY   PIC  S9(6) COMP  SYNCHRONIZED.                  02  E-PF     PIC  9(4)V9(2) COMP-3.

    • A.

      16

    • B.

      22

    • C.

      20

    • D.

      24

    Correct Answer
    C. 20
  • 28. 

    Which one of the following statements are true? A.01 A PIC X(20).                  01 B REDEFINE A PIC X(100). B.01 DUP_REC. 02 D1 PIC X(50). 02 D2 REDEFINE D1 PIC X(100).

    • A.

      Statement A is TRUE, Statement B is False.

    • B.

      Statement A is False, Statement B is False.

    • C.

      Statement A is False, Statement B is True.

    • D.

      Statement A is TRUE, Statement B is True.

    Correct Answer
    B. Statement A is False, Statement B is False.
  • 29. 

    WORKING-STORAGE SECTION.                77   A    PIC  9(3)   VALUE   420.                77   B    PIC  9(3)   VALUE   -420 .                PROCEDURE  DIVISION.                     DISPLAY  A.                     DISPLAY  B.               The  internal representation for A and B will be

    • A.

      42{ & 42}

    • B.

      D20 & M20

    • C.

      D20 & m2

    • D.

      420{ & 420}

    Correct Answer
    A. 42{ & 42}
  • 30. 

    The following combination of edit characters can appear in the same PIC clause                         Except

    • A.

      -$*

    • B.

      $CR

    • C.

      $Z9

    • D.

      -$CR

    Correct Answer
    D. -$CR
  • 31. 

    01 FROM-AREA.     05  FIELDA               PIC  X(10) VALUE 'ABCDEFGHIJ'.     05  PTR                  USAGE IS POINTER.     05  ARRAY OCCURS 3 TIMES PIC X(10) VALUE SPACES.     05  AREA-INDEX           USAGE IS INDEX. 01 TO-AREA.     05  FIELDA               PIC X(10).     05  PTR                  USAGE IS POINTER.     05  ARRAY OCCURS 3 TIMES PIC X(10).     05  AREA-INDEX           USAGE IS INDEX. ... MOVE CORRESPONDING FROM-AREA TO TO-AREA.    Which one of the following is moved as a result of the MOVE CORRESPONDING statement in the sample code above?

    • A.

      All fields are moved.

    • B.

      None of the fields are moved.

    • C.

      AREA-INDEX and PTR are the only fields moved

    • D.

      FIELDA and ARRAY are the only fields moved.

    Correct Answer
    D. FIELDA and ARRAY are the only fields moved.
  • 32. 

     Layout of library member IRECORD: 01  INPUT-RECORD.    05  INPUT-LAST-NAME   PIC X(20).    05  INPUT-FIRST-NAME  PIC X(10).    05  INPUT-TELENO    PIC X(10).    Referring to the sample code above, which one of the following is the correct sequence of instructions that will cause IRECORD to be copied into the program?

    • A.

      FD INPUT-FILE. 01 COPY IRECORD.

    • B.

      FD INPUT-FILE. COPY I-RECORD.

    • C.

      FD INPUT-FILE. COPY IRECORD.

    • D.

      FD INPUT-FILE. COPY MEMBER IRECORD.

    Correct Answer
    C. FD INPUT-FILE. COPY IRECORD.
  • 33. 

    INITIALIZE has NO effect on which one of the following types of fields? 

    • A.

      PIC ZZ,ZZ9.99

    • B.

      FILLER or index items

    • C.

      PIC S9(..) COMP-3

    • D.

      PIC 9(..)

    Correct Answer
    B. FILLER or index items
  • 34. 

    05 W-CLASS-GRADE         PIC X(01).   88 W-GRADE-EXCELLENT  VALUE 'A'.   88 W-GRADE-GOOD       VALUE 'B'.   88 W-GRADE-AVG        VALUE 'C'.   88 W-GRADE-POOR       VALUE 'D'.   88 W-GRADE-FAIL       VALUE 'F'.   S0400-VERIFY-GRADE   IF W-GRADE-EXCELLENT         MOVE C-EXCELLENT-WORK TO W-COMMENT   ELSE         IF W-GRADE-GOOD             MOVE C-GOOD-WORK TO W-COMMENT         ELSE              MOVE C-NO-COMMENT TO W-COMMENT   END-IF.    Referring to the above Working Storage field and sample code, which one of the following errors, if any, occurs in the sample code?

    • A.

      All '88 levels that were defined must be used in the IF statement.

    • B.

      TRUE or FALSE should be used on the IF statements.

    • C.

      Relational operators cannot be used when a data name is used for the IF statement

    • D.

      The statement does not contain any errors.

    Correct Answer
    B. TRUE or FALSE should be used on the IF statements.
  • 35. 

     DATA DIVISION. WORKING-STORAGE SECTION. 01  DATA-ARRAY.     05  DATA-FIELD OCCURS 10 TIMES PIC S9(3) COMP-3. PROCEDURE DIVISION.     MOVE ZEROS TO DATA-ARRAY.     ADD +1 TO DATA-FIELD (9). When executed, the sample code above results in which one of the following, exception codes? 

    • A.

      Boundary Violation Exception

    • B.

      Operation exception

    • C.

      Data exception

    • D.

      Decimal divide exception

    Correct Answer
    C. Data exception
  • 36. 

    The following is a PROCEDURE DIVISION statement. UNSTRING DATA-FIELD DELIMITED BY “,” INTO FIELD-1 FIELD-2 FIELD-3 FIELD-4 TALLYING IN CNT-1. Indicate which of the following will be true after the execution of the above statement

    • A.

      CNT-1 will contain the total number of characters received by all the receiving fields together.

    • B.

      The value of CNT-1 will be equal to the number of receiving fields acted upon

    • C.

      The value of CNT-1 will be increased by the number of receiving fields acted upon.

    • D.

      CNT-1 will be increased by the number of characters received by the receiving fields

    Correct Answer
    C. The value of CNT-1 will be increased by the number of receiving fields acted upon.
  • 37. 

    Identify the incorrect statement ?

    • A.

      CALL MY-SUB

    • B.

      CALL MY-SUB ON OVERFLOW GO TO MISSING-SUB

    • C.

      CALL MY-SUB USING PARAM-1

    • D.

      CALL MY-SUB USING PARAM-1 UNTIL PARAM-1 > 10.

    Correct Answer
    D. CALL MY-SUB USING PARAM-1 UNTIL PARAM-1 > 10.
  • 38. 

    .Indicate which of the following is not true about the formal parameters in a subroutine.

    • A.

      every formal parameter must appear in the LINKAGE SECTION of the subroutine.

    • B.

      Every formal parameter must appear in the USING phrase of the PROCEDURE DIVISION header of the subroutine.

    • C.

      A formal parameter name can appear more than once in the USING phrase of the PROCEDURE DIVISION header of the subroutine.

    • D.

      A formal parameter can be used as a data name in the PROCEDURE DIVISION statements of the subroutine

    Correct Answer
    C. A formal parameter name can appear more than once in the USING phrase of the PROCEDURE DIVISION header of the subroutine.
  • 39. 

    Indicate which of the following is not true about the actual parameter that will be passed to the sub program

    • A.

      (a) An actual parameter must be a data name in any section of the DATA DIVISION except FILE SECTION.

    • B.

      (b) Actual parameters appear in the USING phrase of CALL statement

    • C.

      (c) In the using phrase of CALL statement, same data name can appear more than once

    • D.

      (d) An actual parameter should be a data name described at level 01 or 77.

    Correct Answer
    D. (d) An actual parameter should be a data name described at level 01 or 77.
  • 40. 

    . Consider the following: 77 A PIC 9(10) 77 B PIC 9(10) 77 C PIC 9(19) MULTIPLY A BY B GIVING C Which of the following is true ?

    • A.

      The execution of the above may result in size error.

    • B.

      The execution of the above will result in size error.

    • C.

      The definition of C is invalid resulting in compilation error

    • D.

      ) No error will be there and the program would proceed correctly

    Correct Answer
    A. The execution of the above may result in size error.
  • 41. 

    . Study the DATA DIVISION entries and the three PROCEDURE DIVISION entries given below: 01 END-OF-FILE-SWITCH PIC XXX. 88 NO-MORE-RECS VALUE "YES". 88 MORE-RECS VALUE "NO". (i) READ SAMPLE-FILE AT END MOVE "YES" TO NO-MORE-RECS. (ii) IF NO-MORE-RECS = "YES" GO TO LAST-PARA. (iii) IF NO-MORE-RECS GO TO LAST-PARA. Which are wrong?

    • A.

      (i) and (ii)

    • B.

      (ii) and (iii)

    • C.

      (ii) and (iv)

    • D.

      (i) and (iv)

    Correct Answer
    A. (i) and (ii)
  • 42. 

    OCCURS clause is used in the DATA DIVISION on data names at

    • A.

      01 level

    • B.

      88 level

    • C.

      77 level

    • D.

      Any level from 02 to 49

    Correct Answer
    D. Any level from 02 to 49
  • 43. 

     Consider the following COBOL entries: 05 X PIC 99 VALUE 10. SUBTRACT 20 FROM X. The resultant value of X wil be

    • A.

      00

    • B.

      10

    • C.

      Compile-time error

    • D.

      None of these

    Correct Answer
    D. None of these
  • 44. 

    . Which of the following files can be OPENed in all the 4 modes? The four modes are INPUT, I-O, OUTPUT and EXTEND.

    • A.

      Sequential

    • B.

      Relative

    • C.

      Indexed

    • D.

      All of the above

    Correct Answer
    C. Indexed
  • 45. 

    Which tests are allowed with the following variable? (2 answers) 01 END-OF-FILE PIC X. 88 EOF VALUE 'N'.

    • A.

      IF EOF THEN ...

    • B.

      IF EOF IS TRUE THEN ...

    • C.

      IF END-OF-FILE = 'Y' THEN ...

    • D.

      IF END-OF-FILE THEN ...

    Correct Answer(s)
    A. IF EOF THEN ...
    C. IF END-OF-FILE = 'Y' THEN ...
  • 46. 

    Indicate which of the following, performs the initialization of the sum controls, LINE-COUNTER and PAGE-COUNTER to their initial values. 

    • A.

      Reset

    • B.

      Initiate

    • C.

      Value

    • D.

      Generate

    Correct Answer
    B. Initiate
  • 47. 

    Which of the following PIC definitions can be used in the declaration of a record of a sequential file that will be used as INPUT (3 answers)

    • A.

      PIC X(9)

    • B.

      PIC S9(4) COMP

    • C.

      PIC Z(4)

    • D.

      PIC 9(4)V99

    • E.

      PIC 9(4).99

    Correct Answer(s)
    A. PIC X(9)
    B. PIC S9(4) COMP
    D. PIC 9(4)V99
  • 48. 

    Which of the following errors are possible within a COBOL if statement?

    • A.

      Infinite loop

    • B.

      Logical error

    • C.

      Runtime error

    • D.

      All of the above

    Correct Answer
    D. All of the above
  • 49. 

    The Cobol compiler at the time of compilation indicates the error in the following           Statement                        MULTIPLY 0.1 BY A.                    Which of the following had given the correct clause?

    • A.

      A has the PICTURE CLAUSE 9(4) V99

    • B.

      A has the PIC CLAUSE ZZZ9.9

    • C.

      The Giving Option is missing

    • D.

      A is declared in the file section and not in the working storage section

    Correct Answer
    B. A has the PIC CLAUSE ZZZ9.9
  • 50. 

    IF   A <  B  AND   C  >  D   GO TO P1                   ELSE  IF   NOT  (A  >  B  OR  B  <  C)  GO TO   P2                   ELSE GO TO P3.         In this A=6, B=7, C=5  and D=8 . Indicate the para name to which the control will be transferred if before execution of the above if sentence.

    • A.

      P3

    • B.

      P1

    • C.

      P2

    • D.

      NONE

    Correct Answer
    C. P2

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Feb 11, 2013
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 22, 2011
    Quiz Created by
    Deepshukla
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.