OOPs, DBMS, and Java Interview Questions for Freshers
1. What is OOP?
OOP stands for Object-Oriented Programming. It is a programming paradigm based on the
concept of objects. Key concepts: Class, Object, Inheritance, Polymorphism, Abstraction,
and Encapsulation.
2. Explain Inheritance in Java
Inheritance allows a class (subclass) to inherit properties and behaviors from another
class (superclass).
Example:
class Animal { void sound() { System.out.println("Animal sound"); } }
class Dog extends Animal { void bark() { System.out.println("Bark"); } }
3. What is Polymorphism?
Polymorphism means many forms. In Java, it allows methods to behave differently based on
the object.
Types: Compile-time (method overloading), Runtime (method overriding).
4. What is Abstraction?
Abstraction hides implementation details and shows only functionality.
In Java, it is achieved using abstract classes and interfaces.
5. What is Encapsulation?
Encapsulation is wrapping data and methods into a single unit (class) and keeping data
safe from outside access using access modifiers.
6. Difference between Abstract Class and Interface
Abstract Class: Can have method bodies, constructor, variables.
Interface: Only method declarations (till Java 7), multiple inheritance.
From Java 8, interfaces can have default and static methods.
7. What is DBMS?
DBMS stands for Database Management System. It is software used to store, manage, and
retrieve data efficiently.
Examples: MySQL, Oracle, PostgreSQL.
8. Difference between DBMS and RDBMS
DBMS: Data is stored in files.
RDBMS: Data is stored in tables with relations.
RDBMS enforces integrity constraints and normalization.
9. What is Normalization?
Normalization is the process of organizing data to reduce redundancy and improve data
integrity. Types: 1NF, 2NF, 3NF, BCNF.
10. What is a Primary Key and Foreign Key?
Primary Key: Uniquely identifies each record in a table.
Foreign Key: Refers to the primary key in another table to maintain a relationship.
11. What is Java?
Java is a high-level, object-oriented programming language developed by Sun
Microsystems. It is platform-independent and widely used for web and enterprise
applications.
12. Features of Java
Simple, Object-Oriented, Platform Independent, Secure, Robust, Multithreaded, High
Performance, Distributed, Dynamic.
13. What is JVM, JRE, and JDK?
JVM: Java Virtual Machine - runs Java bytecode.
JRE: Java Runtime Environment - JVM + libraries.
JDK: Java Development Kit - JRE + development tools.
14. What is the difference between == and .equals()?
== compares object references.
.equals() compares the content of strings or objects (if overridden).
15. What is Exception Handling in Java?
It is the mechanism to handle runtime errors. Keywords: try, catch, throw, throws,
finally.