Array Examples in CS Thinking
Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Array.
This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in CS Thinking.
Concept Recap
An ordered collection of values stored together and accessed by their numeric index position.
A numbered list. Item 0, item 1, item 2... Access any by its number.
Read the full concept explanation โHow to Use These Examples
- Read the first worked example with the solution open so the structure is clear.
- Try the practice problems before revealing each solution.
- Use the related concepts and background knowledge badges if you feel stuck.
What to Focus On
Core idea: Arrays store multiple related values under one name, making it easy to iterate over them all.
Common stuck point: Most languages index from 0, not 1. The last element of a 3-item array is at index 2.
Worked Examples
Example 1
easySolution
- 1 Step 1: Arrays use zero-based indexing: scores[0] = 85.
- 2 Step 2: scores[3] = 95 (the 4th element).
- 3 Step 3: The array has 5 elements (length = 5).
Answer
Example 2
mediumPractice Problems
Try these problems on your own first, then open the solution to compare your method.
Example 1
mediumExample 2
mediumRelated Concepts
Background Knowledge
These ideas may be useful before you work through the harder examples.