CSCI 131,
Fall 2002,
Test 1.
- The weight of each question is given with the question
- Use as much paper as you wish, but make your answers are legible.
- Please answer each question thoughtfully and carefully.
- [15 pts] We have discussed two types of parameters. Name, describe and
give an example of the usage of each. (This should include code)
- [10 pts] Give the synatx of a for loop. Describe the operation of a for loop. (This should include code)
- [5 pts] What is a record? What is a heirarchial record? Give an example of each. (This does not include code)
- [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.
- Declare a record containing the following fields:
- A name (collection of characters)
- A price
- A quantity
- Declare a variable of the record from the previous part.
- 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 pts] What is the difference between declaring a record type and
declaring a variable of a record type?