KnowledgeBoat Logo
OPEN IN APP

Chapter 3

Elementary Concepts of Objects and Classes

Class 9 - Logix Kips ICSE Computer Applications with BlueJ



Multiple Choice Questions

Question 1

An object has ...........

  1. Attributes
  2. State
  3. Behaviour
  4. All of these ✓

Explanation

An object is an identifiable entity that has a set of attributes, behaviour and state. So all of the options are applicable for objects.

Question 2

A class is ...........

  1. An object factory
  2. A blueprint to create objects
  3. A specification for objects
  4. All of these ✓

Explanation

A class is a template or blueprint for multiple objects with similar features and maybe regarded as a specification for creating similar objects. So all of the options are applicable for class.

Question 3

........... represents an entity in the real-world with its identity and behaviour.

  1. A class
  2. An object ✓
  3. A procedure
  4. A method

Explanation

An object is an identifiable entity with a set of attributes, behaviour and state.

Question 4

........... is a template to create similar objects that share common characteristics and behaviour.

  1. A function
  2. A procedure
  3. An attribute
  4. A class ✓

Explanation

A class is a template or blueprint for multiple objects with similar features and maybe regarded as a specification for creating similar objects.

Question 5

The values of an object's ........... represent the state of the object.

  1. Methods
  2. Procedures
  3. Attributes ✓
  4. Classes

Explanation

Attributes of an object define its state.

Question 6

The terms object and ........... are often interchangeable.

  1. Instance ✓
  2. Behaviour
  3. Attribute
  4. State

Explanation

The terms object and instance are often interchangeable.

State whether the given statements are True or False

Question 1

A class is a specification about the object.
True

Question 2

Only one instance can be created from a single class.
False

Question 3

A class is a user-defined data type.
True

Question 4

Real world objects encapsulate state and behaviour.
True

Question 5

There can be multiple abstraction of the same entity.
True

Question 6

Objects interact with each other through messages.
True

Assignment Questions

Question 1

What are objects? Give five examples.

Answer

Objects are identifiable entities that have a set of attributes, behaviour and state. Five examples of objects are car, pen, mobile, email, bank account.

Question 2

Explain the anatomy of an object.

Answer

Objects are the basic units of an object oriented system. An object is an identifiable entity that has its own set of attributes, behaviour and state. Attributes are individual characteristics that differentiate one object from another. Behaviour is defined by the set of functions or operations an object can perform. State is defined by the set of values held by its attributes.

Question 3

Explain the following statement — "Class is a specification for objects".

Answer

As class describes the common attributes and behaviours of its objects in detail, hence we can say that a class is a specification for objects. It can be viewed as a template or blueprint for multiple objects with similar features.

Question 4

Explain the following statement — "Abstraction is relative to the perspective of the viewer".

Answer

It means that there can be different abstractions of an entity depending on the viewpoint of the user. Lets take the example of a pet dog. From the viewpoint of the dog's owner, the things that are essential for the dog are his favorite food, the colour of his food bowl, his favorite game that he enjoys playing with his owner, his preferred time for walk, etc. From the viewpoint of the dog's vet (doctor for animals), the important things about the dog are whether the dog's body functions are normal or not to ensure that the dog is healthy. Like this, there can be two abstractions for the dog — one for the dog's owner and the other for the dog's vet.

Question 5

Identify five possible attributes and three possible behaviours of the following entities:

a. School

Answer

AttributesBehaviours
NameSchool Starts
AddressSchool gets over
BoardSchool conducts exams
Principal 
Number of Students 
Number of Teachers 

b. Student

Answer

AttributesBehaviours
NameStudy
AddressPlay
ClassSleep
Section 
Roll No. 

c. Teacher

Answer

AttributesBehaviours
NameTeach Class
School NameConduct Tests
SubjectMaintain discipline in class
Class 
Address 

d. Computer

Answer

AttributesBehaviours
ManufacturerStart Computer
ModelShutdown Computer
ProcessorRun applications
RAM 
Hard Disk 

e. Television

Answer

AttributesBehaviours
ManufacturerTurn On
ModelTurn OFF
SizeWatch Programmes(Movies, News, Cartoons, etc.)
Smart 
Resolution 

f. Washing Machine

Answer

AttributesBehaviours
ManufacturerStart Wash
ModelStop Wash
CapacityRinse
Energy Rating 
Noise Level 

g. Chair

Answer

AttributesBehaviours
MaterialBuy
ColourSell
WeightSit
RevolvingRepair
Price 

h. Person

Answer

AttributesBehaviours
First NameEat
Last NameSleep
AgeWalk
Gender 
Address 

Question 6

Explain in detail how a class is different from an object.

Answer

The class is just a specification of the object. The attributes and methods in the class are thus declarations that do not contain any values. However, the object is a concrete instance of a class with properly defined values for each attribute and behaves as per the methods of the class.

Question 7

Give the reason why a class is known as:

i. An object factory

Answer

A class is called an object factory because objects are created from the class that contains common attributes and behaviour. The class behaves like a specification for creating such similar objects.

ii. A composite data type

Answer

A class is composed of member variables which are of different data types. Hence, a class can be viewed as a composite data type.

iii. A user-defined data type

Answer

The entire data and the code, contained in an object, becomes a user-defined data type using the concept of a class. The class may be considered as a data type and an object as a variable of that data type. For example, once the Bird class has been defined, the statement
     Bird parrot;
will create a parrot object belonging to the Bird class.

Question 8

How are classes and objects inter-related? Support your answer with an example.

Answer

A Class is used to create various Objects that have different attributes and common behaviours. Each object follows all the features defined within a class. That is why class is also referred to as a blue print or prototype of an object. For example, a class representing a car will have the following characteristics and behaviours:

AttributesBehaviours
ModelStart car
Registration NumberStop car
ColourApply break

We can create two objects of this class to represent a red i20 car and a white Baleno car as shown below:

AttributesBehavioursState
ModelStart carModel: i20
Registration NumberStop carRegistration Number: KA 01 AA 1234
ColourApply breakColour: Red
AttributesBehavioursState
ModelStart carModel: Baleno
Registration NumberStop carRegistration Number: WB 01 AZ 6789
ColourApply breakColour: White

Question 9

What do you understand by the term objects encapsulate state and behaviour?

Answer

An object stores its state in member variables and exposes its behaviour through the member methods. The member methods operate on member variables and serve as the primary mechanism to interact with the object. Only the member methods which are wrapped inside the class can access the data and change its state. Hence, the state and behaviour are said to be encapsulated by the object, hiding internal state and requiring all interaction to be performed through the methods of the object.

Question 10

Explain how objects communicate with each other?

Answer

Objects communicate with each other by sending messages. The sender object requests the receiver object to perform an action.

Video Explanations

PrevNext