Most Common Technical Interview Questions for Freshers (With Answers)

By Preeti Verma

Fresher interviews are not designed to trick you. The interviewer knows you have no work experience, so the goal is simple: do you understand the basics well enough to learn on the job? The same topics come up again and again, which is good news. You can prepare for them.

This guide covers the technical questions freshers meet most often, grouped by subject, with answers short enough to say out loud. Do not memorise the wording. Read each answer, close the page, and explain it in your own words. If you can do that, you understand it.

How freshers are usually tested

Most fresher technical rounds mix three things:

  • Fundamentals: your main language, OOP, SQL and basic computer science.
  • Your projects and resume: anything you wrote on your resume is fair game.
  • A small coding problem: reversing a string, finding duplicates, a simple loop or array question.

A strong fresher answer is short, correct and followed by an example. A weak one is a memorised definition with nothing behind it. When you are unsure, say what you do know and how you would find out the rest. That honesty reads much better than a confident wrong answer.

Java questions

1. What are the four pillars of OOP?

Encapsulation, inheritance, polymorphism and abstraction.

  • Encapsulation: keep data private and expose it through methods, so the class controls how its state changes.
  • Inheritance: a class reuses and extends another class's behaviour (Dog extends Animal).
  • Polymorphism: the same method call behaves differently depending on the object (method overriding at runtime, overloading at compile time).
  • Abstraction: show what an object does and hide how it does it, using abstract classes and interfaces.

Give one small example for each. A BankAccount with a private balance and a withdraw() method is a classic encapsulation example.

2. What is the difference between == and .equals()?

For objects, == compares references (do both variables point to the same object?). .equals() compares content, if the class overrides it. String overrides equals() to compare characters.

String a = new String("hello");
String b = new String("hello");
System.out.println(a == b);       // false, two different objects
System.out.println(a.equals(b));  // true, same characters

3. Why is String immutable in Java?

Once created, a String cannot change. Any "change" creates a new object. This makes strings safe to share between threads, safe to use as keys in a HashMap (the hash code never changes), and allows the JVM to reuse strings from the string pool. If you need to build a string in a loop, use StringBuilder.

4. Abstract class vs interface?

An abstract class can hold state (fields), constructors and a mix of implemented and abstract methods, and a class can extend only one. An interface defines a contract that many classes can implement, and a class can implement several. Use an abstract class when subclasses share code and state. Use an interface when unrelated classes should promise the same behaviour.

5. What is the difference between checked and unchecked exceptions?

Checked exceptions (like IOException) must be caught or declared with throws; the compiler enforces it. Unchecked exceptions (subclasses of RuntimeException, like NullPointerException) are not enforced and usually point to programming mistakes.

6. ArrayList vs LinkedList?

ArrayList is backed by an array: reading by index is fast, inserting in the middle is slow. LinkedList is a chain of nodes: inserting or removing at a known position is cheap, but reading by index means walking the list. In practice ArrayList is the right default.

7. How does a HashMap work (at a basic level)?

It stores key-value pairs in an array of buckets. The key's hashCode() decides the bucket, and equals() finds the exact key inside that bucket. Lookups are fast on average. If you use your own class as a key, override both equals() and hashCode() together. For a deeper look, read our HashMap vs ConcurrentHashMap guide.

Python questions

8. What is the difference between a list and a tuple?

A list is mutable (you can add, remove and change items). A tuple is immutable. Tuples are slightly lighter and can be used as dictionary keys because they cannot change. Use a tuple for fixed groups like coordinates.

9. What is a mutable default argument problem?

def add_item(item, items=[]):
    items.append(item)
    return items

add_item(1)  # [1]
add_item(2)  # [1, 2]  surprise

The default list is created once, when the function is defined, and shared by every call. The fix is to use None and create the list inside the function.

def add_item(item, items=None):
    if items is None:
        items = []
    items.append(item)
    return items

10. What are *args and **kwargs?

*args collects extra positional arguments into a tuple. **kwargs collects extra keyword arguments into a dictionary. They let a function accept a flexible number of arguments.

11. How is memory managed in Python?

Python uses reference counting plus a garbage collector that cleans up reference cycles. When an object has no references left, its memory can be freed. You normally do not manage memory by hand.

SQL questions

12. What is the difference between WHERE and HAVING?

WHERE filters rows before grouping. HAVING filters groups after GROUP BY, usually using an aggregate such as COUNT or SUM.

SELECT department, COUNT(*) AS people
FROM employees
WHERE active = true
GROUP BY department
HAVING COUNT(*) > 5;

13. Explain the types of joins.

  • INNER JOIN: only rows that match in both tables.
  • LEFT JOIN: every row from the left table, with matching rows from the right (or NULLs).
  • RIGHT JOIN: the mirror of a left join.
  • FULL JOIN: all rows from both sides, matched where possible.

Be ready to draw two small tables and show the result of each join. It is the most common SQL follow-up.

14. What is the difference between a primary key and a foreign key?

A primary key uniquely identifies each row in its own table and cannot be NULL. A foreign key is a column that points to the primary key of another table, and it enforces that the referenced row exists.

15. What is normalisation?

Organising tables to reduce duplicate data and update problems. First normal form: each cell holds one value. Second: every non-key column depends on the whole key. Third: non-key columns do not depend on other non-key columns. You can say it in one line: "store each fact in one place."

For more practice at the next level, see our SQL interview questions guide.

DBMS and operating system questions

16. What does ACID mean?

  • Atomicity: a transaction happens completely or not at all.
  • Consistency: a transaction moves the database from one valid state to another.
  • Isolation: concurrent transactions do not see each other's half-finished work.
  • Durability: once committed, the data survives a crash.

A bank transfer is the standard example: money leaves one account and enters another, or neither happens.

17. What is an index and what is the trade-off?

An index is a separate structure (often a B-tree) that lets the database find rows without scanning the whole table. It speeds up reads but slows down writes and uses extra storage, so you index the columns you filter and join on, not everything.

18. What is the difference between a process and a thread?

A process is a running program with its own memory. A thread is a unit of execution inside a process, and threads in the same process share its memory. Threads are lighter to create and switch between, but sharing memory means you must guard against race conditions.

19. What is a deadlock?

Two or more threads each hold a resource the other needs, so all of them wait forever. It needs four conditions together: mutual exclusion, hold and wait, no pre-emption, and circular wait. You prevent it by breaking one of them, for example by always acquiring locks in the same order.

20. What is virtual memory?

A technique that lets a program use more memory than is physically available by moving unused pages between RAM and disk. Each process sees its own continuous address space.

Basic coding questions

You will almost always get one small coding problem. Practise these until you can write them without looking.

Reverse a string

public static String reverse(String s) {
    return new StringBuilder(s).reverse().toString();
}

Then be ready to do it without the helper, using two pointers swapping characters from both ends.

Check if a string is a palindrome

def is_palindrome(s):
    s = "".join(c.lower() for c in s if c.isalnum())
    return s == s[::-1]

Find the duplicate in an array

Use a set: walk the array and return the first value you have already seen. That is O(n) time and O(n) space. Mention the alternative of sorting first (O(n log n), less memory).

FizzBuzz

Loop from 1 to n. Print FizzBuzz for multiples of 15, Fizz for 3, Buzz for 5, otherwise the number. Check 15 first. It looks silly, but it shows whether you can handle conditions in the right order.

Questions about your projects

Expect at least three of these, because projects are the only real work you can show:

  • Why did you choose this technology?
  • What was the hardest bug and how did you fix it?
  • What would you change if you built it again?
  • How does the data flow from the user's click to the database?

Prepare a two-minute explanation of your best project. Our guide on how to answer "Tell me about yourself" helps you frame it.

A simple way to practise

  1. Pick five topics from this list each day.
  2. Say the answer out loud, without notes.
  3. Write one small example in code for each.
  4. Do a timed mock interview at the end of the week.

Speaking out loud is the step most freshers skip, and it is the one that matters, because the real interview is spoken. You can practise with the GenQuest AI mock interview, which asks follow-up questions the way a real interviewer does, and you can browse the free question banks to find topics you are weak on.

A quick self-test before the interview

Set a 15-minute timer and answer these five aloud, without notes. Anywhere you hesitate is where to spend your next study session.

  1. Explain the four pillars of OOP with one example each.
  2. What is the difference between == and .equals(), or its equivalent in your language?
  3. Write a query that returns the number of employees in each department that has more than five people.
  4. Explain what happens when you type a URL into a browser, in four or five steps.
  5. Describe your best project in two minutes: the problem, your part, one bug and the result.

If you can do all five smoothly, you are ahead of most freshers. If you stumble on number four, read about HTTP, DNS and how a request reaches a server, because "what happens when you open a website" is a favourite fresher question that tests how well you understand the whole system.

Frequently asked questions

How many questions should a fresher prepare?

You do not need hundreds. Know about 40 to 50 core questions deeply, across your main language, OOP, SQL, DBMS and basic coding. Depth beats volume.

What if I do not know the answer?

Say so calmly, explain the nearest thing you do know, and say how you would find the answer. Interviewers value honesty and reasoning far more than a guess presented as fact.

Which language should I choose for coding rounds?

The one you know best. If the company asks for a specific language (often Java or Python for service companies), practise in that one.

Should I learn data structures for fresher interviews?

Yes, at least arrays, strings, hash maps, linked lists, stacks, queues and sorting. Our DSA patterns guide shows what to practise first.

The takeaway

Fresher technical interviews reward clear fundamentals and calm explanations. Learn the questions above, practise saying the answers out loud, and prepare a good story about one project. That combination is enough to clear most first technical rounds.