Skip to content
Top Questions

Crack Any Technical Interview

The ultimate verified collections of top interview questions covering Java, Python, general coding algorithms, and critical DSA (Data Structures & Algorithms) for high-paying roles.

100 Most Important Java Questions

Master these 100 questions and you can crack any Java interview.

  1. What are the main features of Java?
  2. What is the difference between JDK, JRE, and JVM?
  3. What are access modifiers in Java?
  4. What is the difference between == and .equals()?
  5. What is a constructor?
  6. Can a constructor be private?
  7. What is abstraction and encapsulation?
  8. Explain inheritance.
  9. What is method overloading?
  10. What is method overriding?
  11. What are primitive data types?
  12. What is type casting?
  13. Difference between static and non-static variables?
  14. Difference: final, finally, finalize()?
  15. Use of this and super?
  16. Difference between String, StringBuffer, StringBuilder?
  17. Why are Strings immutable?
  18. How does intern() work?
  19. equals() vs hashCode()?
  20. "abc" + 1 + 2 vs 1 + 2 + "abc"?
  21. Difference between Array and ArrayList?
  22. What is the Collection framework?
  23. List vs Set vs Map?
  24. ArrayList vs LinkedList?
  25. HashSet vs TreeSet?
  26. How does HashMap work internally?
  27. Can HashMap store null keys?
  28. HashMap vs Hashtable?
  29. What is ConcurrentHashMap?
  30. Fail-fast vs fail-safe?
  31. Difference between checked and unchecked exceptions?
  32. Explain try-catch-finally with example.
  33. Can we have multiple catch blocks?
  34. Difference between throw and throws?
  35. What happens if there's a return in try and finally block?
  36. What is multithreading?
  37. Difference between process and thread?
  38. How to create a thread in Java?
  39. Runnable vs Thread class?
  40. What is synchronization?
  41. Difference between wait() and sleep()?
  42. What is a deadlock?
  43. How to prevent deadlock?
  44. Synchronized method vs synchronized block?
  45. What is volatile keyword?
  46. What are lambda expressions?
  47. What is a functional interface?
  48. What is Stream API?
  49. Difference between map() and flatMap()?
  50. Default and static methods in interface?
  51. Difference between abstract class and interface?
  52. Can we create an object of an interface?
  53. Can interfaces have constructors?
  54. What happens if a class does not implement all interface methods?
  55. Can a class implement multiple interfaces?
  56. How does garbage collection work in Java?
  57. Types of references in Java?
  58. Difference between System.gc() and Runtime.gc()?
  59. What is a memory leak in Java?
  60. Can we force garbage collection in Java?
  61. What is serialization in Java?
  62. How to make a Java class serializable?
  63. What is serialVersionUID?
  64. What happens if a class has a non-serializable field?
  65. Difference between Serializable and Externalizable?
  66. What is an inner class?
  67. What are anonymous inner classes?
  68. Can static classes be inner classes?
  69. Difference between static and non-static inner classes?
  70. Use cases for inner classes?
  71. What is the memory structure of JVM?
  72. What is PermGen and Metaspace?
  73. What is heap and stack memory?
  74. How to avoid memory leaks?
  75. Tools to analyze memory usage in Java?
  76. What is the use of transient keyword?
  77. Difference between static block and constructor?
  78. Can we override static methods?
  79. Can main() be overloaded?
  80. Why is the main method static?
  81. What is SOLID in Java?
  82. Explain the Singleton Design Pattern.
  83. What is Factory Design Pattern?
  84. What is Observer Design Pattern?
  85. Best practices for Java programming?
  86. Reverse a string without using built-in methods.
  87. Check if a number is a palindrome.
  88. Find duplicate elements in an array.
  89. Implement Fibonacci series using recursion.
  90. Find the first non-repeated character in a string.
  91. Sort an array without using sort().
  92. Check if two strings are anagrams.
  93. Custom implementation of HashMap?
  94. Producer-consumer problem using threads.
  95. Count frequency of each word in a sentence.
  96. Compile-time vs runtime polymorphism?
  97. Can a class be both abstract and final?
  98. What is method hiding?
  99. How does autoboxing/unboxing work?
  100. What is the diamond problem and how does Java handle it?..

Python Interview Questions

Essential Python questions covering basics, standard library, and OOP structure.

  1. What is Python?
  2. Why is Python called an interpreted language?
  3. What are the main features of Python?
  4. What is dynamic typing?
  5. What are keywords in Python?
  6. What is PEP 8?
  7. What is indentation in Python?
  8. What is a variable?
  9. Difference between = and ==?
  10. What is None in Python?
  11. What are mutable data types?
  12. What are immutable data types?
  13. What is a list?
  14. What is a tuple?
  15. What is a set?
  16. What is a dictionary?
  17. Why are dictionaries fast?
  18. What is list comprehension?
  19. What is slicing?
  20. What is type casting?
  21. What is a function?
  22. What are parameters and arguments?
  23. What is a lambda function?
  24. What is recursion?
  25. What is Object-Oriented Programming?
  26. What is a class?
  27. What is an object?
  28. What is the __init__ method?
  29. What is inheritance?
  30. What is polymorphism?
  31. What is encapsulation?
  32. What is abstraction?
  33. What is an iterator?
  34. What is an iterable?
  35. What is a generator?
  36. What is exception handling?
  37. What is a try-except block?
  38. What is a finally block?
  39. What is the with statement?
  40. What is garbage collection?
  41. How does Python manage memory?
  42. What is a module?
  43. What is a package?
  44. What is pip?
  45. What is a virtual environment?
  46. Difference between shallow copy and deep copy?
  47. Difference between is and ==?
  48. Why is Python slower than C?
  49. Where is Python used?
  50. Why should we use Python?

Coding Problems Practice

Practice these after learning any one language to build strong problem-solving logic.

  1. Reverse a String
  2. Check for Palindrome
  3. Fibonacci Series
  4. Factorial of a Number
  5. Prime Number Check
  6. Count Vowels and Consonants
  7. Sort an Array
  8. Merge Two Arrays
  9. Find the Largest Element in an Array
  10. Remove Duplicates from an Array
  11. Check if a Number is Armstrong
  12. Reverse a Number
  13. Calculate GCD of Two Numbers
  14. Check for Anagram
  15. Count the Number of Digits in a Number
  16. Print the Prime Numbers in a Range
  17. Find the Second Largest Element in an Array
  18. Swap Two Numbers
  19. Print the Pascal's Triangle
  20. Find the Missing Number in an Array
  21. Convert Decimal to Binary
  22. Check for Perfect Number
  23. Implementing a Simple Calculator
  24. Find the Sum of Digits of a Number
  25. Find the Length of a String
  26. Check if a String is Empty
  27. Count the Occurrences of a Character in a String
  28. Find the First Non-Repeated Character in a String
  29. Remove All Whitespaces from a String
  30. Find the Common Elements in Two Arrays
  31. Find the Factorial of a Number using Recursion
  32. Generate Random Numbers
  33. Check if a Year is Leap Year
  34. Find the Sum of First N Natural Numbers
  35. Implement a Simple Login System
  36. Check if a String Contains Another String
  37. Find the Maximum Occurring Character in a String
  38. Implementing Bubble Sort
  39. Implementing Selection Sort

DSA to Practice for Top Companies

Focus on these Leetcode-style standard DSA problems to land a high-paying job.

  1. LeetCode 1: Two Sum (Arrays)
  2. LeetCode 121: Best Time to Buy and Sell Stock (Arrays)
  3. LeetCode 88: Merge Sorted Array (Arrays)
  4. LeetCode 217: Contains Duplicate (Arrays)
  5. LeetCode 238: Product of Array Except Self (Arrays)
  6. LeetCode 53: Maximum Subarray (Arrays)
  7. LeetCode 15: 3Sum (Arrays)
  8. LeetCode 56: Merge Intervals (Arrays)
  9. LeetCode 11: Container With Most Water (Arrays)
  10. LeetCode 48: Rotate Image (Arrays)
  11. LeetCode 20: Valid Parentheses (Strings)
  12. LeetCode 125: Valid Palindrome (Strings)
  13. LeetCode 242: Valid Anagram (Strings)
  14. LeetCode 49: Group Anagrams (Strings)
  15. LeetCode 5: Longest Palindromic Substring (Strings)
  16. LeetCode 76: Minimum Window Substring (Strings)
  17. LeetCode 28: Find the Index of the First Occurrence in a String (Strings)
  18. LeetCode 443: String Compression (Strings)
  19. LeetCode 14: Longest Common Prefix (Strings)
  20. LeetCode 459: Repeated Substring Pattern (Strings)
  21. LeetCode 206: Reverse Linked List (Linked Lists)
  22. LeetCode 21: Merge Two Sorted Lists (Linked Lists)
  23. LeetCode 19: Remove Nth Node From End of List (Linked Lists)
  24. LeetCode 141: Linked List Cycle (Linked Lists)
  25. LeetCode 2: Add Two Numbers (Linked Lists)
  26. LeetCode 160: Intersection of Two Linked Lists (Linked Lists)
  27. LeetCode 234: Palindrome Linked List (Linked Lists)
  28. LeetCode 25: Reverse Nodes in k-Group (Linked Lists)
  29. LeetCode 704: Binary Search
  30. LeetCode 34: Find First and Last Position of Element in Sorted Array (Binary Search)
  31. LeetCode 74: Search a 2D Matrix (Binary Search)
  32. LeetCode 33: Search in Rotated Sorted Array (Binary Search)
  33. LeetCode 81: Search in Rotated Sorted Array II (Binary Search)
  34. LeetCode 162: Find Peak Element (Binary Search)
  35. LeetCode 104: Maximum Depth of Binary Tree (Trees)
  36. LeetCode 100: Same Tree (Trees)
  37. LeetCode 101: Symmetric Tree (Trees)
  38. LeetCode 144: Binary Tree Preorder Traversal (Trees)
  39. LeetCode 94: Binary Tree Inorder Traversal (Trees)
  40. LeetCode 145: Binary Tree Postorder Traversal (Trees)
  41. LeetCode 102: Binary Tree Level Order Traversal (Trees)
  42. LeetCode 110: Balanced Binary Tree (Trees)
  43. LeetCode 39: Combination Sum (Recursion)
  44. LeetCode 46: Permutations (Recursion)
  45. LeetCode 78: Subsets (Recursion)
  46. LeetCode 51: N-Queens (Recursion)
  47. LeetCode 17: Letter Combinations of a Phone Number (Recursion)
  48. LeetCode 90: Subsets II (Recursion)
  49. LeetCode 37: Sudoku Solver (Recursion)
  50. LeetCode 70: Climbing Stairs (DP)
  51. LeetCode 198: House Robber (DP)
  52. LeetCode 322: Coin Change (DP)
  53. LeetCode 300: Longest Increasing Subsequence (DP)
  54. LeetCode 1143: Longest Common Subsequence (DP)
  55. LeetCode 62: Unique Paths (DP)
  56. LeetCode 5: Longest Palindromic Substring (DP)
  57. LeetCode 718: Maximum Length of Repeated Subarray (DP)
  58. LeetCode 416: Partition Equal Subset Sum (DP)
  59. LeetCode 53: Maximum Subarray (DP)
  60. LeetCode 133: Clone Graph (Graphs)
  61. LeetCode 200: Number of Islands (Graphs)
  62. LeetCode 207: Course Schedule (Graphs)
  63. LeetCode 785: Is Graph Bipartite? (Graphs)
  64. LeetCode 994: Rotting Oranges (Graphs)
  65. LeetCode 323: Number of Connected Components in an Undirected Graph (Graphs)
  66. LeetCode 136: Single Number (Bit Manipulation)
  67. LeetCode 190: Reverse Bits (Bit Manipulation)
  68. LeetCode 191: Number of 1 Bits (Bit Manipulation)
  69. LeetCode 268: Missing Number (Bit Manipulation)