Midterm Spring Answer 2020

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

CST8283 BUSINESS PROGRAMMING -- MIDTERM EXAM Spring 2020

NAME _________________________________________________

Student Number __________

Instructions
This is an open book test. Answer each of the 6 questions as indicated.
Submit this document with your answers via e-mail with the following subject line
---- CST8283 MIDTERM 1
You must submit your exam answers no later the 6:00 pm

Question 1 10 points
The table below provides the PIC and contents of a SENDING FIELD
and the PIC of the RECEIVING FIELD. For each item, a MOVE is made
from the SENDING FIELD to the RECEIVING FIELD. For each line identify
whether the value in the RECEIVING FIELD is correct or incorrect after
the MOVE is made. Note your answer in the ANSWER column – Mark C
if the Receiving Field Value is correct; mark W if the value is
incorrect.
Blanks are recorded with a “b”; zeros with a 0.

SENDING FIELD SENDING FIELD VALUE RECEIVING FIELD RECEIVING ANSWER


FIELD VALUE
A PIC X(6) 1234bb PIC X(5) 1234bb W 1234b
B PIC X(5) 12AB5 PIC 9(5) 12AB5 W
C PIC X(4) JOHN PIC X(6) JOHN00 W JOHNbb
D PIC X(6) 123456 PIC X(4) 3456 W 1234
E PIC A(6) bbABCD PIC X(4) bbAB C

1 of 6
This study source was downloaded by 100000880260209 from CourseHero.com on 02-15-2024 09:31:29 GMT -06:00

https://www.coursehero.com/file/73369336/MIDTERM-SPRING-ANSWER-2020-doc/
CST8283 BUSINESS PROGRAMMING -- MIDTERM EXAM Spring 2020

Question 2 10 points
For each of the following lines of code in questions, determine whether the syntax (code
structure) is valid or invalid.
Simply highlight your selection in bold.

a) FILE-CONTROL.
SELECT “N:\FILE123.TXT” .
ASSIGN TO STDENT-FILE-IN.
ORGANIZATION IS LINE SEQUENTIAL.
valid
invalid
b) MOVE D TO A, B, C.
valid
invalid

c). PERFORM RTN-X TIMES.


valid
invalid
d) 01 COURSE-NAMES PIC X(5).
05 COURSE-ID PIC X(10).
valid
invalid
e). IF A > B AND A = C OR A < C
PERFORM WHAT-HAPPENED-HERE-RTN.
valid
invalid

2 of 6
This study source was downloaded by 100000880260209 from CourseHero.com on 02-15-2024 09:31:29 GMT -06:00

https://www.coursehero.com/file/73369336/MIDTERM-SPRING-ANSWER-2020-doc/
CST8283 BUSINESS PROGRAMMING -- MIDTERM EXAM Spring 2020

Question 3 10 points
For the following logical statement, examine the code given and select the COBOL code
that will execute the logical statement.
Highlight your selection in bold.

A module (LABEL-PRINT) has already been coded to construct and print one address
label. The number of labels to be printed has been entered and resides in a field called
NUMBER-LABELS. Write the code to execute the module LABEL-PRINT the
appropriate number of times. When the labels have been printed, an invoice is to be
printed through a module called INVOICE-PRINT which has already been coded. Your
code will reside in a routine called MASTER-LABEL-RTN.

(a) PERFORM LABEL-PRINT.


PERFORM INVOICE-PRINT.

(b) PERFORM LABEL-PRINT NUMBER-LABELS TIMES..


PERFORM INVOICE-PRINT.

(c) MASTER-LABEL-RTN.
PERFORM LABEL-PRINT NUMBER-LABELS TIMES..
PERFORM INVOICE-PRINT.
(d) MASTER-LABEL-RTN.
PERFORM LABEL-PRINT NUMBER-LABELS TIMES..

(e) MASTER-LABEL-RTN.
PERFORM LABEL-PRINT TIMES..
PERFORM INVOICE-PRINT.

3 of 6
This study source was downloaded by 100000880260209 from CourseHero.com on 02-15-2024 09:31:29 GMT -06:00

https://www.coursehero.com/file/73369336/MIDTERM-SPRING-ANSWER-2020-doc/
CST8283 BUSINESS PROGRAMMING -- MIDTERM EXAM Spring 2020

Question 4 10 points
Write the code that will establish the required table and the values within the table given
the following requirements.
Salary levels for employees are in the following range 10, 12, 14, 16 and 18.
The table should be set up so that these salary values are in sequence. The table will
therefore have five occurrences.
Draft the code that will accept a values from the keyboard and display the proper salary
values Include any Working Storage entries required.

WORKING-STORAGE SECTION.
01 SALARY-RANGES.
05 FILLER PIC 9(2) VALUE 10.
05 FILLER PIC 9(2) VALUE 12.
05 FILLER PIC 9(2) VALUE 14.
05 FILLER PIC 9(2) VALUE 16.
05 FILLER PIC 9(2) VALUE 18.
01 SALARY-RANGES-RED.
05 SALARY-LEVEL OCCURS 5 PIC 9(2).

01 SALARY-LEVEL-NUMBER PIC 9(1).

PROCEDURE DIVISION.
DISPLAY “ENTER SALARY LEVEL NUMBER”.
ACCEPT SALARY-LEVEL-NUMBER.

DISPLAY SALARY-LEVEL (SALARY-LEVEL-NUMBER).

4 of 6
This study source was downloaded by 100000880260209 from CourseHero.com on 02-15-2024 09:31:29 GMT -06:00

https://www.coursehero.com/file/73369336/MIDTERM-SPRING-ANSWER-2020-doc/
CST8283 BUSINESS PROGRAMMING -- MIDTERM EXAM Spring 2020

Question 5 10 points
01 STUDENT-AVERAGE PIC 9(3)
88 HIGH-AVARAGE VALUE 80 THROUGH 100.

IF HIGH-AVERAGE PERFORM PRES-LETTER, SET-A


ELSE PEFORM SET-GRADE.

IF AVERAGE = 80 OR > 80 PERFORM PRES-LETTER SET-A


ELSE PERFORM SET-GRADE.

IF AVERAGE >= 80 80 PERFORM PRES-LETTER SET-A


ELSE PERFORM SET-GRADE.

IF AVERAGE IS EQUAL TO OR GREATER THAN 80


PERFORM PRES-LETTER SET-A
ELSE PERFORM SET-GRADE.

Give the code above, code two different conditional constructs (statements) that will
handle the following requirements. Note – one of the conditional statements must use
Condition Names (declare these condition names)

If the STUDENT AVERAGE is equal to or greater than 80, then a procedure called
PRES-LETTER and a procedure called SET-A are to be executed.
If less than 80, then a procedure called SET-GRADE is to be executed. These three
procedures have already been coded.

Question 6 10 points
A table has been coded that contains the names of the months of the year as follows --
MONTH-NAMES OCCURS 12 TIMES where the first month is JAN, and the last
month is DEC.
Write the code that will accept the proper values from the Date/Time environment on the
computer platform and will display the correct month name.
Include any Working Storage declarations required.

DATA DIVISION
WORKING-STORAGE SECTION.
01 DATE-NUMBER.
05 YEAR-NUMBER PIC 9(2).
05 MONTH-NUMBER PIC 9(2).
05 DAY-NUMBER PIC 9(2).

PROCEDURE DIVISION.
ACCEPT DATE-NUMBER FROM DATE.
DISPLAY MONTH-NAMES (MONTH-NUMBER).

5 of 6
This study source was downloaded by 100000880260209 from CourseHero.com on 02-15-2024 09:31:29 GMT -06:00

https://www.coursehero.com/file/73369336/MIDTERM-SPRING-ANSWER-2020-doc/
CST8283 BUSINESS PROGRAMMING -- MIDTERM EXAM Spring 2020

6 of 6
This study source was downloaded by 100000880260209 from CourseHero.com on 02-15-2024 09:31:29 GMT -06:00

https://www.coursehero.com/file/73369336/MIDTERM-SPRING-ANSWER-2020-doc/
Powered by TCPDF (www.tcpdf.org)

You might also like