Computer Programming MCQ Questions with Solutions
A programmer is making a database of animals in a zoo and their properties. The possible animals are dog, lion and zebra. Each one has as attributes isHerbivorous, colour and isNocturnal. She uses the object oriented programming paradigm for this. How will she conceptualize the system?
A) class: Animal; objects: is Herbivorous, colour and is Nocturnal; data members: dog, lion and zebraB) class: Animal; objects: is Herbivorous, colour and is Nocturnal; data members: dog, lion and zebra
C) classes: dog, lion and zebra; objects: Animal; data members: is Herbivorous, colour and is Nocturnal Tree.
D) None of these
Answer & Description:
A) class: Animal; objects: is Herbivorous, colour and is Nocturnal data members: dog, lion and zebraclass: Animal; objects: dog, lion and zebra; data members: is Herbivorous, colour and is Nocturnal class is a template(logical entity) , objects are instances of class(real entity).