Introduction to Programming
Answers for 8.1P Reading Another Language
Differences:
- Briefly explain (1 paragraph) some of the concepts that each of the three programming languages in this task have in common with each other.
- Briefly explain (1 paragraph) some of the syntax differences between the three programming languages in this task. Which one of the three do you find easiest to read? Why?
Program 1:
- What kind of variable is dataand val? Local, global, parameter? Array? What type?
- What about i?
- What kind of data will this function return?
- What would be returned if the function was called with the data in sample data 1?
- What would be returned if the function was called with the data in sample data 2?
- What would be a good name for this function?
Program 2:
- What will be output when the program is run?
Starting … |
ADDING 30 + 5 |
- What kind of variables are the following? Local, global, parameter? Array? Type?
Identifer | Description |
age | |
height | |
fruit |
Program 3:
- What will the code output when run?
Checking score: [57, 26, 107, 92, 15] |
Checking score 57 |
- What are individualScores, bonusScore, baseScore, and teamScore? Constant, variable? Local, global, parameter? Array? What type?
Identifer | Description |
individualScores | |
bonusScore | |
baseScore | |
teamScore |
- What do you think the difference is between the keywords letand var? Hint: have a look at how they are used in the code.