106k views
4 votes
Assume that two arrays are parallel. Assume the first array contains a person's id number and the second contains his or her age.

In which index of the second array would you find the age of the person in the third index of the first array?

1. 2
2. 3
3. 1
4. It cannot be determined from the information given.

1 Answer

4 votes

Answer:

Option 2 is the right answer for the above question.

Step-by-step explanation:

A Parallel array is a structure of array used to store the multiple events into one variable. It can store a homogeneous data structure for the various array. when any user wants to create a parallel array then he needs to declare a structure of the array.

Just for example, if a user wants to create two parallel arrays for a person's number and age (as mentioned in the question), then he needs to create a structure of two arrays (one for number and the other for the age). The age array store the employee age at the same index, which index is related to person number array. It is the property of a parallel array.

For example, If a first-person number is '1' and age is '24', then '1' will stored in the first index of the person array and '24' is stored on the first index of age array. It is the property of a parallel array.

Hence the age of the third index of the person array found in the 3 indexes of the age array. Hence 2 option is correct while the other is not because--

  • Option 1 states index '2' which tells the age of the second index of the first array.
  • Option 3 states index '1' which tells the age of the first index of the first array.
  • Option 4 states that the solution is not determined by the question scenario but it can be determined by the help of parallel array property.
User Mamuz
by
5.6k points