Final Test Information

The final test will be an on-line test (similar to the mid-term test).  It will be on Blackboard.  You will need a proctor that I will e-mail with the password to get to the test.  It has true/false questions (see examples below), multiple choice, and  short coding / short answer questions - for a grand total of around 100 points [and considering that the average program is worth 10 points - that's a lot of points!!!].  It will actually be about 30% of your final grade!!!  It should take you about 2 hours to complete.  

More specifically, there are questions relating to sorting; questions relating to control breaks, questions on data validation, and  miscellaneous questions - such a picture clauses, 88-level conditional names, etc.

It will be CLOSED BOOK, CLOSED NOTE, CLOSED PROGRAMS test. 

Sample Questions:

___ 1 Coding a five digit numeric output field with ++,++9 will always give accurate output.

___ 2 If several options exist for an IF statement that must be checked separated, it may be advisable to use the EVALUATE statement.

___ 3 When using relational operators to form conditionals most COBOL compilers require a blank space on each side of the symbol.

___ 4 An in-line PERFORM can not contain another nested in-line PERFORM.

___ 5 A major control break module or routine should begin by forcing a minor control break routine.

___ 6.  You can only sort on ascending keys.

___ 7.  You can have multiple sort keys

___ 8.  If you want to do processing prior to sorting, it is called an ENTERING-PROCEDURE

___ 9.  With a process prior to sorting, you can create a new field that will be used in sorting (for example, you for input you have hours-worked and rate-of-pay, and in the input procedure you calculate gross-pay, you could use that new field for sorting).

___ 10.  For control breaks, the data must be arranged / sorted on the key field

___ 11.  In our programs, the major field was the division and the minor field was the department.

___ 12.  When a control break occurs, there are two general processes we want to do - do the summary for the last unit / department / state; and set up for the new unit / department / state.

___13.  With multiple control fields, on a major field change, you should do the major field totals first and then the minor field totals.

___14.  On data validation, this would be a good test for a numeric field:  IF SALES-IN IS NOT NUMERIC ...

___15.  With 88 level conditional names, you can specify meaningful aliases that can be used in if statements.

___16.  You have a field called MARITAL-IN pic X, with acceptable values of  "S" "M", "D" or "W" (single, married, divorced, widowed).  The following code would be okay:
       88 VALID-MARITAL    PIC X VALUES "S", "M", "D", "W".

___ 17.  You have a field called POINTS-IN - with an acceptable range for a Bonus from 80 to 120.  The code could be:
    05  POINTS-IN        PIC 999.
       88 BONUS-POINTS        VALUES 80 - 120.

___18.   For interactive programming, you use the GET AND DISPLAY verbs.

___19.  For interactive programming, you can get a new screen with the BLANK SCREEN statement.

___20.  COBOL has a built in function called INTEGER-OF-DATE that is used to convert a date (like 12/20/2002) into a integer - and is generally used for finding the difference between two dates.

Answers:

1)  false - because of the + signs the first value may be truncated - for example -45678 would become  -5,678)

2) true - the evaluate statement works well with multiple conditions

3) true - although newer versions don't always require a space, it also is helpful for readability

4) false - you can 'nest' in-line performs

5) true - a major break should first perform the minor break (remember the two-level control break lab)

6) false - you can sort on both ascending and descending keys

7) true - you can have multiple fields

8) false - it is called an INPUT-PROCEDURE

9) true - although we haven't done it (yet ... wait for COBOL II)

10) true - the data must be in order on the key field, or you would get a control break on every record (potentially at least)

11) false - our data was organized on the state as the major field and level as the minor field

12) true - the logic is different for the first record (just do the setup) and the last record (just do the summary)

13) false - do the minor fields first and then the major fields - so that the minor field totals are added to the major totals

14) true - asking if a numeric field is not numeric is correct

15) true - 88 levels let us define aliases that can be used in IF statements.

16) false - on the 88 level you do NOT have the word PIC.

17) false - on the 88 level you use the word THRU (like VALUES 80 THRU 120).

18) false - the verbs are ACCEPT and DISPLAY.

19) true - the BLANK SCREEN will give you a new (blank) screen.  You can also do forms and other interesting things with interactive programs - (wait for COBOL II)

20) true - it gives you a sequential value that can be used to determine the number of days between two dates for example.

  There will also be short answers relating to output pictures - like this:

COBOL Pictures – review for the final test

Consider these examples (answers given below) – find the end result of MOVE NUM-1 TO NUM-1-OUT

Prob #

Num-1

Num-1 Pic

Num-1-out Pic

Num-1-out display

1

-45650

PIC S999V99

ZZ9.99CR

 

2

-45650

PIC S99999

++,++9

 

3

-45650

PIC S999V99

---,--9

 

4

-45650

PIC S999V99

--,--9.99

 

5

489

PIC 999

Z,ZZ9

 

6

489

PIC 999

$,$$9

 

7

489

PIC 999

$$9

 

8

489

PIC S999

+,++9

 

9

489

PIC S999

-,--9

 

10

489

PIC S999

ZZ9CR

 

 

Answers (don’t peek too soon):

 1.  456.50CR  - the CR indicates Credit and only is printed when the output value is negative (as it is in this case). (Note - sometimes the CR has a B in front of it to give a blank space - like ZZ9.99BCR.)

 2.  -5,650  - the plus signs require that a sign is printed either positive or negative (and since this value was negative a negative sign would be printed) but the field isn’t wide enough, so the first digit gets truncated.

 3.  -456   - the values to the right of the decimal place are truncated the output will have a negative sign since the value is negative

 4.  -456.50  - the extra leading spaces will be filled with blanks (the negative [and plus] signs are also zero suppressing)

 5.  489  - pretty straight forward

 6.  $489  since the value is not over 1000, there is not a comma and therefore the floating dollar sign appears right before the value

 7.  $89 oops  the dollar sign requires that a dollar sign is output and so we truncate the leading digit

 8.  +489 since the value is not over 1000 and since we must have a sign (the plus says  am positive that I want a sign in the output)

 9.  489  almost the same logic as #8

 10.  489  the CR has no effect since the value is positive

 

Return to the main menu page