Subroutines Interview Questions


What is a subroutine?

A subroutine is a code block that is not compiled or executed independently. These subroutines can exist within or outside of the application program.

What are the types of subroutines?

There are two types of subroutines -

  • Internal subroutines.
  • External subroutines
    • Subprograms.
    • PROCEDURE DIVISION copybooks.

What are internal subroutines?

These are paragraphs or sections that are coded within the program and can be called by using the PERFORM statement.

What are external subroutines?

These are the code blocks that can code outside of the program and can be used in multiple programs to complete a task.

What is the subprogram?

These are separate modules coded to perform a specific task and can be called by multiple programs.

What are the types of external subroutines?

These are two types -

  • Subprograms
  • PROCEDURE DIVISION Copybooks

What is a copybook in COBOL?

Copybook is a peice of code which can contain file structure or PROCEDURE DIVISION code (paragraphs or sections).

What is the PROCEDURE DIVISION copybook in COBOL program?

The code block contains the PROCEDURE DIVISION code in it. These are called COBOL includes or PROCEDURE DIVISION copybooks.

Frequently Asked Questions -

How do you call a subroutine in COBOL?

How do you use a copybook in COBOL?