Software Engineer Fresher Interview Questions and Answers
Last updated 2026-11-19
A fresher software engineer interview is rarely about one framework. Interviewers want to see whether you hold the basics firmly: how data is stored, how programs run, how two systems talk, and whether you can write a short, correct function while explaining your thinking. This page collects fifteen questions that cut across those areas, each with an answer you can say aloud in about a minute.
Use the answers as a model, not a script. Interviewers follow up on whatever you say, so only state what you can defend. If a question is about a language you do not use, answer in the one you do. For subject-wise depth, follow the links to the dedicated question banks.
| Typical areas | OOP, data structures, DBMS, OS, networks, one coding problem |
|---|---|
| Languages | Whichever you list on the resume: Java, Python, C++ or JavaScript |
| Questions here | 15, easy to hard |
How to prepare in two weeks
Spend the first week on theory you can explain without notes: the four OOP principles, normal forms, process versus thread, and the lifecycle of an HTTP request. Spend the second week writing small programs by hand: reverse a list, detect a cycle, group anagrams, write a SQL query with a join and a GROUP BY.
- Pick one language and learn its standard collections properly.
- Be ready to explain every project line on your resume, including why you chose each tool.
- Practise saying the time and space complexity after every solution.
Common mistakes freshers make
- Reciting definitions with no example. Add a one-line example from code you wrote.
- Starting to code before restating the problem and checking edge cases such as empty input.
- Claiming skills you cannot back up. A follow-up on that skill will expose it.
- Going silent when stuck. Say what you have tried and what you would try next.
Software Engineer Fresher Interview Questions and Answers: questions with worked answers
1 What are the four pillars of object-oriented programming?
easyEncapsulation bundles data with the methods that act on it and hides internals behind an interface, for example a private balance field changed only through deposit(). Abstraction exposes what an object does and hides how. Inheritance lets a class reuse and specialise another. Polymorphism lets one call, such as shape.area(), run different code depending on the actual object. Give one concrete example for each rather than a definition.
2 What is the difference between an array and a linked list?
easyAn array stores elements in contiguous memory, so index access is O(1) but inserting or deleting in the middle is O(n) because elements shift. A singly linked list stores nodes with pointers, so inserting after a known node is O(1) but reaching the k-th element is O(k). Arrays are cache friendly, which makes them faster in practice for most workloads. Choose a linked list only when you need frequent insertion at known positions.
3 Explain process versus thread.
easyA process is a running program with its own address space and resources. A thread is a unit of execution inside a process, and threads of one process share its heap and open files while each has its own stack and registers. Context switching between threads is cheaper, and communication is easy but needs synchronisation. A crash in one thread can bring down the whole process, whereas processes are isolated from each other.
4 What is the difference between a primary key and a foreign key?
easyA primary key uniquely identifies each row in a table, cannot be NULL and there is exactly one per table, though it may span several columns. A foreign key is a column that references the primary key of another table and enforces referential integrity, so you cannot insert an order for a customer that does not exist. Deleting the parent row is then restricted, cascaded or set to NULL depending on the rule.
5 What is the time complexity of binary search and what does it require?
easyBinary search runs in O(log n) time and O(1) extra space when written iteratively. It requires a sorted collection with random access. Each step compares the middle element and discards half of the range. On a linked list it loses its advantage because reaching the middle costs O(n).
pythondef binary_search(a, target): lo, hi = 0, len(a) - 1 while lo <= hi: mid = lo + (hi - lo) // 2 if a[mid] == target: return mid if a[mid] < target: lo = mid + 1 else: hi = mid - 1 return -16 Reverse a singly linked list. State the complexity.
mediumWalk the list once, pointing each node back at the previous one. Keep three references: previous, current and the saved next. Time is O(n) and space is O(1). The classic bug is forgetting to save current.next before overwriting it, which loses the rest of the list.
pythondef reverse(head): prev = None cur = head while cur: nxt = cur.next cur.next = prev prev = cur cur = nxt return prev7 What is a hash map and how are collisions handled?
mediumA hash map applies a hash function to the key to pick a bucket, giving average O(1) lookup, insert and delete. Two keys can land in the same bucket. Chaining stores a list, or in Java a tree after eight entries, in each bucket. Open addressing probes for the next free slot. When the load factor passes a threshold the table is resized and keys are rehashed. The worst case is O(n) with a poor hash function.
8 Explain stack versus heap memory.
mediumThe stack holds call frames: local variables, parameters and return addresses. Allocation and release are automatic as functions enter and return, and it is fast but small, so deep recursion causes a stack overflow. The heap holds objects whose lifetime outlives one call. In Java and Python the garbage collector reclaims them, in C++ you manage them yourself. In Java, local primitives live on the stack while objects live on the heap, with the reference on the stack.
9 What does a SQL INNER JOIN return, and how does it differ from LEFT JOIN? Write a query.
mediumINNER JOIN returns only rows where the join condition matches in both tables. LEFT JOIN returns every row from the left table and fills the right-side columns with NULL when there is no match, which is how you find customers with no orders. See the DBMS interview questions for more joins.
sqlSELECT c.name, COUNT(o.id) AS orders FROM customers c LEFT JOIN orders o ON o.customer_id = c.id GROUP BY c.id, c.name HAVING COUNT(o.id) = 0;10 What are ACID properties?
mediumAtomicity means a transaction either completes entirely or has no effect. Consistency means it moves the database from one valid state to another, respecting constraints. Isolation means concurrent transactions do not see each other half-done, to a degree set by the isolation level. Durability means once committed, data survives a crash, usually through a write-ahead log. A bank transfer that debits one account and credits another is the standard example.
11 What happens when you type a URL into a browser and press Enter?
mediumThe browser checks its cache, then resolves the domain to an IP through DNS. It opens a TCP connection and performs a TLS handshake for HTTPS, then sends an HTTP request. The server returns HTML. The browser parses it, fetches CSS, JavaScript and images, builds the DOM and CSSOM, lays out the page and paints it. Mention that HTTP/3 uses QUIC over UDP to show you know current practice. More in computer networks interview questions.
12 In Java, what is the difference between == and equals()?
mediumFor objects, == compares references, meaning whether both variables point to the same object. equals() compares logical content when the class overrides it, as String and Integer do. Two new String("a") objects are not == but are equals. If you override equals() you must also override hashCode(), otherwise HashMap and HashSet behave wrongly because equal objects land in different buckets.
javaString a = new String("hi"); String b = new String("hi"); System.out.println(a == b); // false System.out.println(a.equals(b)); // true13 Git merge versus rebase: when do you use each?
mediumMerge joins two branches with a merge commit and preserves history exactly as it happened. Rebase replays your commits on top of the target branch, giving a linear history but rewriting commit hashes. Rebase your own unpublished feature branch to pick up main, and merge when the branch is shared. Never rebase commits others have pulled, because it forces everyone to reconcile rewritten history.
14 Find the first non-repeating character in a string. Give the complexity.
hardCount occurrences in one pass, then scan again for the first character with a count of one. Time is O(n) and space is O(k) where k is the alphabet size, effectively constant for ASCII. Mention the follow-up: for a stream you keep an ordered structure of candidates so the answer stays available at each step.
pythonfrom collections import Counter def first_unique(s): counts = Counter(s) for i, ch in enumerate(s): if counts[ch] == 1: return i return -115 How do you debug a program that works on your machine but fails in production?
hardStart from evidence, not guesses. Read the logs and the exact error, then find what differs: configuration, environment variables, data volume, dependency versions, time zone or permissions. Reproduce with production-like data in a staging environment, add targeted logging if needed, and form one hypothesis at a time. Once fixed, add a test that would have caught it. This shows method, which interviewers value more than a lucky guess.
Frequently asked questions
What do interviewers ask freshers most often?
OOP, one or two data structure problems, SQL basics, operating system concepts such as processes and deadlocks, and questions about your projects. Aptitude and HR rounds usually come alongside.
Which language should a fresher use in interviews?
The one you know best. Interviewers care more about correct logic and clear explanation than about the language, as long as it is a mainstream one such as Java, Python or C++.
How many coding problems should I practise?
There is no fixed number. Cover each core topic with a handful of problems you can solve and explain without hints: arrays, strings, hash maps, linked lists, trees and basic dynamic programming.
Do freshers need to know system design?
Not in depth. Be ready for light questions such as how you would design a URL shortener at a basic level, but data structures, databases and fundamentals matter far more.
Related guides
- DBMS Interview Questions and Answers
- OOPs Interview Questions and Answers
- Operating Systems Interview Questions with Worked Answers
- Computer Networks Interview Questions with Worked Answers and Numericals
- Backend Developer Interview Questions and Answers
- Frontend Developer Interview Questions and Answers
More in Role-wise Interview Questions by Job and Tech Stack
- Spring Boot Interview Questions and Answers (Spring Boot 3)
- Statistics for Data Science Interview Questions and Answers
- Tableau Interview Questions and Answers
- Terraform Interview Questions and Answers
- Web Performance Interview Questions and Answers
- Web Security and OWASP Interview Questions and Answers
- A/B Testing Interview Questions and Answers
- Android Developer Interview Questions and Answers
- Angular Interview Questions and Answers (Angular 18 and Later)
- Ansible Interview Questions and Answers
- API Testing and Postman Interview Questions
- Automation Testing Interview Questions and Answers