Computer Science : Object-Oriented Development

Study concepts, example questions & explanations for Computer Science

varsity tutors app store varsity tutors android store

Example Questions

Example Question #1 : Object Oriented Development

Consider the following C++ pseudocode:


Class Car {

const int wheels = 4;

float milesPerGallon;

string make;

string model;



Car sportscar = new Car;

What is the difference between the class car, and the object sportscar?

Possible Answers:

Car is instantiated from sportscar.

They are the same.

sportscar is instantiated from Car.

They are both instantiated from something else.

They have no relation.

Correct answer:

sportscar is instantiated from Car.


When programming within the Object-Oriented paradigm, think of the class as a blueprint, and the object as a house built from that blueprint.

The class Car is a abstract specification that does not refer to any one particular instance. It is merely a protocol that all objects wishing to be cars should follow. The sportscar object is a realization of the car blueprint. It is a specific instance. In programming jargon, "sportscar is instantiated from Car."

Learning Tools by Varsity Tutors