Infosys Technical Interview Questions with Answers
1. What is Object-Oriented Programming (OOP)?
OOP is a programming paradigm based on the concept of 'objects', which contain data and
methods. The four main principles of OOP are:
- Encapsulation: Binding data and methods together
- Inheritance: One class can inherit properties from another
- Polymorphism: One interface, many implementations
- Abstraction: Hiding internal details and showing only the functionality
2. What is the difference between Java and C++?
- Java is platform-independent (via JVM), while C++ is platform-dependent.
- Java uses garbage collection for memory management, while C++ uses manual memory allocation
(new/delete).
- Java does not support multiple inheritance using classes (uses interfaces), while C++ supports it.
3. What is a constructor?
A constructor is a special method that is automatically called when an object is created. It is used to
initialize the object. In Java and C++, the constructor has the same name as the class.
4. What is the difference between Array and ArrayList in Java?
- Array has a fixed size, while ArrayList is dynamic and can grow/shrink.
- Array can hold primitive types and objects, while ArrayList can only hold objects.
- ArrayList provides built-in methods like add(), remove(), contains(), etc.
5. What is SQL JOIN?
JOIN is used to combine rows from two or more tables based on a related column.
- INNER JOIN: Returns rows that have matching values.
- LEFT JOIN: Returns all rows from the left table and matched rows from the right table.
- RIGHT JOIN: Returns all rows from the right table and matched rows from the left table.
6. Explain your final year project.
My final year project was [Project Name], a [brief description]. I used technologies such as [e.g.,
Java, MySQL]. My role included designing logic, integrating backend, and ensuring smooth
functionality. It taught me practical applications of database design, OOP, and teamwork.
7. Write a Java program to check if a number is prime.
```java
public class PrimeCheck {
public static void main(String[] args) {
int num = 29;
boolean isPrime = true;
for (int i = 2; i <= Math.sqrt(num); i++) {
if (num % i == 0) {
isPrime = false;
break;
if (isPrime)
System.out.println(num + " is a prime number.");
else
System.out.println(num + " is not a prime number.");
}```