Test 1 CSCI 130
Fall 2013
- Please answer each question fully, carefully and thoughtfully.
- No credit will be given for unreadable answers, please write neatly.
- Answer the questions in any order, but please number each answer.
- Make sure that your name is on your test.
- Algorithms
- [2 points] What is an algorithm? Give the definition.
- [4 points] Why is it important to develop and algorithm before you implement a program in code?
- Programming Tools
- [2 points] What is the purpose of a compiler?
- [2 points] What is a secondary purpose of a compiler?
- Identifiers
- [2 points] What is an identifier?
- [1 point each] Identify each identifier as valid. If an identifier is invalid, state why.
- char
- dogsForSale
- 4Sale
- THE_BIG_NUMBER
- interest Rate
- xferate
- Variables
- [2 points] What is a variable?
- [2 points] How is a variable different from an identifier?
- [4 points] Give two conventions for naming a variable.
- Data Types
- [2 points] What is a data type?
- [4 points] Describe the char data type.
- [2 points] Give the code required to declare a character variable.
- [2 points] Give the code required to initialize the value of the character variable in the previous question to the lower case letter a.
- [4 points] Describe the performance of the stream extraction operator when used to read a character.
- [10 points] Write a complete program which will ask the user for a three letter word and print that word out in reverse. (You should NOT use strings for this program).