Picture Clause Interview Questions
What is the PIC clause in COBOL?
PICTURE clause specifies the characteristics of the variable while declaring it, e.g., variable type, length, etc.
What are the two general methods of editing in a picture clause?
PICTURE symbol for editing is used to display the data in the user's desired format. These are classified into two types, and those are -
- Insertion editing
- ZERO suppression and replacement editing
What are insertion editing? How many types?
It is a way to format the data in the numeric variables, for displaying in human-readable format. Those are -
- Simple insertion
- Special insertion
- Fixed insertion
- Floating insertion
Explain the variability between simple, special, fixed, and floating insertion in a picture clause?
- Simple insertion - It involves inserting character(s) like blank, 0, /, and space in the PICTURE string while displaying for better readability.
- Special insertion - It is used to insert the decimal-point while displaying the decimal values of a variable.
- Fixed insertion - It is used to insert fixed characters (-, +, CR, DB, and $) into a numeric edited item.
- Floating insertion - It is used for formatting numeric variables, mainly when dealing with currency values.
Define suppression or replacement in a picture clause?
It involves omitting leading zeros from a number, and replacement editing involves replacing leading zeros with a space or asterisk.
What is Z in COBOL?
Zero suppresssion
What is DB & CR in COBOL?
Both are picture editings. DB displays debit information. CR displays Credit information.
Frequently Asked Questions -
What does COBOL’s PIC clause mean?
What are the four categories of insertion in a picture clause?