Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is the first index of an array?
Think about how counting starts in programming.
Explain how you would print all elements in an array.
Consider using numbers.length to define the loop's range.
What is the primary purpose of array traversal?
Think about what we do with each element in the array.
True or False: We can use a while loop to traverse an array.
Consider other loop structures you have learned.
You have an array of temperatures measured over a week. Write a program that calculates the average temperature from the array.
Use your traversal skills to sum up the values correctly.
Create a two-dimensional array representing a matrix. Write a program that prints the sum of each row.
Remember to first iterate through the rows and then the columns.
5 more questions in this section. Enroll free to practise them all.
Enroll free