35.7k views
1 vote
How would you implement an application that utilizes 2-dimensional arrays to keep track of 5 students' grades, where each student is enrolled in 3 different classes?

a) Store grades in a single array
b) Use nested arrays for each student
c) Utilize separate arrays for each class
d) Combine student and class information in a single array

User AminMal
by
8.0k points

1 Answer

4 votes

Final answer:

To keep track of five students' grades in three different classes, you can use a 2-dimensional array and choose one of the provided options.

Step-by-step explanation:

In order to keep track of five students' grades in three different classes, you can implement a 2-dimensional array.

Option a: To store grades in a single array, you would have a 2-dimensional array with 5 rows (representing the students) and 3 columns (representing the classes).

Option b: Using nested arrays, you would have an array of 5 elements (representing the students), and each element would be an array with 3 elements (representing the classes).

Option c: Utilizing separate arrays for each class, you would have 3 separate 1-dimensional arrays, each with 5 elements (representing the students).

Option d: Combining student and class information in a single array, you would have a 2-dimensional array with 15 rows and 2 columns, where each row represents a student-class combination.

User Sorenoid
by
9.0k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.