| 1. | What is a variable? | |
| 2. | What is a statement? | |
| 3. | Which of the following are legal names for variables in C++? Firstname &salary No x y first@name | |
| 4. | All valid C++ statements end with a what? | |
| 5. | What type of value must the main function return? | |
| 6. | What is the purpose of brackets? | |
| 7. | What is a local variable? | |
| 8. | What is a global variable? | |
| 9. | If a function does not return anything, then what do you put for its return type? | |
| 10. | What is a parameter? | |
Answers
| 1. | A place in memory set aside to hold data of a particular type. The variable name is simply a reference to that section of memory. |
| 2. | A line of code that performs some action |
| 3. | Firstname Yes &salary No x Yes y Yes first@name No |
| 4. | A semicolon (;) |
| 5. | An int |
| 6. | To establish boundaries for a block of code |
| 7. | A variable declared within some block of code. That variable is only good inside that block of code. |
| 8. | A variable declared outside any block of code. That means it is good throughout all functions in that file. |
| 9. | void |
| 10. | A variable that is passed to a function |