0% found this document useful (0 votes)
157 views3 pages

Computer ICSE !0 STD

First 5 Chapters

Uploaded by

memeruler28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
157 views3 pages

Computer ICSE !0 STD

First 5 Chapters

Uploaded by

memeruler28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CHAPTER 3

Elementary Concepts of Objects and Classes


Section 3: Assignment Questions

1. What are objects? Give five examples.


Ans. 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. For example, mobile, motor bike, person, car, birds etc.

2. Explain the anatomy of an object.


Ans. Anatomy of an object consists of –
Attributes: These are individual characteristics that differentiate one object from the other.
Behaviour: It is defined by the set of functions or operations an object can perform.
State: It is defined by the set of values held by its attributes.

3. Explain the following statement – “Class is a specification for objects”.


Ans. Objects that share the same attributes and behaviour are grouped together into a class. A class is a
template or blueprint for multiple objects with similar features and may be regarded as a specification for
creating similar objects. Due to this reason, class is also called an object factory that produces multiple objects
of the same type.

4. Explain the following statement – “Abstraction is relative to the perspective of the viewer”.
Ans. Abstraction refers to the act of representing essential features without including the background details.
For example, a building can be viewed as a single component such as, hospital, rather than separate
components like cement, bricks, and rods. Hence, abstraction is relative to the perspective of the viewer.

5. Identify five possible attributes and three possible behaviors of the following entities:

a. School
Ans. Attributes are, name, address, number of classes, number of students, and number of teachers.
Behaviours are, teaching, sports, and music.

b. Student
Ans. Attributes are, name, age, roll number, class, date of birth, and address.
Behaviours are, study, play, and sleep. www.bhuvantechs.com

c. Teacher
Ans. Attributes are, name, age, date of birth, subject, and address.
Behaviours are, taught, play, and walk.

d. Computer
Ans. Attributes are, model, colour, resolutions, weight, and status.
Behaviours are, start, stop ,input, output, and processing.

Elementary Concepts of Objects and Classes ~1~


e. Television
Ans. Attributes are, model, colour, resolutions, make and size.
Behaviours are, start, stop, and change channel.

f. Washing Machine
Ans. Attributes are, model, colour, make, weight, and size.
Behaviours are, washing, drying, and spinning.

g. Chair
Ans. Attributes are, colour, weight, type, make, and size.
Behaviours are, sit, revolve, and comfort.

h. Person
Ans. Attributes are, First name, Last name, Date of Birth, Address. and Aadhar Card number.
Behaviours are, sleep, walk, and run.

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


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

7. Given the reason why a class is known as:

a. An object factory
Ans. A class is called as 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.

b. A composite data type


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

c. A user-defined data type


Ans. 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.
www.bhuvantechs.com

8. How are classes and objects inter-related? Support your answer with an example.
Ans. A class is a template or blueprint for multiple objects with similar features and may be regarded as a
specification for creating similar object.
Once a class has been defined, we can create many objects belonging to that class. An object belonging to a
particular class is known as an instance of that class. Therefore, you can say that a mango is an instance of the
Fruit class. The terms object and instance are often interchangeable.

Elementary Concepts of Objects and Classes ~2~


9. What do you understand by the term objects encapsulate state and behaviour?
Ans. 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 defined 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 an object.

10. Explain how objects communicate with each other.


Ans. Objects communicate with each other by sending messages. The message sending object requests the
message receiving object to perform an action. A message sending object is called the sender while the
message receiving object is called the receiver.

www.bhuvantechs.com

Elementary Concepts of Objects and Classes ~3~

You might also like