Junior Developer Interview Questions and Answers

Junior interviews move from definitions to application. Expect to be asked how you would use a feature in real code, what goes wrong when you misuse it and how you would debug it.

  1. Q1Junior (0-2 years)JavaScript
    What is a closure in JavaScript and why is it useful?

    A closure is a function that keeps access to the variables of the scope where it was created, even after that outer function has finished running.

  2. Q2Junior (0-2 years)JavaScript
    How does the this keyword work in JavaScript?

    this is decided by how a function is called, not where it is written: as a method it is the object before the dot, with new it is the new object, and arrow functions inherit it from the enclosing scope.

  3. Q3Junior (0-2 years)JavaScript
    What is the difference between promises and async/await in JavaScript?

    async/await is syntax built on top of promises that lets you write asynchronous code that reads like synchronous code; under the hood every async function returns a promise.

  4. Q4Junior (0-2 years)JavaScript
    What is event delegation in JavaScript?

    Event delegation means attaching one listener to a parent element and using event bubbling to handle events from its children, instead of adding a listener to each child.

  5. Q5Junior (0-2 years)React
    What are React hooks and what are the rules of hooks?

    Hooks are functions such as useState and useEffect that let function components use state, lifecycle behaviour and other React features; they must be called at the top level of a component or custom hook, never inside loops, conditions or nested functions.

  6. Q6Junior (0-2 years)React
    How does useEffect work in React and what is the dependency array?

    useEffect runs a function after the component renders; the dependency array tells React when to re-run it: with no array it runs after every render, with an empty array only after the first, and with values only when those values change.

  7. Q7Junior (0-2 years)React
    Why do we need keys in React lists?

    Keys give each list item a stable identity so React can match items between renders and correctly add, remove or reorder them without recreating or mixing up their state.

  8. Q8Junior (0-2 years)React
    What is the difference between controlled and uncontrolled components in React?

    A controlled component keeps the input's value in React state and updates it through onChange, while an uncontrolled component lets the DOM hold the value and you read it with a ref when needed.

  9. Q9Junior (0-2 years)React
    What is prop drilling and how do you avoid it in React?

    Prop drilling is passing props through several layers of components that do not use them just to reach a deeply nested child; you avoid it with composition, the Context API or a state management library.

  10. Q10Junior (0-2 years)HTML & CSS
    What is the difference between relative, absolute, fixed and sticky positioning in CSS?

    Relative offsets an element from its normal place; absolute positions it against the nearest positioned ancestor; fixed is against the viewport; sticky sits in normal flow until a scroll threshold, then sticks.

  11. Q11Junior (0-2 years)HTML & CSS
    What is the difference between Flexbox and CSS Grid?

    Flexbox is one-dimensional (a row or a column). CSS Grid is two-dimensional (rows and columns at once). Use Flexbox for alignment along a line; use Grid when the layout is a real 2D structure.

  12. Q12Junior (0-2 years)HTML & CSS
    How does CSS specificity work?

    Specificity is the score the browser uses to decide which rule wins: inline styles beat IDs, IDs beat classes/attributes/pseudo-classes, and those beat elements. When scores tie, the last rule in the source wins.

  13. Q13Junior (0-2 years)HTML & CSS
    What is the difference between em, rem, %, vh and vw in CSS?

    em is relative to the parent font size, rem is relative to the root font size, % is relative to the parent’s relevant size, and vh/vw are 1% of the viewport height or width.

  14. Q14Junior (0-2 years)HTML & CSS
    What is the difference between cookies, localStorage and sessionStorage?

    Cookies are sent to the server with every matching request and can expire; localStorage persists until cleared and stays in the browser; sessionStorage lasts for the current tab only.

  15. Q15Junior (0-2 years)TypeScript
    What is the difference between any, unknown and never in TypeScript?

    any turns off checking. unknown is a type-safe any: you must narrow it before use. never means a value cannot exist, used for exhaustive checks and functions that always throw.

  16. Q16Junior (0-2 years)TypeScript
    What are generics in TypeScript?

    Generics are type parameters: they let a function, class or type work with many types while keeping the relationship between inputs and outputs, instead of falling back to any.

  17. Q17Junior (0-2 years)TypeScript
    What are union and intersection types in TypeScript?

    A union (A | B) is a value that is one of the members. An intersection (A & B) is a value that must satisfy both types at once.

  18. Q18Junior (0-2 years)TypeScript
    What are utility types in TypeScript like Partial, Pick and Omit?

    Utility types are built-in helpers that transform an existing type: Partial makes every field optional, Required the opposite, Pick keeps a set of keys, Omit removes them, and Record builds a key/value map.

  19. Q19Junior (0-2 years)SQL
    How do you find the second highest salary in SQL?

    Use a subquery that takes the MAX salary below the overall MAX, or use DENSE_RANK() and pick rank 2, which also handles ties and generalises to the Nth highest.

  20. Q20Junior (0-2 years)SQL
    How do you find and delete duplicate rows in SQL?

    Find duplicates with GROUP BY and HAVING COUNT(*) > 1, then delete them by numbering rows within each duplicate group with ROW_NUMBER() and removing every row after the first.

  21. Q21Junior (0-2 years)SQL
    What is the difference between UNION and UNION ALL in SQL?

    UNION combines two result sets and removes duplicate rows, while UNION ALL combines them and keeps every row, which makes it faster.

  22. Q22Junior (0-2 years)SQL
    What is database normalization and what are the normal forms?

    Normalization is organising tables to reduce redundancy and update anomalies: 1NF means atomic values, 2NF removes partial dependencies on part of a composite key, and 3NF removes dependencies between non-key columns.

  23. Q23Junior (0-2 years)C#
    What is the difference between const and readonly in C#?

    A const is a compile-time constant that must be assigned where it is declared, while a readonly field can be assigned at declaration or in the constructor, so its value can be decided at runtime.

  24. Q24Junior (0-2 years)C#
    What is the difference between ref and out parameters in C#?

    Both pass an argument by reference, but ref requires the variable to be initialised before the call, while out requires the method to assign a value before it returns.

  25. Q25Junior (0-2 years)C#
    What is the difference between an abstract class and an interface in C#?

    An abstract class can hold state, constructors and partial implementation but a class can inherit only one, while an interface defines a contract that a class can implement many of.

  26. Q26Junior (0-2 years)C#
    What is boxing and unboxing in C# and why does it affect performance?

    Boxing converts a value type to object by allocating it on the heap, and unboxing converts it back; both add allocations and casts, so avoid them in hot code paths.

  27. Q27Junior (0-2 years)C#
    What is LINQ in C# and what is deferred execution?

    LINQ (Language Integrated Query) lets you query collections, databases and XML with a consistent syntax, and deferred execution means a query does not run when you define it but when you enumerate the results.

  28. Q28Junior (0-2 years)Java
    What is the difference between an abstract class and an interface in Java?

    An abstract class can have instance fields, constructors and a mix of implemented and abstract methods but supports only single inheritance, while an interface defines a contract that a class can implement multiple times and, since Java 8, can include default methods.

  29. Q29Junior (0-2 years)Java
    What is the difference between ArrayList and LinkedList in Java?

    ArrayList is backed by a resizable array with O(1) index access and O(n) insertion in the middle, while LinkedList is a doubly linked list with O(n) index access and O(1) insertion once you hold the node; in practice ArrayList is faster for most workloads.

  30. Q30Junior (0-2 years)Java
    What is the difference between checked and unchecked exceptions in Java?

    Checked exceptions (subclasses of Exception other than RuntimeException) must be caught or declared with throws, while unchecked exceptions (RuntimeException and Error) do not have to be handled and usually signal programming bugs.

  31. Q31Junior (0-2 years)Java
    What are the main features of Java 8: lambdas, streams and Optional?

    Java 8 introduced lambda expressions, functional interfaces, the Stream API for declarative collection processing, Optional to represent missing values, default methods in interfaces, method references and the java.time date and time API.

  32. Q32Junior (0-2 years)Python
    What are *args and **kwargs in Python?

    *args collects extra positional arguments into a tuple and **kwargs collects extra keyword arguments into a dictionary, which lets a function accept a variable number of arguments.

  33. Q33Junior (0-2 years)Python
    Why should you not use a mutable default argument in Python?

    Default argument values are evaluated once when the function is defined, so a default list or dictionary is shared between every call that does not pass its own, causing data to leak between calls.

  34. Q34Junior (0-2 years)Python
    What is the difference between a shallow copy and a deep copy in Python?

    A shallow copy creates a new container but reuses the same nested objects, while a deep copy recursively copies everything so the new object is fully independent.

  35. Q35Junior (0-2 years)Python
    What is the difference between @staticmethod and @classmethod in Python?

    A classmethod receives the class as its first argument (cls) and can create or configure instances, while a staticmethod receives no automatic argument and is just a function placed inside the class namespace.

  36. Q36Junior (0-2 years)Node.js
    What is the difference between require and import in Node.js?

    require is the CommonJS module system, which loads modules synchronously at runtime, while import is the ES module standard, which is statically analysed, asynchronous and supports top-level await and tree shaking.

  37. Q37Junior (0-2 years)Node.js
    What is middleware in Express and how does it work?

    Middleware are functions that receive the request, response and a next callback; they run in the order they are registered and can modify the request, end the response or pass control on with next().

  38. Q38Junior (0-2 years)System Design
    What is the difference between horizontal and vertical scaling?

    Vertical scaling means giving one machine more CPU, memory or disk, while horizontal scaling means adding more machines and spreading the load across them.

  39. Q39Junior (0-2 years)System Design
    What is a load balancer and what are the common load balancing algorithms?

    A load balancer distributes incoming requests across several servers to improve capacity and availability, using algorithms such as round robin, least connections or consistent hashing.