CSCI 241 -- Quiz #1

This is an open book, open notes quiz. The quiz is to be turned in by 8:30 PM. Some of these questions have long answers that you should write on your own paper.

Problem 1 (8 points)

Which of the following are invalid words in COBOL? When appropriate, justify your answers.

Problem 2 (5 points)

For what purpose is a Makefile used in the Unix operating system?

Problem 3 (6 points)

Name two differences between DEC COBOL, which we are using in this class, and COBOL 85?

Problem 4 (6 points)

In which COBOL division are you likely to find the word FILLER the greatest number of times? Explain the reasons for your answer.

Problem 5 (12 points)

Suppose the input file to a program is in the following format:

Character positions Field value
1-20 Student name
21-30 Student id
31-32 Number of credit hours this term
33-35 Number of credit hours previously taken
36-42 Amount paid

Assume that amount paid has an implicit decimal point so that $1357.46 would be encoded as 135746. Now give a file descriptor (FD) entry suitable for reading records from this input file.

Problem 6 (12 points)

Suppose you have been asked to generate a list of the credit hours taken by students and the output of the list is supposed to look like:

          Lottie Courses          1233355678   130
          Fresh Student           5551212000     0
          Nil Graduate            7778889990    99

Write a file descriptor (FD) entry appropriate for writing records in this format. Don't worry about the exact number of spaces between the printed fields. Just choose a reasonable value.

Problem 7 (15 points)

Now write a COBOL PROCEDURE DIVISIONthat could read the input records described in Problem 5 and produce the corresponding output records described in Problem 6.

Problem 8 (12 points)

Suppose you have been asked to modify the program written in Problem 7 to only print information about students who will have taken more than 122 hours by the end of this term. Describe, by listing specific changes to your answer of Problem 7, how you would make this change.

Problem 9 (24 points)

Suppose tuition and fees are changed at the following rates:

Credit hours this term Charge
0 $0
1-9 $900
over 9 $1,800

Now write a program that will read records in the format shown in problem 5 and, for every student who owes money (that is, the amount paid is less that the charged tuition and fees), write a record of a form giving the name of the student and the amount owed similar to:

          Imma Indebt             $1,500.70
          Iowe Little             $    0.25

In your answer give a file descriptor (FD) entry for the output file and then write an appropriate PROCEDURE DIVISION.

Back to the exams and quizzes index
Back to the CSCI 241 home page