Recall & Review
beginner
What is an array in simple terms?
An array is like a row of boxes where each box can hold a value. All boxes are the same size and arranged one after another.
Click to reveal answer
beginner
How do you declare an array of 5 integers in Python?
You can declare it using a list like this:
arr = [0, 0, 0, 0, 0]. This creates 5 boxes holding 0 initially.Click to reveal answer
beginner
What does 'initialization' mean when working with arrays?
Initialization means putting starting values into the array boxes right after creating them.
Click to reveal answer
beginner
Show how to declare and initialize an array with values 1, 2, 3, 4, 5 in Python.
Use
arr = [1, 2, 3, 4, 5]. This creates an array with 5 boxes holding those numbers.Click to reveal answer
beginner
Can arrays in Python change size after creation?
Yes, Python lists (arrays) can grow or shrink by adding or removing elements, unlike fixed-size arrays in some other languages.
Click to reveal answer
Which of these is a correct way to declare an array of 3 zeros in Python?
✗ Incorrect
Option C creates a list with three zeros. Option A is a set, Option B is a tuple, and D creates a list by repeating 0 three times.
What is the index of the first element in a Python array?
✗ Incorrect
Python arrays (lists) start indexing from 0, so the first element is at index 0.
How do you create an array with values 5, 10, 15 in Python?
✗ Incorrect
Option A creates a list (array) with the values. B is a tuple, C is a set, and D is a tuple without parentheses.
What happens if you try to access an index outside the array size in Python?
✗ Incorrect
Accessing an index outside the array size causes an IndexError in Python.
Which of these is NOT a way to initialize an array in Python?
✗ Incorrect
Option C creates a set, not a list (array). The others create lists.
Explain how to declare and initialize an array with 4 elements in Python.
Think about using square brackets and putting values inside.
You got /3 concepts.
Describe what happens when you try to access an array element by index in Python.
Remember how Python counts positions and what happens if you go too far.
You got /3 concepts.