Data Item Interview Questions


What is a variable or data item?

A variable is a name used to hold the value for processing in the program. It is also called as a data item.

How would you declare variables in COBOL?

For Example - Declaring a variable of numeric type to store a value 123.

 01 WS-NUMERIC-VAR      PIC 9(03) VALUE 123.
  • level-number - Refers the level number. From the example, it is 01.
  • variable-name - Refers the name of the variable. From the example, it is WS-NUMERIC-VAR.
  • data-type-character - Refers the type of the variable. From the example, it is numeric(9).
  • variable-length - Refers the variable length. From the example, it is 03.
  • literal-value - Refers the initial value assigned to the variable. From the example, it is 123.

What are the three variables used in the presentation?

The variables are divided into three types based on their declaration and those are -

  • Individual variable
  • Group variable
  • Elementary variable

Frequently Asked Questions -

How do you define variables in COBOL?