1.

If an array of objects is of size 10 and a data value have to be retrieved from 5th object then ________________ syntax should be used.(a) Array_Name[4].data_variable_name;(b) Data_Type Array_Name[4].data_variable_name;(c) Array_Name[4].data_variable_name.value;(d) Array_Name[4].data_variable_name(value);The question was asked in examination.My doubt stems from Object Array topic in portion Object of Object Oriented Programming

Answer»

Correct answer is (a) Array_Name[4].data_variable_name;

The explanation is: The array NAME with the index of fifth element is CALLED, i.e. index 4. Then the dot operator is USED to access the data member of that OBJECT. This Allows us to access the data members of all the objects in an object array.



Discussion

No Comment Found

Related InterviewSolutions