CTP 108
COMPUTER PROGRAMMING FOR BUSINESS
QUIZ 2 ANSWER

Q1. Write PICTURE character-string for the following field specification.(5 pts.)

a. PIC 9(5)..	(Five integer-digit unsigned numeric)
b. PIC S99V9.	(Three digit signed numeric with one decimal digit)
c. PIC X(11).	(Eleven position alpanumeric)
d. PIC A(7)..	(Seven  position alphabetic) 
e. PIC 999V99	(Five digit unsigned numeric with two decimal digit)

Q2. Which of the following line or lines are comments: 
(3 pts.)

12345678 - Column Number
  *MOVE 1 TO A
  * MOVE ZERO TO A    
       THIS IS COMMENT
      *
      THIS IS A COMMENT.
      * THIS IS A COMMENT.
      *THIS IS A COMMENT. 
       ADD 1 TO A.

*
* THIS IS A COMMENT.
*THIS IS A COMMENT.

Q3. You are given the division of a COBOL pgm. On the left and on the right there are the functions of those divisions in random. Match the division names with these functions. (4 pts.)

a. IDENTIFICATION DIVISION		..d. executable statements
b. ENVIRONMENT DIVISION		        ..b. specification of computer equipment used 					     by the program
c. DATA DIVISION			..a. description and comments about the
                                             program
d. PROCEDURE DIVISION		        ..c. definitions of all items (variables) used
					     by the program

Q4. Correct the following DATA DIVISION entries. (8 pts.)
 
DATA DIVISION.			........................................
FILE-SECTION.			FILE SECTION.
FD STD-FILE.			........................................
01 WRITE.			RESERVED WORD
   05 STU-NAME          PIC X(12).	05 STU-NAME.
      10 STU-FIRST-NAME PIC X(20)	   10 STU-FIRST-NAME PIC X(20).
      10 STU-LAST NAME  PIC X(12).         10 STU-LAST-NAME  PIC X(12).
   05 CREDITS PIC 999.		........................................   
   05 GPA     PIC 9V99.		........................................
   05 STU-ENROLL-DATE.		........................................
      03 STU-ENROLL-MM  PIC 99.      10 STU-ENROLL-MM PIC 99.
      03 STU-ENROLL-DD  PIC 99.      10 STU-ENROLL-DD PIC 99.
      03 STU-ENROLL-YY  PIC 99.	     10 STU-ENROLL-YY PIC 99.

Back to first page...