Recall & Review
beginner Click to reveal answer
What is array traversal?
Array traversal means visiting each element in an array one by one, usually from the first element to the last.
beginner Click to reveal answer
How do you traverse an array forwards in C++?
Use a for loop starting from index 0 up to the last index, accessing each element in order.
beginner Click to reveal answer
What is reverse traversal of an array?
Reverse traversal means visiting array elements starting from the last element to the first.
intermediate Click to reveal answer
Why might you use a step size greater than 1 in array traversal?
Using a step size greater than 1 lets you skip elements, for example, to access every second element.
intermediate Click to reveal answer
What is a common pattern to traverse a 2D array?
Use nested loops: the outer loop for rows and the inner loop for columns to visit each element.
Which loop is typically used for array traversal in C++?
✗ Incorrect
The for loop is most commonly used because it clearly controls the index from start to end.
What is the index of the last element in an array of size n?
✗ Incorrect
Array indices start at 0, so the last element is at index n - 1.
How do you traverse an array backwards?
✗ Incorrect
Reverse traversal starts from the last index (n-1) down to 0.
What does a step size of 2 in traversal do?
✗ Incorrect
A step size of 2 means you move two indices at a time, skipping one element each time.
Which structure is best to traverse a 2D array?
✗ Incorrect
Nested for loops let you access rows and columns systematically.
Explain how to traverse a one-dimensional array forwards and backwards.
Think about how the index changes in each case.
You got /4 concepts.
Describe the pattern to traverse a two-dimensional array and why nested loops are used.
Imagine walking through a grid row by row.
You got /4 concepts.
