Career desk

Interview questions for freshers: Java, SQL and HR

These are the questions that come up again and again in fresher interviews for IT and IT-support roles in India, with short answers written in plain language. Use them to find your gaps, not to memorise. Interviewers can tell the difference within one follow-up question.

Updated September 2026 11 min read
A smiling young candidate answering questions in a friendly job interview in a bright office

Key takeaways

  • Answer in three steps: a short definition, a small example, then a limit or trade-off.
  • Know your own project better than any textbook topic. It is the question you are sure to get.
  • For SQL, practise joins, GROUP BY with HAVING, and the "second highest salary" query.
  • Keep "Tell me about yourself" to about 90 seconds and connect it to the role.
  • It is fine to say "I do not know", followed by how you would find out.

A simple way to answer technical questions

Most freshers lose marks not because they do not know the topic, but because the answer comes out as a long, unordered stream. Use the same three steps for almost every technical question:

  1. Define it in one sentence. “An index is a separate structure that helps the database find rows without reading the whole table.”
  2. Give a small example. “If we search students by roll number often, an index on that column makes the search much faster.”
  3. Mention a limit or trade-off. “But every insert and update also has to update the index, so we do not index every column.”

The third step is what separates a memorised answer from real understanding, and it is exactly where interviewers take their follow-up questions from.

Before the interview

  • Read the job post again and write down the skills it mentions. Expect questions on each.
  • Prepare to explain every line on your resume. If a skill is listed, you can be asked about it.
  • Practise explaining your main project in two minutes: the problem, your part, the tools, one challenge.
  • Look up the company: what it does, its main clients or products, and the office location.
  • Keep copies of your resume, ID and certificates ready, printed for walk-ins.
  • Sleep properly the night before. A tired brain forgets basics it knows well.

Java interview questions

Q1.What is the difference between == and equals() for Strings?Very common

== checks whether two references point to the same object in memory. equals() checks whether the contents are the same. So new String("hi") == new String("hi") is false, but .equals() on them is true.

Always use equals() to compare values. If one side might be null, use Objects.equals(a, b) to avoid a NullPointerException.

Q2.Why are Strings immutable in Java, and when should you use StringBuilder?

Once a String is created, its value cannot change. This makes Strings safe to share between threads, safe to use as HashMap keys, and allows Java to reuse identical literals from the string pool.

The downside is that every change creates a new object. When you build a string inside a loop, use StringBuilder, which changes the same object and is much faster.

Q3.What is the difference between ArrayList and LinkedList?

ArrayList stores elements in an array, so reading by index is fast. Adding or removing in the middle is slower because elements have to shift. LinkedList stores elements as linked nodes, so adding or removing at the ends is quick, but reading by index means walking through the list.

In most real code, ArrayList is the default choice.

Q4.HashMap vs Hashtable vs ConcurrentHashMap?

HashMap is not synchronized and allows one null key and null values. It is the normal choice for single-threaded code. Hashtable is an old class that locks the whole table on every operation and does not allow nulls. ConcurrentHashMap is the modern choice when many threads read and write the same map, because it avoids locking the whole map.

Q5.What are checked and unchecked exceptions?

Checked exceptions, such as IOException and SQLException, must be either caught or declared with throws. The compiler forces you to deal with them. Unchecked exceptions extend RuntimeException, such as NullPointerException, and usually point to a bug in the code.

A good practice is to catch only exceptions you can actually handle, and never catch Exception just to ignore it.

Q6.What is the difference between an abstract class and an interface?

An abstract class can have fields, constructors and both abstract and normal methods, and a class can extend only one abstract class. An interface describes what a class can do. A class can implement many interfaces, and since Java 8 interfaces can also have default and static methods.

Use an interface for a capability shared by unrelated classes, and an abstract class for a base with shared code.

Q7.What is method overloading and method overriding?

Overloading means the same method name with different parameters in the same class, decided at compile time. Overriding means a subclass gives its own version of a method from the parent class with the same signature, decided at runtime. Overriding is how polymorphism works in Java.

Q8.What is Spring Boot and why do companies use it?

Spring Boot is a framework built on Spring that makes it quick to create Java applications, especially REST APIs. It provides sensible default settings, an embedded server such as Tomcat, and starter dependencies, so you write less setup code. Companies use it because it is widely known, well documented and works well for microservices.

SQL interview questions

Q1.What is the difference between INNER JOIN and LEFT JOIN?Very common

An INNER JOIN returns only rows that have a match in both tables. A LEFT JOIN returns all rows from the left table, and fills the right side with NULL where there is no match.

Example: to list all customers, including those who never ordered, use a LEFT JOIN from customers to orders. With an INNER JOIN, customers without orders would disappear from the result.

Q2.What is the difference between WHERE and HAVING?

WHERE filters rows before grouping. HAVING filters groups after GROUP BY and can use aggregate functions like COUNT and SUM.

-- Customers with more than 3 orders
SELECT customer_id, COUNT(*) AS orders
FROM orders
GROUP BY customer_id
HAVING COUNT(*) > 3;

Q3.Write a query to find the second highest salary.Very common

Two common answers:

-- 1. Using a subquery
SELECT MAX(salary)
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);

-- 2. Using a window function (handles ties clearly)
SELECT DISTINCT salary
FROM (
  SELECT salary, DENSE_RANK() OVER (ORDER BY salary DESC) AS rnk
  FROM employees
) ranked
WHERE rnk = 2;

Mention ties: if two people share the top salary, the second query still returns the next distinct salary. Explaining that detail is often what the interviewer is really looking for.

Q4.What is the difference between a primary key and a unique key?

Both prevent duplicate values. A table can have only one primary key, and it cannot contain NULL. A table can have several unique keys, and in most databases a unique column can contain NULL.

Q5.What does an index do? Should we index every column?

An index is a separate structure, usually a B-tree, that lets the database find rows quickly without scanning the whole table. It speeds up reads on the indexed columns but slows down inserts, updates and deletes, and uses extra space. So we index columns used often in WHERE, JOIN and ORDER BY, not every column.

Q6.What is the difference between DELETE, TRUNCATE and DROP?

 What it removesCan use WHERENotes
DELETESelected rowsYesCan be rolled back inside a transaction
TRUNCATEAll rowsNoFaster; in MySQL it cannot be rolled back
DROPThe whole tableNoRemoves the table structure too

Aptitude and coding rounds

Most fresher drives start with an online test. The aptitude part usually covers quantitative aptitude (percentages, ratios, time and work), logical reasoning and verbal English. The coding part usually has one to three problems, often on arrays and strings.

TopicWhat to practiseExample problem
ArraysTraversal, two pointers, prefix sumsFind the second largest element
StringsCounting characters, reversing, palindromesCheck if two words are anagrams
MathPrimes, GCD, digit operationsPrint all primes up to N
Sorting & searchingBuilt-in sort, binary searchFind a number in a sorted array
HashMapsFrequency countingFind the first non-repeating character
In the test: read the whole problem and the sample input before writing code, handle edge cases like an empty array, and submit a working simple solution before trying to make it faster.

HR interview questions and sample answers

Q1.Tell me about yourself.Always asked

Keep it to about 90 seconds: who you are, what you can do, one proof, and why this role. For example:

“I am Priya, a 2026 computer science graduate from Pune. I have been focusing on Java backend development. My main project is a Spring Boot API that lets students in my hostel book study rooms, which I built with MySQL and tested with JUnit. During my internship I fixed bugs in a Java service and wrote SQL reports. I am applying for this role because it is a Java backend position and I want to keep building APIs.”

Q2.Why should we hire you?

Match your skills to what the job needs, and give proof. “The role needs Java and SQL. I have used both in a project that real users relied on, and in my internship. I learn quickly and I am comfortable asking questions when I am stuck.” Avoid claiming you are the best candidate. You have not met the others.

Q3.What are your strengths and weaknesses?

Pick one strength related to the job and back it with an example. For a weakness, choose a real one that is not critical for the role and say what you are doing about it. “I used to hesitate to ask for help and lose time. Now I try for 30 minutes and then ask.” Avoid fake weaknesses like “I work too hard”.

Q4.Why do you want to join our company?

Mention something specific you found: the domain they work in, a product, the technology in the job post, or the training programme for freshers. “Work-life balance and growth” without anything specific sounds like you have not looked.

Q5.Where do you see yourself in five years?

Keep it realistic and linked to the role. “I would like to be a strong backend developer who can own a service, review others’ code and help new joiners.” Avoid “running my own company” for a job you are applying to join.

Q6.Are you willing to relocate or work in shifts?

Answer honestly. If you say yes and then refuse after the offer, it causes trouble for both sides. If you have a real limitation, say it politely and ask whether there is flexibility.

Q7.Tell me about a time you faced a problem in a team.

Use a real, small example: a project partner missing deadlines, a merge conflict before a submission. Explain the situation, what you did, and the result. Do not blame others. Show what you learned.

Q8.Do you have any questions for us?

Always say yes and ask one or two. See the next section for good ones.

Good questions to ask the interviewer

  • What would a normal day look like for someone in this role?
  • Which technologies would I work with in the first few months?
  • How does training work for new joiners?
  • How is performance reviewed in the first year?
  • What does the team I would join work on?
  • What are the next steps after this interview?

Avoid asking about leave, salary hikes or work from home in the first technical round. Save those for HR.

Tips for online and video interviews

  • Test your internet, camera and microphone 30 minutes before the call.
  • Sit in a quiet room with light in front of you, not behind you.
  • Keep your phone on silent and close other tabs and notifications.
  • Look at the camera when you speak, not only at your own video.
  • Keep a pen and paper for coding or aptitude questions.
  • Join the meeting link two or three minutes early.

Practise and learn more

The questions on this page cover the most common topics, but interviewers often go one level deeper. These free resources are good for revising a topic properly and practising with real problems. Use them after you have tried answering our questions out loud, to fill the gaps you found.

After the interview

Write down the questions you were asked, especially the ones you struggled with, while they are fresh. Look up the correct answers the same day. Over a few interviews, this list becomes the best study material you have.

If you have an official email from the recruiter, a short thank-you note is fine. Do not message the interviewer on personal numbers or social media. Results can take anywhere from a day to a few weeks. Keep applying in the meantime. Browse fresher jobs and walk-in drives, and polish your resume for the next application.

Frequently asked questions

Most fresher hiring in India has three or four steps: an online aptitude test, a coding or technical test, a technical interview and an HR interview. Some service companies combine the technical and HR rounds. Walk-in drives often finish all rounds on the same day.

Keep going

These guides go deeper into each step of the job search. See them all in career resources.

Ready to apply?

Browse the latest openings and apply on the company’s official site.

This guide shares general advice based on how hiring commonly works in India. Every company has its own process, so always check the details in the official job notice. Fresher Job Alerts is a job board, not a recruiter, and never charges candidates.

© 2026 Fresher Job Alerts. All rights reserved.

Disclaimer: Fresher Job Alerts shares job updates, free referrals to published openings (on request), and career resources for people who are seriously looking for work. We do not charge a placement fee and we do not offer or encourage backdoor entries. We do not guarantee a job. Anyone using our name to demand money is committing fraud.