To prepare for a Java internship interview, learn to explain how things work and why, not only what they are called. Be fluent in five areas: collections, concurrency, Spring, SQL and basic system design. For each area, practise answering aloud in three layers: a one-line definition, the mechanism underneath, and a trade-off or failure case. This guide gives you a question bank for those areas, with reasoning notes you can adapt to your own words.
How to use this guide
This is an independent guide written for students of Vellore Institute of Technology (VIT). It is not issued by, endorsed by or connected to the university. Nothing here describes VIT’s internship rules, training schedule or career-support process. Those belong to your university, and the verification list near the end of this article shows how to check them.
Internship interviews for Java and enterprise software roles usually test fundamentals more than frameworks. Interviewers differ by company, so treat the question bank as a coverage map rather than a prediction of what you will be asked. If you can reason through every row below, you can handle most variations.
What interviewers are usually probing
- Accuracy of mental models: Can you describe what a HashMap does internally, rather than reciting that it stores key-value pairs?
- Trade-off thinking: Can you say when you would choose one structure, lock or query plan over another?
- Debugging instinct: Given a symptom such as a slow endpoint or a data race, can you list likely causes in order?
- Honest boundaries: Can you say “I have not used that, but here is how I would reason about it”?
Free 2-Week CareerSwami Internship
Online, 14 days, with a free offer letter and a free completion certificate once you finish the work. Check with your college that it fits your requirement before you enrol.
A scorecard to rate yourself before you start
Rate each topic from 0 to 3 (0 = cannot explain, 1 = can define, 2 = can explain the mechanism, 3 = can explain the mechanism and a trade-off, with a small code example). Anything below 2 gets study time first.
| Topic area | Core items to cover | Self-rating (0-3) |
|---|---|---|
| Core Java and OOP | equals/hashCode contract, immutability, String pool, exceptions, generics basics, interfaces vs abstract classes | |
| Collections | ArrayList, LinkedList, HashMap, TreeMap, HashSet, PriorityQueue, fail-fast iterators | |
| Concurrency | threads, synchronized, volatile, ExecutorService, ConcurrentHashMap, deadlock | |
| Spring and Spring Boot | IoC, dependency injection, bean scopes, REST controllers, transactions, auto-configuration | |
| SQL and databases | joins, GROUP BY, indexes, normalisation, transactions, isolation levels | |
| System basics | HTTP, REST, caching, statelessness, load balancing, simple schema and API design |
Question bank 1: Java collections
Collections questions are favourites because they reveal whether you understand data structures or only know the API.
Questions
- How does a HashMap store and retrieve a value? What happens on a collision?
- Why must you override hashCode whenever you override equals?
- When would you pick ArrayList over LinkedList, and the reverse?
- What is the difference between HashMap, LinkedHashMap and TreeMap?
- What does fail-fast mean for an iterator? How do you remove items safely while iterating?
- How is HashSet related to HashMap?
- What is the difference between Comparable and Comparator?
- What is the difference between Collections.synchronizedMap and ConcurrentHashMap?
Reasoning notes
- HashMap: The key’s hashCode picks a bucket. Within a bucket, equals decides which entry matches. Entries that land in the same bucket are chained, and in modern JDKs a long chain can be converted to a tree. State the average cost as constant time and the worst case as worse. Mention resizing when the load factor is exceeded.
- equals and hashCode: If two objects are equal but give different hash codes, a lookup may search the wrong bucket and miss the entry. Mutable keys cause a related bug: changing a field after insertion can make the entry unreachable.
- ArrayList vs LinkedList: ArrayList wins on random access and memory locality. LinkedList only helps for frequent insertion at known node positions, which is rare in practice. A good answer says that most real code defaults to ArrayList.
- Map variants: HashMap makes no ordering promise. LinkedHashMap preserves insertion order (or access order). TreeMap keeps keys sorted and costs logarithmic time per operation.
- Fail-fast: Structural modification during iteration usually triggers ConcurrentModificationException. Use Iterator.remove, removeIf, or collect and remove afterwards. Note that fail-fast behaviour is best-effort, not a guarantee.
- ConcurrentHashMap: It allows many threads to read and update with finer-grained coordination than one lock around the whole map. It also provides atomic methods such as computeIfAbsent and merge, which avoid check-then-act races.
Question bank 2: Concurrency
Questions
- What is the difference between a process and a thread?
- What does synchronized guarantee? What does volatile guarantee?
- What is a race condition? Give a short example.
- What are the four conditions for deadlock, and how would you prevent it?
- Why use an ExecutorService instead of creating threads manually?
- What is the difference between Runnable and Callable? What does a Future give you?
- What does the happens-before relationship mean in the Java memory model?
- When would you use AtomicInteger instead of synchronized?
Reasoning notes
- synchronized vs volatile: synchronized gives mutual exclusion and visibility of changes between threads. volatile gives visibility and ordering for a single variable but not atomicity. That is why a volatile counter incremented by several threads still loses updates, since count++ is a read, an add and a write.
- Race condition: The outcome depends on thread timing. A check-then-act sequence, such as “if the key is absent, insert it”, is the classic form.
- Deadlock: Mutual exclusion, hold-and-wait, no pre-emption and circular wait must all hold. The most practical fix is a consistent global lock ordering, which breaks circular wait. Timeouts with tryLock are another option.
- Executors: Pools reuse threads, bound resource use and separate task submission from execution policy. Mention that an unbounded queue or unbounded thread count can exhaust memory. Also mention shutting the pool down.
- Atomic classes: They use hardware-supported compare-and-set operations for single-variable updates. They suit counters and flags. They do not help when several variables must change together; use a lock there.
Question bank 3: Spring and Spring Boot
Questions
- What is Inversion of Control, and how does dependency injection implement it?
- Why is constructor injection generally preferred over field injection?
- What are the common bean scopes? Which is the default?
- What does Spring Boot’s auto-configuration do?
- What is the difference between @Component, @Service and @Repository?
- How does @Transactional work, and what are common pitfalls?
- How would you handle exceptions across all REST controllers?
- What is the difference between @RestController and @Controller?
Reasoning notes
- IoC and DI: Instead of a class creating its collaborators, the container creates and supplies them. The benefit is looser coupling and easier testing, since you can pass a fake dependency in a test.
- Constructor injection: Dependencies are explicit, can be final, and the object cannot exist half-built. It also makes unit tests simple because no container is needed.
- Scopes: Singleton is the default: one instance per container. Prototype creates a new instance per request for the bean. Web scopes such as request and session exist for web applications. Warn that singleton beans must be stateless or thread-safe.
- Auto-configuration: Boot inspects the classpath and existing beans and configures sensible defaults, which you can override. A strong answer mentions that starters bundle dependencies.
- Stereotype annotations: All three register beans. Service and Repository communicate intent, and Repository also enables exception translation for persistence errors.
- @Transactional: It is usually applied through a proxy. Pitfalls include calling a transactional method from another method in the same class (the proxy is bypassed), applying it to non-public methods, and expecting rollback on checked exceptions without configuring it.
- Central error handling: A class annotated with @ControllerAdvice and methods annotated with @ExceptionHandler map exceptions to consistent HTTP responses.
Question bank 4: SQL and databases
Questions
- What is the difference between INNER JOIN, LEFT JOIN and FULL JOIN?
- What is the difference between WHERE and HAVING?
- What is an index? What does it cost?
- Explain the first three normal forms in plain terms.
- What do ACID properties mean?
- What problems do isolation levels address (dirty read, non-repeatable read, phantom read)?
- Write a query for the second-highest salary in an employee table.
- What is the N+1 query problem in an ORM such as Hibernate/JPA?
Reasoning notes
- Joins: INNER keeps only matching rows. LEFT keeps every left-table row and fills missing right values with NULL. Draw two small tables during the interview to show you understand.
- WHERE vs HAVING: WHERE filters rows before grouping. HAVING filters groups after aggregation.
- Indexes: They speed up reads on the indexed columns, typically using a B-tree. The cost is extra storage and slower writes. A composite index depends on column order.
- Normalisation: Roughly, remove repeating groups, then remove partial dependencies on a key, then remove dependencies between non-key columns. Mention that deliberate denormalisation is sometimes used for read speed.
- Isolation: Higher isolation prevents more anomalies but reduces concurrency. Say which anomalies each standard level permits, and note that exact defaults vary between database products.
- N+1: One query loads N parent rows, then one more query per parent loads its children. Fixes include fetch joins, entity graphs or batch fetching.
Question bank 5: System basics
Questions
- What does it mean for a REST API to be stateless?
- Which HTTP methods are idempotent? Why does it matter?
- What is the difference between 401 and 403?
- What is caching, and what are the risks?
- How would you design a URL shortener at a basic level?
- What is horizontal vs vertical scaling?
- Why would you put a message queue between two services?
- How would you paginate a list endpoint?
Reasoning notes
- Stateless: Each request carries what the server needs, so any instance can serve it. This is what makes horizontal scaling straightforward.
- Idempotency: GET, PUT and DELETE are meant to be idempotent, so retrying after a timeout is safe. POST is not, so retries may duplicate work unless you add an idempotency key.
- 401 vs 403: 401 means the caller is not authenticated. 403 means the caller is known but not allowed.
- Caching: It reduces latency and database load. The risks are stale data and difficult invalidation. Name a time-to-live and an invalidation-on-write strategy.
- URL shortener: Clarify requirements first. Then describe an ID generator, a key-to-URL table, a cache for hot reads and a redirect endpoint. For an internship, a clear and simple design beats an elaborate one.
- Queues: They decouple producer and consumer speeds, absorb bursts and allow retries. The cost is eventual consistency and extra operational complexity.
- Pagination: Offset-based is simple but slows down on deep pages. Keyset (cursor) pagination stays fast and stable under inserts.
Worked illustrative example: answering a concurrency question
This example is illustrative. It shows the shape of a good answer and has not been compiled or run here; test any code yourself.
Question: “Two threads each add 1,000 to a shared counter. Why might the result be less than 2,000, and how do you fix it?”
Step 1: Name the problem. The increment is not atomic. It reads the value, adds one and writes it back. Two threads can read the same value and one update is lost.
class Counter {
private int count = 0;
void increment() { count++; } // not atomic
int get() { return count; }
}
Step 2: Offer fixes and compare them.
// Option A: lock
synchronized void increment() { count++; }
// Option B: atomic variable
private final java.util.concurrent.atomic.AtomicInteger count =
new java.util.concurrent.atomic.AtomicInteger();
void increment() { count.incrementAndGet(); }
Step 3: State the trade-off. Option B is lighter for a single counter. Option A is more general because it protects several fields together. Marking the original field volatile alone would not fix the issue, because volatile provides visibility but not atomic read-modify-write.
Step 4: Mention how you would verify. Run many threads and iterations in a test and compare the final value with the expected one. Say that a passing test is evidence, not proof, since races are timing dependent.
The structure to copy is: name the cause, give two fixes, compare them, say how you would check. It works for deadlock, caching and SQL index questions as well.
A two-week preparation roadmap
If you have about two weeks, a pace of two focused hours a day is enough to cover every bank above once and revisit weak spots.
| Days | Focus | Output to produce |
|---|---|---|
| 1-2 | Core Java, collections | A one-page note on HashMap internals; a small custom class with correct equals and hashCode |
| 3-4 | Concurrency | A program demonstrating a race and its fix; a written deadlock example and its prevention |
| 5-7 | Spring Boot | A small REST API with a service layer, a repository and a global exception handler |
| 8-9 | SQL | Ten join and aggregation queries on a sample schema; an index experiment using the database’s explain output |
| 10-11 | System basics | Two written designs, such as a URL shortener and a notification service |
| 12-13 | Mock interviews | Two timed sessions with a friend, each recorded or noted, with weak answers listed |
| 14 | Review and resume | A resume where every listed skill has a story you can explain |
Turning your project into interview material
Most internship interviews spend time on your project. Prepare answers to these prompts for each project on your resume:
- What problem did it solve, and who was the user?
- What was the data model, and why did you design the tables that way?
- Which part was hardest, and what did you try before it worked?
- What would break first if usage grew tenfold?
- What would you change if you started again?
Be exact about what you wrote and what came from a tutorial or template. An honest account of a small project holds up better under follow-up questions than a large claim you cannot defend.
If you want a structured project to practise with, CareerSwami offers a free two-week online internship with 26 tracks. It comes with a free offer letter and a free completion certificate after successful completion. It is a practice option, and it makes no promise of a stipend, academic credit or a job.
What is specific to VIT students preparing for Java interviews
Technical preparation for a Java and enterprise software internship can start straight away, but the administrative side depends on VIT’s own rules, which should be confirmed from VIT’s official channels. The rules that matter most are whether an internship needs prior approval, how it is recorded for your programme, and when campus recruitment activity begins relative to your semester. These details can differ by programme, campus and batch, so a senior’s experience may not match your own.
In practice, this affects how the guide’s question banks fit into your calendar. Collections, concurrency, Spring Boot, SQL and system basics can be practised on your own timetable. Approval, documentation and eligibility are separate matters. Settle them in writing before you accept an offer or begin an interview process that could clash with classes, labs or examinations.
If your project or coursework includes Java, database or web-application work, use it as interview material. Be ready to say what you built yourself, which design choices you made and what you would change. Be careful not to claim that a course project is the same thing as an internship. Whether a project counts for any requirement is a question for your department, not something this guide can decide.
The official VIT website (vit.ac.in) and your student portal are the places to find current regulations, curriculum documents and notices. Rely on the version for your own batch rather than on forwarded messages or older documents.
Checks to make before you commit to an internship
- Ask your department office or the university’s career or training and placement office, in writing, whether your programme requires internship approval in advance, and who gives it.
- Find the regulations or curriculum document for your batch and check how internships or industrial projects are recorded, if at all.
- Ask whether an online, unpaid or self-sourced Java or software internship is accepted for any requirement, and what proof is needed, such as an offer letter, certificate or report.
- Check the official portal or notices for training and placement timetables, and for who may attend, before scheduling interviews around them.
- Confirm how internship dates interact with your semester, lab sessions and exam schedule.
- Keep every reply as an email or signed note rather than relying on a verbal answer.
Common Java interview mistakes VIT students should avoid
- Memorising definitions without mechanisms. A follow-up question such as “what happens inside?” exposes this quickly.
- Listing frameworks you have only watched. List only what you can build a small example in.
- Skipping SQL. Many Java candidates over-prepare Spring and fumble a simple join.
- Silent thinking. Talk through your reasoning, including assumptions and edge cases.
- Not asking questions back. Clarifying requirements is part of the skill being tested, especially in design questions.
Frequently Asked Questions
How much Spring should I know for an internship interview?
Know dependency injection, the layered structure of controller, service and repository, how to build a simple REST endpoint, and basic transaction behaviour. Deep knowledge of security, messaging or microservices is not usually expected at internship level, but a basic grasp of authentication versus authorisation helps.
Do I need to know data structures and algorithms as well?
Often yes. Many interviews combine Java questions with a coding problem on arrays, strings, hash maps or trees. Practise solving problems in Java and explaining the time complexity of your solution.
Which Java version should I study?
Be comfortable with Java 8 features such as lambdas, streams and Optional, since they are widely used. If you have time, learn the features of the current long-term-support releases, such as records and the newer switch syntax, and check which version a company’s job description mentions.
What is the best way to practise SQL for interviews?
Create a small schema, such as students, courses and enrolments, with sample data in a local database. Write joins, grouped aggregates and subqueries against it. Then add an index and compare the query plan before and after.
How do I answer a question I do not know?
Say what you do know that is related, state your assumption, and reason towards an answer. For example, if asked about a framework feature you have not used, explain the underlying concept you would expect it to rely on. Do not guess confidently, because interviewers notice.
Is a project required, or are fundamentals enough?
Fundamentals matter most, but a small project gives you something concrete to discuss. A single well-understood REST application with a database is more useful than several half-understood ones.
Will an online Java or enterprise software internship certificate count towards VIT requirements?
That depends on your university’s rules, which are not covered here. Ask the relevant office in writing before relying on it. The CareerSwami internship provides an offer letter and a completion certificate, but it does not offer academic credit.
How should I handle a coding round in Java?
Restate the problem, confirm the input limits, describe your approach before typing, and test with a small example and an edge case, such as an empty input. Use standard collections confidently and explain why you chose each one.
Related Java & Enterprise Software guides
- Java Enterprise Internship Projects for SRM Institute of Science and Technology Students
- Chandigarh University Students: How to Evaluate a Java and Enterprise Software Internship
- Showing Java Enterprise Skills: A Portfolio Guide for Lovely Professional University Internship Seekers
- All Java & Enterprise Software internship guides
Ready to put this into practice?
Join the free two-week CareerSwami online internship in Java & Enterprise Software. The internship, the offer letter and the completion certificate are free.




