Recall & Review
beginner Click to reveal answer
What is array traversal?
Array traversal means visiting each element in an array one by one to read or process it.
beginner Click to reveal answer
How do you traverse an array from start to end in Java?
Use a for loop starting at index 0 and go up to the last index, accessing each element by its index.
beginner Click to reveal answer
What is reverse traversal of an array?
Reverse traversal means visiting array elements from the last index to the first index.
intermediate Click to reveal answer
Why use enhanced for loop (for-each) in array traversal?
It simplifies code by automatically visiting each element without using an index, but you can't change elements by index.
intermediate Click to reveal answer
What is a common pattern to traverse a 2D array?
Use nested loops: outer loop for rows and inner loop for columns to visit each element in row-major order.
Which loop is best to traverse an array when you need the index?
✗ Incorrect
For loop with index lets you access elements by their position, which is needed when index is important.
What is the first index of a Java array?
✗ Incorrect
Java arrays start at index 0, so the first element is at position 0.
How do you traverse a 2D array row by row?
✗ Incorrect
Nested loops with outer for rows and inner for columns visit each element row-wise.
Which traversal pattern visits elements from last to first?
✗ Incorrect
Reverse traversal visits elements starting from the last index going backward to the first.
What happens if you use enhanced for loop on an array?
✗ Incorrect
Enhanced for loop lets you read each element but does not provide the index or allow direct modification by index.
Explain how to traverse a one-dimensional array in Java and why index is important.
Think about how you visit each element in order.
You got /5 concepts.
Describe the pattern to traverse a two-dimensional array and how nested loops work.
Imagine visiting seats in a theater row by row.
You got /4 concepts.
