Answer
The output of the given code will be
Person
Student
Work Step by Step
a. The person object can directly call the printPerson function which will then call getInfo function which will return Person, so Person will be printed.
For student object the printPerson function is not overridden so the the definition mentioned in the parent class will be used but the getInfo function is overridden so the new definition will be used which will return Student, which will be printed.
b. In this case the getInfo function is private in both class so it will only be accessible only in their class, since the printPerson is in the Person class it will only be able to access the getInfo of Person class only.