COBOL Programming Language Quiz! Exam

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Tamminhnguyen030
T
Tamminhnguyen030
Community Contributor
Quizzes Created: 1 | Total Attempts: 280
Questions: 12 | Attempts: 280

SettingsSettingsSettings
COBOL Programming Language Quiz! Exam - Quiz

This quiz is designed to help test Your Knowledge about COBOL Programming Language. This programming language is not used so much today and is not supported by most systems, but it cannot be completely forgotten. It was created to help businesses in their administrative processes. How about you refresh your understanding of the language by taking this quiz!


Questions and Answers
  • 1. 

    What is the output of the code below? IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION.    WORKING-STORAGE SECTION.    01 WS-STRING PIC A(30) VALUE 'WELCOME TO COBOL WORLD'.    01 WS-STR1 PIC A(7).    01 WS-STR2 PIC A(2).    01 WS-STR3 PIC A(15).    01 WS-COUNT PIC 99 VALUE 1. PROCEDURE DIVISION.    UNSTRING WS-STRING DELIMITED BY SPACE       INTO WS-STR1, WS-STR2, WS-STR3    END-UNSTRING.       DISPLAY WS-STR2.    STOP RUN.

    • A.

      WELCOME

    • B.

      TO

    • C.

      TO COBOL WORLD

    • D.

      WELCOMETOCOBOLWORLD

    Correct Answer
    B. TO
    Explanation
    The code uses the UNSTRING statement to break down the value of WS-STRING into three separate strings, WS-STR1, WS-STR2, and WS-STR3, using a space as the delimiter. The value "TO" is assigned to WS-STR2. The DISPLAY statement then outputs the value of WS-STR2, which is "TO".

    Rate this question:

  • 2. 

    What is the output of the following program? IDENTIFICATION DIVISION. PROGRAM-ID. HELLO.   DATA DIVISION.    WORKING-STORAGE SECTION.    01 WS-TABLE.       05 WS-A OCCURS 3 TIMES.          10 WS-B PIC A(2).          10 WS-C OCCURS 2 TIMES.             15 WS-D PIC X(3).   PROCEDURE DIVISION.    MOVE '12ABCDEF34GHIJKL56MNOPQR' TO WS-TABLE.    DISPLAY 'WS-C(3,1) : ' WS-C(3,1).    STOP RUN.

    • A.

      DEF

    • B.

      ABC

    • C.

      PQR

    • D.

      MNO

    Correct Answer
    D. MNO
    Explanation
    The program declares a table called WS-TABLE with three occurrences of WS-A. Each occurrence of WS-A has a field WS-B and an array WS-C with two occurrences. Each occurrence of WS-C has a field WS-D. The program then moves the string '12ABCDEF34GHIJKL56MNOPQR' to WS-TABLE. The DISPLAY statement displays the value of WS-C(3,1), which is the first occurrence of WS-C in the third occurrence of WS-A. Therefore, the output would be 'MNO'.

    Rate this question:

  • 3. 

    How many times following loop will execute? MOVE 5 TO X. PERFORM X TIMES MOVE 10 TO X END-PERFORM.

    • A.

      11

    • B.

      5

    • C.

      10

    • D.

      15

    Correct Answer
    B. 5
    Explanation
    The loop will execute 5 times because the initial value of X is 5. In each iteration of the loop, the value of X is set to 10. Therefore, the loop will execute 5 times, resulting in the final value of X being 15.

    Rate this question:

  • 4. 

    If after an arithmetic operation, the result exceeds the largest value that can be accommodated in the result field, the error is called a ________.

    Correct Answer
    SIZE ERROR
    Explanation
    If the result of an arithmetic operation is larger than the maximum value that can be stored in the result field, it is considered a SIZE ERROR. This error occurs when the result exceeds the capacity of the variable or field used to store it, causing an overflow. The SIZE ERROR indicates that the result cannot be accommodated within the given space, and it is necessary to handle this error to prevent data corruption or loss.

    Rate this question:

  • 5. 

    The ________ clause eliminates the need for separate entries for the repeated data items.      A. REDEFINES      B. RENAME      C. USAGE      D. OCCURS

    Correct Answer
    OCCURS, D, D. OCCURS
    Explanation
    The OCCURS clause eliminates the need for separate entries for the repeated data items. By specifying the number of times a data item should occur, it allows for efficient storage and retrieval of data without the need for redundant entries. In this case, the answer indicates that the OCCURS clause is the correct choice, and it appears twice in the answer.

    Rate this question:

  • 6. 

    If initially A=30 and B=60 then execute the statement bellow                                 MOVE A B TO C. What is the resultant of C?

    • A.

      30

    • B.

      60

    • C.

      90

    • D.

      Syntax error

    Correct Answer
    D. Syntax error
    Explanation
    The statement "MOVE A B TO C" is not a valid syntax in most programming languages. The correct syntax would be "MOVE A TO C" or "MOVE B TO C". Therefore, the given statement contains a syntax error.

    Rate this question:

  • 7. 

    PERFORM P2           VARYING I FROM 1 BY 1 UNTIL I <10 END-PERFORM. How many times P2 will be executed?

    • A.

      10

    • B.

      11

    • C.

      0

    • D.

      1

    Correct Answer
    C. 0
    Explanation
    The PERFORM statement is used to create a loop in COBOL. In this case, P2 will be executed until the condition I < 10 is no longer true. However, since the initial value of I is 1 and it is incremented by 1 each time, the condition will never be true and the loop will not be executed at all. Therefore, the correct answer is 0.

    Rate this question:

  • 8. 

       MOVE 123456789 TO WS-NUM1.    MOVE WS-NUM1(3:6) TO WS-NUM2.     DISPLAY WS-NUM2 What is the output of the DISPLAY?

    • A.

      345678

    • B.

      123456

    • C.

      000000

    • D.

      456789

    Correct Answer
    A. 345678
    Explanation
    The output of the DISPLAY statement will be 345678. This is because the MOVE statement moves the value of WS-NUM1(3:6), which is 345678, to WS-NUM2. Therefore, when WS-NUM2 is displayed, it will show 345678.

    Rate this question:

  • 9. 

    After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. There is no need for any extra code.

    • A.

      True

    • B.

      False

    Correct Answer
    A. True
    Explanation
    After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. This means that there is no need for any extra code to transfer control to the next sentence. Therefore, the statement "After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement" is true.

    Rate this question:

  • 10. 

    LINKAGE-SECTION present which DIVISION?

    • A.

      IDENTIFICATION DIVISION

    • B.

      ENVIRONMENT DIVISION

    • C.

      DATA DIVISION

    • D.

      PROCEDURE DIVISION

    Correct Answer
    C. DATA DIVISION
    Explanation
    The correct answer is DATA DIVISION. In COBOL programming, the DATA DIVISION is used to define the data structures and variables that will be used in the program. It specifies the names, types, and lengths of the data items. The DATA DIVISION is responsible for declaring and organizing the data that the program will work with, and it is an essential part of any COBOL program. The other divisions mentioned in the question (IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, and PROCEDURE DIVISION) are also important divisions in COBOL, but they serve different purposes than the DATA DIVISION.

    Rate this question:

  • 11. 

    Every Data name used in the program must be defined in PROCEDURE DIVISION.

    • A.

      True

    • B.

      False

    Correct Answer
    B. False
    Explanation
    In a program, not every data name used needs to be defined in the PROCEDURE DIVISION. Data names can be defined in other divisions such as the DATA DIVISION or FILE SECTION. Therefore, the statement "Every Data name used in the program must be defined in PROCEDURE DIVISION" is false.

    Rate this question:

  • 12. 

    PERFORM with ________ phase executes the number of times specified by the value in identifier or Integer. A. UNTIL B. THRU C. END-PERFORM D. TIMES 

    Correct Answer
    TIMES, D, D. TIMESĀ 
    Explanation
    The correct answer is D. TIMES. The PERFORM with TIMES phase executes the number of times specified by the value in identifier or Integer. In this case, the value in identifier or Integer is D, indicating that the PERFORM statement will be executed D number of times. The second D in the answer choice is likely a typo or repetition.

    Rate this question:

Quiz Review Timeline +

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

  • Current Version
  • Mar 10, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 20, 2019
    Quiz Created by
    Tamminhnguyen030
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.