Basic Verbs Interview Questions


Words -

What is a word?

A COBOL word is a set of characters, and each character is from the character set - A to Z, 0 to 9, - (hyphen), _ (underscore).

What is a user-defined COBOL word?

These are the words you, as a developer, create to fit your specific needs. They can be anything from MTHPROG1, STD-GENDER, reflecting the unique aspects of your COBOL program.

What is reserved word?

A reserved word is a system-defined word with proper meaning or task assigned in COBOL language. For Example - ACCEPT, SKIP1, ZEROS, ....

Variable -

Explain COBOL data names or variables?

A Variable is used to store and process the value. A Variable is also called a data item. For Example - WS-A, WS-VAR, WS-TOTAL, WS-INPUT, WS_OUTPUT, etc.

In COBOL, how to declare variables?

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 of the declaration from 01 to 49. 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 to store the data. From the example, it is 03.
  • literal-value - Refers the initial value assigned to the variable. From the example, it is 123.

Literal -

What are literals?

The literal is the value that is assigned to the variable.

What is numeric literals?

A numeric literal is a number that is a combination of a sign (+ or -), and a decimal point.

What is non-numeric literals?

Non-numeric literals are the strings enclosed by quotation marks(") or apostrophes(').

Constant -

What is a constant variable?

A variable is initialized with a literal. If the variable value doesn't change during the program's execution, the variable is considered as a constant variable, and the value is considered as a constant value.

What is a numeric constant?

Numeric variables having one value throughout the program execution are called numeric constants.

What is non-numeric | Alphanumeric constant?

Alphanumeric variables with only one value throughout the program execution are called alphanumeric constants.

What is a figurative-constant? What are they?

System-defined constants are predefined in the COBOL and used as replacements for standard values like spaces, zeroes, etc. They are -

  • ZERO, ZEROS, ZEROES
  • SPACE, SPACES
  • HIGH-VALUE, HIGH-VALUES
  • LOW-VALUE, LOW-VALUES
  • QUOTE, QUOTES
  • ALL

Comments -

What is a comment?

A comment is a non-executable statement that provides the information about code or business requirements.

How many types of comments are available in COBOL?

These are three types based on their usage and where they are used -

  • IDENTIFICATION DIVISION Comments
  • Full line comments (any division)
  • Floating comment indicator (*>)

Common Questions -

What types of data in COBOL that indicate the compiler’s intent to use the data?

Numeric, alphabetic, and alpha-numeric

What is the aim of using constants and variables in programming?

The aim of using constants and variables in programming is to store and manipulate data within a program to perform calculations, make decisions, and control program flow effectively.

What is the difference between syntax and data handling?

Syntax refers to the structure and rules of a programming language that govern how code is written and analyzed.
Data handling involves manipulating and managing data within a program, including storage, retrieval, and processing.

Frequently Asked Questions -

What do you mean by literals?
How do literals work?

How are COBOL data names defined?

What is constant value?

What is a variable, literal, constant in COBOL?