Concepts of Class and Object

Section A

2005

Question 1
(a) Name any two OOP'S principles. [2]

1) Data abstraction, 2) Encapsulation

2006

Question 1
(a) Define encapsulation. [2]

Encapsulation refers to the act of wrapping up of data and functions that operate on data, into a single unit which is called class.

(b) Explain the term object using an example. [2]

An object is an identifiable entity with some characteristics and behaviour. Parrot is an object which belongs to the class Bird. Nokia is an object of the class MobilePhone.

2008

Question 1
(d) What is inheritance and how is it useful in Java? [2]

Inheritance is the process by which objects of one class (sub class) acquire the properties of another class (base class).
E.g.: A class named Area is defined to find area of rectangle with data members l and b as base class and another class Volume is defined as sub class with data member h. To find volume the l and b can be acquired from the Area class. Using an object of Volume class area and volume can be found.
Use: Repetition of variable declarations and function definitions can be avoided. So memory can be saved and programming effort can be reduced.

2009

Question 1
(a) Why a class is called a factory of objects? [2]

An object has two features – attributes and behaviours. A class is a template with attributes and behaviours to create objects. We can create so many objects using this class. So a class is an object factory.

2010

Question 1
(a) What do you understand by the term data abstraction? Explain with an example. [2]

Data Abstraction refers to the act of representing essential features without including the background details or explanations.
An object may have many attributes and behaviours. For a particular purpose all these attributes and behaviours need not to be defined. So a class is defined with necessary attributes and behaviours for a particular purpose. E.g.: A student object has many attributes like roll, name marks, caste, gender, address etc. To find result we need only roll, name and marks. So we can define a Student class with these necessary attributes.

(h) (i) Why is an object called an instance of a class? [2]

A class explains about the attributes and behaviours that are contained in an object. Object is an example for this explanation. That means class is a concept about the object and object is the real thing with values to the attributes and functions. So objects are instances of a class. E.g.: The concept of rectangle is a shape with length and breadth but there is no rectangle exist; when we a draw one with length and breadth as 10 cm and 8 cm as an example then the real thing happens.

2011

Question 1
(a) What is the difference between an object and a class? [2]

An object is an identifiable entity with some characteristics and behaviour. A class represents a set of objects that share common characteristics and behaviour. Bird is a class. A parrot, a cuckoo, a peacock etc are objects belongs to Bird class.

2013

Question 1
(c) State the Java concept that is implemented through:
(i) A superclass and subclass
(ii) The act of representing essential features without including background details. [2]

(i) Inheritance
(ii) Data abstraction

Question 3
(c) What does a class encapsulate? [2]

A class encapsulates state and behavior.

2015

Question 1
(b) Name any two OOP’s principles. [2]

1) Encapsulation, 2) Data abstraction

2016

Question 1
(a) Define Encapsulation. [2]

Encapsulation refers to the act of wrapping up of data and functions that operate on data, into a single unit called class.
E.g.: The student class is defined with the essential variables like roll, name, mark etc. and methods to calculate average, find result etc. as a single unit.

2017

Question 1
(a) What is inheritance? [2]

Inheritance is the process by which objects of one class (sub class) acquire the properties of another class (base class).
E.g.: The length and breadth of Area class can be used by Volume class to find volume.

2018

Question 1
(b) Define abstraction. [2]

Abstraction refers to the act of representing essential features without including the background details or explanations in a class.
E.g.: A student object has so many attributes like roll, name, marks, caste, address etc. To find result all these attributes are not required. The essential features are roll, name and marks. All other background details are avoided.

2019

Question 1
(a) Name any two principles of OOP. [2]

1) Data abstraction, 2) Encapsulation

2020

Question 1
(b) Write a difference between class and an object. [2]

Class represents a set of objects that share common characteristics and behaviour.
E.g.: Rectangle is a class and its objects are different rectangle shapes. Their common characteristics are length and breadth. One of the behaviour is finding area.
Object is an identifiable entity with some characteristics and behaviour.
E.g.: A particular rectangle object is with its characteristics length and breadth and its behavior is finding area.