1. What is a class in object-oriented programming?
A class defines the attributes (data) and behaviors (methods) that its object instances will have. Think of it like a blueprint for constructing many similar objects.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Infosys · Object Oriented Programming
Practice Object Oriented Programming questions specifically asked in Infosys interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
7
Tagged for this company + subject
Company
Infosys
View company-wise questions
Subject
Object Oriented Programming
Explore topic-wise practice
Go through each question and its explanation. Use this page for targeted revision just before your Infosys Object Oriented Programming round.
A class defines the attributes (data) and behaviors (methods) that its object instances will have. Think of it like a blueprint for constructing many similar objects.
For complete preparation, combine this company + subject page with full company-wise practice and subject-wise practice. You can also explore other companies and topics from the links below.
Object Oriented Programming models real-world entities as objects that contain both data and behavior. This makes programs modular, reusable, and easier to maintain compared to procedural approaches.
A copy constructor in C++ constructs a new object by copying values from an existing object. It’s used for object duplication and deep or shallow copy semantics.
Method overloading allows a class to have multiple methods with the same name but different parameter lists. It improves code readability and flexibility by handling different input types or counts.
int add(int a,int b){return a+b;}
double add(double a,double b){return a+b;}OOP aims to reduce redundancy, not increase it. Its modular design improves maintainability, reusability, and security by organizing code around real-world entities.
A default constructor takes no arguments; it either is provided implicitly or defined explicitly. A parameterised constructor takes one or more parameters for initialization. Example in Java: class Person { Person() { } Person(String name) { this.name=name; } } The difference influences how objects are created and initialised.
Encapsulation binds data and methods together inside a class, preventing direct external access. It improves data security and modularity by using access modifiers like private and public.
class Account {
private double balance;
public void deposit(double amt){ balance += amt; }
}