Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
Given the following 2D array:
String [][] ingredients = { {"flour", "sugar", "butter", "salt"}, {"oil", "peanuts", "chocolate", "berries"}};
Which of the following are the first three values visited when the ingredients array is traversed in row-major order?
ingredients
"flour" "sugar" "butter"
"flour"
"sugar"
"butter"
"oil" "peanuts" "chocolate"
"oil"
"peanuts"
"chocolate"
"flour" "oil" "sugar"
"berries" "salt" "chocolate"
"berries"
"salt"
"butter" "berries" "salt"