Cobol Workshop
Quiz
1. What is the output of the following program?
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. BYEBYE.
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 PROCEDURE DIVISION.
000600
000700 PROGRAM-BEGIN.
000800 DISPLAY "Bye bye birdie".
000900 PROGRAM-DONE.
001000 STOP RUN.
2. How many DIVISIONs are in the following program, byebye.cbl?
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. BYEBYE.
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 PROCEDURE DIVISION.
000600
000700 PROGRAM-BEGIN.
000800 DISPLAY "Bye bye birdie".
000900 PROGRAM-DONE.
001000 STOP RUN.
3. How many paragraphs?
4. How many sentences?
5. What is wrong with the following, bad01.cbl?
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. BAD01.
000300 ENVIRONMENT DIVISION.
000400
000500 PROCEDURE DIVISION.
000600
000700 PROGRAM-BEGIN.
000800 DISPLAY "I'm bad!".
000900 PROGRAM-DONE.
001000 STOP RUN.
6. What is wrong with the following, bad02.cbl?
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. BAD02.
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 PROCEDURE DIVISION.
000600
000700 PROGRAM-BEGIN.
000800 DISPLAY "I'm bad!".
000900 PROGRAM-DONE.
001000 STOP RUN.
Hint: Where are sentences supposed to begin?
Note: Some compilers might not give an error on compiling BAD02, but might only provide a warning.
7. What is wrong with the following, bad03.cbl?
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. BAD03.
000300 ENVIRONMENT DIVISION.
000400 DATA DIVISION.
000500 PROCEDURE DIVISION.
000600 This program displays a message.
000700 PROGRAM-BEGIN.
000800 DISPLAY "I'm really bad!".
000900 PROGRAM-DONE.
001000 STOP RUN.