CBSE Class 12 Computer Science Oop Classes And Objects Worksheet

Download Class 12 Computer Science Practice Worksheets

Review targeted academic worksheets with the CBSE Class 12 Computer Science Oop Classes And Objects Worksheet. Built according to official educational standards for the 2026-27 term, these downloadable Class 12 Computer Science resources support effective daily practice and detailed self-evaluation for Oop Classes And Objects.

Access Oop Classes And Objects Practice Papers and Solutions

Navigate directly to the solved Computer Science worksheets using the digital viewer below. Each practice set includes detailed step-by-step solutions, allowing students to instantly cross-check their work and identify areas requiring further revision.

Class_12_Computer Science_Worksheet_3

Class :- A class is collection of data (data member) and functions (member functions or methods) working on the data. It can be seen as a blue print for the object. No memory is allocated when a class is created. Memory is allocated only when an object is created.

Object :- An Object is an instance of the class means have all the properties defined in the class.

Data member:- The data variables declared within the class.

Member functions :- Member functions are the methods which are declared/defined inside the class and operate upon the data member.

Data Abstraction: - Data abstraction represents essential features without including background details.

Data Encapsulation:- Binds the data and its functions into a single unit called class.

Data hiding:-Hides internal object details (data members). Data hiding ensures exclusive data access to class members and protects object integrity by preventing accidental or intended changes.

Inheritance: Inheritance is the process of forming a new class from an existing class or base class.

Base Class :- The class from which methods and data members are derived to new class is knows as base class. The base class is also known as parent class or super class.

Derived Class:- The class that is deriving data and methods from base class is called derive class. Derived class is also known as a child class or sub class.

Polymorphism:-Poly means many and morphs mean form (Multiple Forms). Refers to the ability of processing of data in more than one form.

Access specifier :-private, protected, public (default access specifier is private)

Accessibility of private, protected and public members

AccessibilityPrivateProtectedPublic
Through member functionsYesYesYes
Through object of the classNoNoYes
Through derived classNoYesYes

 

Syntax of a classExample
class <class_name>
{
private:
   declaration of data member;
   declaration/definition member function;
protected:
   declaration of data member;
   declaration/definition member function
public:
   declaration of data member;
   declaration/definition member function
};
class student
{
private:
   char name[30];
   int age;
   int marks;
protected:
   char grade;
public:
   void getdata();
   void showdata();
};

Referencing class members:- All the data members of the class are directly accessible to the member function of that class. They don’t need any object name to be prefixed before it but from outside the class any reference to the data member is done with the dot (.) operator.

Syntax for creating an object:
<class_name> <Object_name>;
Example: student s1;

Accessing members from object of the class:- A data member and member function declared under public access specifier can be accessed by the objects directly.
objectname.member;
e.g. s1.getdata(); s1.showdata();

Defining class methods/Member functions. Member functions of the class can be defined in the following two ways

(a) Inside the class definition (inline function)
In this method, the function is defined within the class body and are treated as inline by default.

(b) Outside the class definition.
In this way function prototype is declared within class body and function is defined outside the class with the help of Scope Resolution operator (::).

Syntax for defining a member function outside the class definition.Example for defining a member function outside the class definition.
<return type> <class name> :: <function name>(parameter list)
{
body of the function
}
void student::showdata()
{
cout<<"\n Name "<<name;
cout<<"\n Age "<<age;
cout<<"\n Marks"<<marks;
}

 

Example: Defining member function within class body.Example: Defining member function outside class body.
class STUDENT
{
int rollno;
char Name[20];
char Address[30];
char PhoneNo[15];
public:
void enter()
{
cout<<"\n Enter Rollno name address and phone no. ";
cin>>rollno;
cin.getline(Name,20);
cin.getline(Address,30);
cin.getline(PhoneNo,15);
}
void display()
{
cout<<"information of student is";
cout<<rollno<<Name<<Address<<PhoneNo;
}
};
class STUDENT
{
int rollno;
char Name[20];
char Address[30];
char PhoneNo[15];
public:
void enter();
void display();
};
void STUDENT :: enter()
{
cin>>rollno;
cin.getline(Name,20);
cin.getline(Address,30);
cin.getline(PhoneNo,15);
}
void STUDENT :: display()
{
cout<<"information of student is";
cout<<rollno<<Name<<Address<<PhoneNo;
}

 

Short Answer Type Questions (2 Marks)

Question 1. What do you understand by class and object in C++?
Answer: A class is a user-defined blueprint that groups data members and member functions together. An object is an instance of a class that has the properties defined in the class. No memory is allocated for a class, but memory is allocated when an object is created.
In simple words: A class is like a cookie cutter and an object is a cookie made from it.

Exam Tip: Always define the class first, then create objects from it.

 

Question 2. What all members of a class are accessible to outside the class body?
Answer: Only the public members of a class (data members and member functions) are accessible from outside the class body through an object.
In simple words: Only the public doors of the class are open to outsiders.

Exam Tip: Private and protected members cannot be accessed through an object.

 

Question 3. What do you understand by data abstraction?
Answer: Data abstraction means showing only the essential features of an object and hiding the background details.
In simple words: You use a TV remote without knowing the circuits inside.

Exam Tip: Abstraction focuses on what an object does, not how it does it.

 

Question 4. What do you understand by data hiding?
Answer: Data hiding is hiding the internal data members of an object so that they cannot be accessed or changed directly, which protects the object’s integrity.
In simple words: Keep your diary locked so nobody can change your notes.

Exam Tip: Declare data members as private to achieve data hiding.

 

Question 5. What do you understand by Encapsulation?
Answer: Encapsulation binds the data and its functions into a single unit called a class.
In simple words: Keep the data and the functions that work on it together in one capsule.

Exam Tip: Encapsulation and data hiding work together.

 

Question 6. What is polymorphism?
Answer: Polymorphism means many forms. It is the ability to process data in more than one form.
In simple words: The same word or action can behave in different ways.

Exam Tip: Remember the meaning of poly (many) and morph (form).

 

Question 7. What do you understand by member function? How does a member function differ from an ordinary function?
Answer: A member function is a function declared or defined inside a class that operates on the data members of that class. A member function is part of a class and is called through an object, while an ordinary function is not part of any class and can access only the data passed to it.
In simple words: A member function belongs to a class, like a teacher belongs to a school.

Exam Tip: Member functions can directly use the data members without an object name.

 

Question 8. How does a class implement Data Abstraction and Encapsulation?
Answer: A class implements encapsulation by grouping data members and member functions into one unit. It implements data abstraction by exposing only the public member functions (the essential interface) and hiding the implementation details in private or protected members.
In simple words: The class is a box (encapsulation) with a few buttons on the outside (abstraction) while the machinery stays hidden inside.

Exam Tip: Public interface for abstraction, private members for hiding.

 

Long Answer Type Questions (4 Marks)

Question 1. Define a class train with following members.
Private members: Trainno - type int; Destination - type String; Distance - type float; Fuel - type float. A member function calfuel() to calculate and assign value of fuel as per the following criteria: Distance <=1500 gives Fuel 250; Distance >1500 and <=3000 gives Fuel 1000; Distance >3000 gives Fuel 2500.
Public members: 1. feedinfo(): to input train no, destination, distance and invoke calfuel() function to assign value of fuel. 2. showinfo(): to display all the details for a train.

Answer:
class train
{
int trainno;
string destination;
float distance;
float fuel;
void calfuel()
{
if(distance<=1500) fuel=250;
else if(distance<=3000) fuel=1000;
else fuel=2500;
}
public:
void feedinfo()
{
cin>>trainno>>destination>>distance;
calfuel();
}
void showinfo()
{
cout<<trainno<<destination<<distance<<fuel;
}
};
In simple words: The class stores train details, works out the fuel from the distance, and shows the details.

Exam Tip: Use if-else-if to match the distance ranges exactly.

 

Question 2. Define a class employee with following specifications: Private members: empno integer type; ename 20 characters long String; basic, hra, da float type; netpay float type; ctotal() a function to calculate the total basic. Public member: read_data() a function to read empno, ename, basic, hra, da and call ctotal() to calculate total; display_data() a function to display all the data members on the screen.
Answer:
class employee
{
int empno;
char ename[21];
float basic,hra,da;
float netpay;
void ctotal()
{
netpay=basic+hra+da;
}
public:
void read_data()
{
cin>>empno;
cin.getline(ename,21);
cin>>basic>>hra>>da;
ctotal();
}
void display_data()
{
cout<<empno<<ename<<basic<<hra<<da<<netpay;
}
};
In simple words: read_data() fills the employee details and ctotal() adds up the pay parts.

Exam Tip: Remember that a 20-character string needs 21 places for the end marker.

 

Download Class 12 Computer Science Oop Classes And Objects Practice Worksheets

Practice Exercises for Class 12 Computer Science Oop Classes And Objects

Explore reliable practice questions for Oop Classes And Objects tailored for Class 12 Computer Science learners. Use these structured worksheets to evaluate exam preparedness and strengthen problem-solving skills throughout the 2026 academic session.

Step-by-Step Solutions and Practice Guidelines

Each worksheet draws directly from authorized standard textbooks to maintain academic accuracy. Evaluating your finished exercises against expert-verified solutions helps master the formal presentation standards expected in school evaluations.

Enhance Speed with Online Practice

Consistent engagement with these exercises builds familiarity with recurring exam themes. If specific areas within Oop Classes And Objects cause trouble, utilize our dedicated NCERT solutions for Class 12 Computer Science to clear up doubts immediately.

FAQs

Where can I download the 2026-27 CBSE printable worksheets for Class 12 Computer Science Oop Classes And Objects?

You can download the latest chapter-wise printable worksheets for Class 12 Computer Science Oop Classes And Objects for free from StudiesToday.com. These have been made as per the latest CBSE curriculum for this academic year.

Are these Oop Classes And Objects Computer Science worksheets based on the new competency-based education (CBE) model?

Yes, Class 12 Computer Science worksheets for Oop Classes And Objects focus on activity-based learning and also competency-style questions. This helps students to apply theoretical knowledge to practical scenarios.

Do the Class 12 Computer Science Oop Classes And Objects worksheets have answers?

Yes, we have provided solved worksheets for Class 12 Computer Science Oop Classes And Objects to help students verify their answers instantly.

Can I print these Oop Classes And Objects Computer Science test sheets?

Yes, our Class 12 Computer Science test sheets are mobile-friendly PDFs and can be printed by teachers for classroom.

What is the benefit of solving chapter-wise worksheets for Computer Science Class 12 Oop Classes And Objects?

For Oop Classes And Objects, regular practice with our worksheets will improve question-handling speed and help students understand all technical terms and diagrams.