RU beehive logo ITEC dept promo banner
ITEC 380
2014fall
ibarland

most recent semester

hw01
book background
due Sep.02 (Mon)

Due Sep.02 (Wed) (hardcopy, and on D2L) Your name and the assignment-number must be in a comment at the start of the file.

  1. (9pts) Chapter 1, Review Questions1
    1. #6
    2. #9
    3. #10
    4. #11. If you add the words “The keyword …” to the front of the question, it might help guide you to the answer.                  can used to implement control-flow.
    5. #14 type checking parameters is important because                 
    6. #15 Aliasing is                 
  2. (2pts) Which languages might be involved in setting up an on-line order system, for a store?
    (Feel free to chat with people who have taken Software Engineering.)

  3. (6 pts) Chapter 1 gives six costs associated with a programming language. Which single cost do you think is most important for…
      (Just give the name of the category, e.g. “compiling programs”.)
    1. code controlling the space shuttle launch
    2. code for a payroll program to be used by a Coca-Cola International.
    3. code for a scientific simulation of proteins in a cell, to help develop new drugs.
    4. code to compute what percentage of RU students have more than one picture on their RU home web page. (Suppose that a friend is writing a report for a Media Studies project, and wants to include this statistic.)
    5. Code for maintaining all aspects of a course gradebook (entering and editing information, adding new features on demand like “replace-lowest-hw-with-exam-percentage”, generating web-views for instructor and students, adding new features to the web-views as requested, etc.).

    Which of the five example programs above is most “typical” do you think, of the sort of programs most programmers tend to work on?

  4. (3pts) Short answer: define each term in a few words, and give an example of a language:
    1. Type-safe
    2. Statically typed
    3. Dynamically typed
  5. (2pts) Two definitions:
    soundness
    A static type-checker being sound means that:
    if the type-checker validates a program, then the program can never encounter any type errors (at run-time).
    (This is the same as2 type-safe.)
    complete
    A static type-checker being complete means that:
    if a program can never encounter any type errors (at run-time), then the type checker will validate it.
    The Java type checker is sound, but not complete. Give a sample Java program which (if the type-checker let it compile) would never give a type error, yet it does not actually compile.
    hint: Your program need not be useful at all, so long as it illustrates this point.
    Write a program which has an illegal `return` statement that is never ever reachable.
  6. (3pts) Open DrRacket (either in labs, or you can download it to your own computer from racket-lang.org). The first time you start DrRacket, it will ask you to choose a language; select Language > Use Language... > Teaching Languages > Beginning Student, for now.

    Type each of the following expressions into the top window, and evaluate them (Racket > Run). Paste the results into your answer file.

    1. (+ 2 3)
    2. (+ 2 3 (* 4 5) 6)
    3. (substring "Mississippi" 3 6)
    4. (> 4 3)
    5. (or (string=? "Miss" (substring "Mississippi" 3 6))
          (> 4 3)
          (/ 5 0))
      
      (To yourself: Is there any reason why you might expect this expression to have an error?)
    6. 3
    7. 2 + 3 (Note: this is actually three different expressions in a row, so there are three resulting values.)
    8. (3) (Give the error that this produces.)
    9. ((+ 2 3)) (Give the error that this produces.)


1 Short correct answers get more credit than long correct answers; use a single word when possible.      

2 Why are "type-safe" and "sound type-checker" two ways of saying the same thing? The terms “Soundness” and “completeness” are general traits of any theorem-proving system.      

most recent semester


©2014, Ian Barland, Radford University
Last modified 2014.Sep.27 (Sat)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.