Introduction to Programming

Answers for 8.1P Reading Another Language

 

 

Differences:

  1. Briefly explain (1 paragraph) some of the concepts that each of the three programming languages in this task have in common with each other.
  2. 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:

 

  1. What kind of variable is dataand val? Local, global, parameter? Array? What type?
  2. What about i?
  3. What kind of data will this function return?
  4. What would be returned if the function was called with the data in sample data 1?
  5. What would be returned if the function was called with the data in sample data 2?
  6. What would be a good name for this function?

 

Program 2:

 

  1. What will be output when the program is run?

 

Starting …
ADDING 30 + 5
 
 
 
 
 
 
 

 

  1. What kind of variables are the following? Local, global, parameter? Array? Type?

 

Identifer Description
age
height
fruit

 

Program 3:

 

  1. What will the code output when run?
Checking score: [57, 26, 107, 92, 15]
Checking score 57
 
 
 
 
 
 
 

 

  1. What are individualScores, bonusScore, baseScore, and teamScore? Constant, variable? Local, global, parameter? Array? What type?

 

Identifer Description
individualScores
bonusScore
baseScore
teamScore

 

  1. What do you think the difference is between the keywords letand var? Hint: have a look at how they are used in the code.

 

error: Content is protected !!