Close
Close full mode
logoMakeCode AP CSP

Arrays

Summary

Materials

Instructional Activities and Classroom Assessments

  1. Introduce Arrays (15 minutes)
  2. Activity: Create and Modify Arrays (35 minutes)
  3. Extension
  4. Reflection/Homework

Learning Objectives

  • AAP-1.A Represent a value with a variable. 3.A
  • AAP-1.C Represent a list or string using a variable. 3.A
  • AAP-3.E For generating random values:
    • a. Write expressions to generate possible values. 2.B
    • b. Evaluate expressions to determine the possible results. 4.B 2.B
  • AAP-1.D For data abstraction:
    • a. Develop data abstraction using lists to store multiple elements. 3.B
    • b. Explain how the use of data abstraction manages complexity in program code. 3.C

Essential Knowledge

  • AAP-1.A.1 A variable is an abstraction inside a program that can hold a value. Each variable has associated data storage that represents one value at a time, but that value can be a list or other collection that in turn contains multiple values.
  • AAP-1.A.2 Using meaningful variable names helps with the readability of program code and understanding of what values are represented by the variables.
  • AAP-1.A.3 Some programming languages provide types to represent data, which are referenced using variables. These types include numbers, Booleans, lists, and strings.
  • AAP-1.A.4 Some values are better suited to representation using one type of datum rather than another.
  • AAP-1.C.1 A list is an ordered sequence of elements. For example, [value1, value2, value3, ...] describes a list where value1 is the first element, value2 is the second element, value3 is the third element, and so on.
  • AAP-1.C.2 An element is an individual value in a list that is assigned a unique index.
  • AAP-1.C.3 An index is a common method for referencing the elements in a list or string using natural numbers.
  • AAP-3.E.1 The exam reference sheet provides RANDOM(a, b) Block: RANDOM a, b which generates and returns a random integer from a to b, inclusive. Each result is equally likely to occur. For example, RANDOM(1, 3) could return 1, 2, or 3.
  • AAP-1.D.1 Data abstraction provides a separation between the abstract properties of a data type and the concrete details of its representation.
  • AAP-1.D.2 Data abstractions manage complexity in programs by giving a collection of data a name without referencing the specific details of the representation.
  • AAP-1.D.3 Data abstractions can be created using lists.
  • AAP-1.D.8 The exam reference sheet describes a list structure whose index values are 1 through the number of elements in the list, inclusive. For all list operations, if a list index is less than 1 or greater than the length of the list, an error message is produced and the program will terminate.

Details

1. Introduction to Arrays (15 minutes)

  • Define lists in computer science.
  • Explain how lists are used.
  • Demonstrate how to create a list in MakeCode.
  • Discuss lists on the Exam Reference Sheet.
  • Explain the difference between how arrays in MakeCode begin at index 0 and how on the AP exam lists begin at index 1.
  • Examine the different type of array procedures.
  • Discuss existing types of algorithms using lists and iteration.

2. Activity: Create and Modify Arrays (35 minutes)

  • Direct students to the Arrays Work page.
  • Students will go to the Activity: Arrays Intro webpage.
  • Instruct students to complete Tasks 1-2.
  • Encourage students to publish their work and paste the links on their Arrays Work page.

3. Extension

  • If students finish early, they can complete the extension activity.
  • Encourage students to use JavaScript or Python to create the projects from Task 1 and 2.
  • You can also encourage students to incorporate these concepts into an existing project.

4. Reflection/Homework

If you run out of time, you may also assign this as individual homework. Students should complete their reflection.

  1. What is the difference between creating an array of numbers and storing multiple values as individual variables (as in, value1 = 1, value2 = 2, value3 ...)?
  2. What can an array do that storing different variables by themselves cannot?
  3. How does the length of an array relate to the position of the final element?
πŸ“˜ Unit 5 - AAP Part 2 β€” Previous
Day 14
Next β€” πŸ“˜ Unit 5 - AAP Part 2
Arrays Work