1.

In which case the classes can be used to make the more efficient program?(a) To define a function that is called frequently in a program(b) To structure data that is most similar(c) To group the most similar data and operations(d) To define a blueprint that shows memory location of dataThis question was addressed to me in an online interview.The query is from Class Use topic in division Classes of Object Oriented Programming

Answer»

Right OPTION is (c) To group the most similar data and OPERATIONS

The explanation: The classes would be more suitable to use in case where we need to group the most similar data and operations. The data can be REPRESENTED as data members of class and operations as member functions of class. This is indirectly ENCAPSULATION feature.



Discussion

No Comment Found

Related InterviewSolutions