CS251: Programming Languages

Homework 1

Due Thursday, February 4

This homework covers Chapters 1 and 2 of the text: Pseudocodes and FORTRAN.

Do problems 1, 2, 3, 4, 5, 6, 8, 10 listed below. The remaining two problems (7 and 9) count as extra credit.

  1. MacLennan 1.8 (p.11)
  2. MacLennan 1.11 (p.11) Note that there are actually many correct answers to this question.
  3. MacLennan 1.20 (p.15)
  4. MacLennan 1.43 (p.27)
  5. MacLennan 2.3 (p.43) Consult the FORTRAN syntax (in the handout) to write it correctly. It may help to write it first in Java and then "translate it" to FORTRAN.
  6. MacLennan 2.6 (p.45)
  7. MacLennan 2.25 (p.75) To check your answer, the correct calculations lead to dm and c.
  8. MacLennan 2.31 (p.87)
  9. MacLennan 2.35 (p.91) To understand it better, consider writing a program that can read a character at a time from the input and outputs yes or no depending on whether it read a DO statement.
  10. What are the principles mentioned in Chapters 1 and 2?