CSCI 131,

Fall 2002,

Test 1.


  1. [15 pts] We have discussed two types of parameters. Name, describe and give an example of the usage of each. (This should include code)
  2. [10 pts] Give the synatx of a for loop. Describe the operation of a for loop. (This should include code)
  3. [5 pts] What is a record? What is a heirarchial record? Give an example of each. (This does not include code)
  4. [15 pts] You are writing a program to perform inventory for a shop. You have decided to store information about items in the shop in a record. One record for each item.
    1. Declare a record containing the following fields:
      • A name (collection of characters)
      • A price
      • A quantity
    2. Declare a variable of the record from the previous part.
    3. Write a procedure which prompts a user for an item name, an item price and and item quantity and returns a reqord containing these values.
  5. [5 pts] What is the difference between declaring a record type and declaring a variable of a record type?