Data Types Interview Questions


What kinds of data exist in COBOL?

Numeric, Alphabetic and Alpha-numeric

What is meant by data types in COBOL?

A data type defines the kind of data a variable can hold, such as numeric values, alphabetic characters, or alpha-numeric strings.

What are data types in COBOL?

There are five data types in COBOL, and those are -

  • Alphabetic
  • Alpha-numeric
  • Numeric
  • Sign
  • Decimal Point

Alphabetic Data Type -

What is the significance of alphabetic data type?

An alphabetic data type is used to declare the variables for storing and processing alphabetic strings.

What is the default alignment of alphabetic data type?

Left

Can we override the default alignment of alphabetic data type? If yes, how?

Yes. Using JUSTIFIED clause

Alpha-numeric Data Type -

What is the significance of alphanumeric data type?

An alpha-numeric data type is used to declare the variables for processing alphanumeric strings that are a combination of characters from "A" to "Z" or "a" to "z" characters or 0 to 9 numbers and other allowed special characters.

What is the default alignment of alphanumeric data type?

Left

Can we override the default alignment of alphanumeric data type? If yes, how?

Yes. Using JUSTIFIED clause

Numeric Data Type -

What is the significance of numeric data type?

Numeric data type is used to declare the variables to store and process the numbers or decimal values.

What is the default alignment of numeric data type?

Right

Can we override the default alignment of numeric data type? If yes, how?

No. Not possible.

Decimal Point-Data Type -

What is the significance of decimal-point data type?

When an input is decimal, we should declare a variable with a decimal point to handle it. Decimal point data type declares only with the combination of numeric data type.

What is the real decimal point data type?

Dot | period (.) is used with the variable declaration to process the decimal value along with dot. The Dot is counted as part of the variable length.

What is the assumed decimal point data type?

"V" is used with a variable declaration to process the decimal value in arithmetic calculations. The "V" is not part of the data and does not count in the variable length.

What is the length of PIC 9.999?

5 bytes

Sign Data Type -

What is the significance of sign data type?

Sign data type is used to declare the numeric variable with the sign to capture the negative values. i.e., sign data type always comes up with numeric data type.

How many bytes does a S9(7) field occupy?

7 bytes

Frequently Asked Questions -

Different data types in COBOL?
What are the available data types in the COBOL language?
What are data types available in the COBOL language?
What are the three data types in COBOL?
Name the data types available in COBOL?
What are the different data types in COBOL?
What are the different data types available in COBOL?
What are the different data types that COBOL supports?
How many datatypes are there in COBOL?

Explain the differences between numeric, alpha numeric, and alphabetic data types in COBOL?

What is the difference between PIC 9.99 and PIC 9v99?