Procedural vs OOP, Classes, Objects and OOP Principles (ISC Class 11 Computer Science)
Updated 17 October 2026 · Fact-checked
Procedural programming organises a program as a sequence of procedures that act on shared data; object oriented programming (OOP) organises it as objects that combine data (attributes) and behaviour (methods). A class is the blueprint and an object is an instance of it. The principles of OOP are abstraction, encapsulation (data hiding), inheritance and polymorphism.
Notice that in procedural code every procedure touches the same shared data, while each object keeps its own data and methods together.
Illustration drawn for QuestionBuddy.
Understand Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP
Procedural programming. The problem is divided into procedures (functions); data are usually global and shared, so a change in data affects many procedures. Top-down design. Examples: C, early BASIC.
Object oriented programming. The problem is modelled as objects. Data and the methods that act on them are bound together; access to data is controlled. Bottom-up design. Examples: Java, C++.
| Basis | Procedural | Object oriented |
|---|---|---|
| Focus | Procedures | Objects |
| Data | Global, shared | Bound inside objects; can be hidden |
| Security | Low | Higher (data hiding) |
| Reuse | Limited | Through inheritance |
| Approach | Top-down | Bottom-up |
Class and object. A class defines the attributes (instance variables) and behaviour (methods) common to objects of a type; it is a user-defined data type. An object is an instance of a class, created with new, and has its own copy of the instance variables (state), responds to method calls (behaviour) and has an identity.
class Rect {
int l, b; // attributes
int area() { return l * b; } // behaviour
}
Rect r = new Rect(); r.l = 5; r.b = 3;
System.out.println(r.area()); // 15Principles of OOP.
- *Abstraction:* showing only the essential features and hiding the details (driving a car without knowing the engine).
- *Encapsulation:* wrapping data and methods in one unit (the class) and hiding the data using access control (private) so that it is changed only through methods; also called data hiding.
- *Inheritance:* a new class (subclass) acquires the properties and methods of an existing class (superclass); promotes reuse.
- *Polymorphism:* one name, many forms: the same method name behaves differently (method overloading in Java).
Advantages of OOP. Reuse of code, easier maintenance, data security, close modelling of real-world problems.
Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP: key facts
- Class and object
- Class = blueprint (attributes + methods) | Object = instance created with new
- Relationship.
- Four principles
- Abstraction
- Encapsulation
- Inheritance
- Polymorphism
- Core of OOP.
- Creating an object
- ClassName obj = new ClassName();
- obj.method();
- obj.attribute
- Syntax.
How to answer Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP questions
Identify the class, its attributes and methods, then the objects.
- 1Name the class and list attributes and behaviours.
- 2Write the class with variables and methods.
- 3Create objects with new and set or pass values.
- 4Trace the output using each object's own data.
Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP in real life
The idea, met in an everyday situation. Answer the question in your own words, then compare with the model answer. The one-line hook is what to remember.
Class and object
Suppose a school software models students: every student has a name and marks, and can compute a result.
What is the class and what are objects?
Try it first, then show the solutionSolution
- The class Student has attributes name, marks and a method result().
- Each real student, such as Riya or Arjun, is an object of that class with its own values.
Answer: Student is the class; Riya and Arjun are objects.
Memory hook: One blueprint, many objects.
Tricks to remember Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP
Short memory aids. Say each one aloud once, then use it on a question the same day.
A-E-I-P
Abstraction, Encapsulation, Inheritance, Polymorphism.
Use it when: Principles.
Class = noun type, object = instance
Class is the type; object is a particular one.
Use it when: Definition.
private hides
Encapsulation uses private data and public methods.
Use it when: Data hiding.
Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP: solved examples
Ordered from board level to HOTS. Try each one before you open the solution.
Example 1: Principle · 1 mark · MCQBoard level
Wrapping data and methods into a single unit and restricting access is called:
(a) inheritance (b) encapsulation (c) polymorphism (d) abstraction
Try it first, then show the solutionSolution
- Binding data with methods and hiding data: encapsulation.
Answer: (b) encapsulation
Example 2: Differences · 3 marks · Short answerBoard level
Distinguish between a class and an object. (3 marks)
Try it first, then show the solutionSolution
- A class is a blueprint; an object is an instance.
- A class takes no storage for the data of an object; each object has its own copy.
- A class is defined once; many objects can be created.
Answer: A class is a template defining attributes and methods; an object is an instance with its own values. Many objects can be created from one class.
Example 3: Objects keep their own state · 4 marks · Short answerHarder board level
Given class Rect { int l, b; int area() { return l * b; } } what is the output of:
Rect r1 = new Rect(); r1.l = 5; r1.b = 3;
Rect r2 = new Rect(); r2.l = 4; r2.b = 6;
System.out.println(r1.area() + " " + r2.area());
r2.l = 10;
System.out.println(r1.area() + " " + r2.area());(4 marks)
Try it first, then show the solutionSolution
- r1.area() = 5 x 3 = 15; r2.area() = 4 x 6 = 24.
- After r2.l = 10: r2.area() = 10 x 6 = 60; r1 is unchanged: 15.
Answer: 15 24
15 60
Example 4: Compare the approaches · 5 marks · Long answerHarder board level
A banking program keeps balances in global variables used by procedures deposit(), withdraw() and interest(). A bug in one procedure changes a balance wrongly. Explain how an object-oriented design (a class Account) reduces this risk, naming two principles, and write the attributes and methods of Account. (5 marks)
Try it first, then show the solutionSolution
- Encapsulation: balance is a private attribute inside Account; it can change only through deposit() and withdraw().
- Abstraction: users call methods without knowing how the balance is stored.
- Attributes: accountNo, holderName, balance; methods: deposit(), withdraw(), getBalance().
- Checks (such as not allowing a negative balance) sit in one place.
Answer: Account hides the balance (encapsulation) and exposes only deposit(), withdraw() and getBalance() (abstraction); attributes accountNo, holderName, balance.
Example 5: Inheritance and polymorphism · 4 marks · Short answerHOTS / competency
A class Shape has a method draw(). Classes Circle and Square extend Shape. Explain how inheritance and polymorphism apply here and write the benefit of each. (4 marks)
Try it first, then show the solutionSolution
- Inheritance: Circle and Square acquire the common attributes of Shape, so code is reused.
- Polymorphism: each class has its own form of draw() (the same name, different behaviour).
- Benefit of inheritance: reuse; benefit of polymorphism: one call works for many shapes.
Answer: Circle and Square inherit common features from Shape (reuse) and each provides its own draw() (polymorphism), so a single call draws any shape.
Where students lose marks in Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP
The slips examiners see most often, and what to write instead.
Mistake: Defining an object as a class
Confusing blueprint and instance.
Wrong working
An object is a template
Right working
An object is an instance of a class
Do this: Class = template.
Usually costs: 1-2 marks.
Mistake: Using one object's data for another
Sharing assumption.
Wrong working
r1.area() becomes 60
Right working
r1.area() stays 15
Do this: Each object has its own copy.
Usually costs: 2 marks.
Mistake: Describing encapsulation as hiding code
Common slip.
Wrong working
Encapsulation hides the code
Right working
Binds data with methods and hides the data
Do this: Data hiding.
Usually costs: 1 mark.
Exam tips
- Give a real-world example for each principle.
- Use the table for procedural vs OOP.
- Show objects with separate values when tracing.
Practice questions on Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP
Write each answer on paper first. Open the hint only if you are stuck, and the answer only when you have finished.
Q1 · 1 mark · MCQBoard level
Which of the following is an object-oriented programming language?
(a) C (b) Java (c) Assembly (d) FORTRAN 66Hint
Classes and objects.
Answer
(b) Java
Q2 · 2 marks · Short answerBoard level
State two differences between procedural and object oriented programming. (2 marks)
Hint
Focus; data.
Answer
Procedural programming focuses on procedures with global data; OOP focuses on objects that bind data and methods and can hide data.
Q3 · 5 marks · Long answerHarder board level
Write a class Student with attributes name and marks and a method that returns "Pass" if marks are 40 or more, otherwise "Fail". State the output for marks 40 and 39. (5 marks)
Hint
Return a String.
Answer
class Student { String name; int marks; String result() { if (marks >= 40) return "Pass"; else return "Fail"; } } For marks 40 the output is Pass; for 39 it is Fail.
Q4 · 3 marks · Short answerHarder board level
Given class Counter { int c; void inc() { c = c + 1; } } write the output: Counter a = new Counter(); Counter b = new Counter(); a.inc(); a.inc(); b.inc(); System.out.println(a.c + " " + b.c); (3 marks)
Hint
Each object has its own c.
Answer
a.c = 2 and b.c = 1: output 2 1.
Q5 · 4 marks · Short answerHOTS / competency
A company wants Employee data (salary) to be changed only through a method that rejects negative values. Explain which principle is used, what access specifier is given to salary, and write the method. (4 marks)
Hint
private and a setter.
Answer
Encapsulation (data hiding): declare salary private and provide public void setSalary(double s) { if (s >= 0) salary = s; } so that negative values cannot be stored.
Test your recall
Answer in your head or on paper first, then open the card. Pulling an answer out of memory makes it stick far better than re-reading.
1.Class is?Show answer
A blueprint for objects.
2.Object is created by?Show answer
The new operator.
3.Data hiding is?Show answer
Encapsulation.
4.Inheritance gives?Show answer
Reuse.
5.Polymorphism means?Show answer
One name, many forms.
Procedural versus Object Oriented Programming: Classes, Objects and the Principles of OOP: frequently asked questions
Can many objects share one class?
Yes.
Is Java purely object oriented?
Mostly; it has primitive types.
What is an instance variable?
A variable belonging to each object.
What is a method?
A named block of code that gives behaviour.