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.
- What are the main features of Java?
- What is the difference between JDK, JRE, and JVM?
- What are access modifiers in Java?
- What is the difference between == and .equals()?
- What is a constructor?
- Can a constructor be private?
- What is abstraction and encapsulation?
- Explain inheritance.
- What is method overloading?
- What is method overriding?
- What are primitive data types?
- What is type casting?
- Difference between static and non-static variables?
- Difference: final, finally, finalize()?
- Use of this and super?
- Difference between String, StringBuffer, StringBuilder?
- Why are Strings immutable?
- How does intern() work?
- equals() vs hashCode()?
- "abc" + 1 + 2 vs 1 + 2 + "abc"?
- Difference between Array and ArrayList?
- What is the Collection framework?
- List vs Set vs Map?
- ArrayList vs LinkedList?
- HashSet vs TreeSet?
- How does HashMap work internally?
- Can HashMap store null keys?
- HashMap vs Hashtable?
- What is ConcurrentHashMap?
- Fail-fast vs fail-safe?
- Difference between checked and unchecked exceptions?
- Explain try-catch-finally with example.
- Can we have multiple catch blocks?
- Difference between throw and throws?
- What happens if there's a return in try and finally block?
- What is multithreading?
- Difference between process and thread?
- How to create a thread in Java?
- Runnable vs Thread class?
- What is synchronization?
- Difference between wait() and sleep()?
- What is a deadlock?
- How to prevent deadlock?
- Synchronized method vs synchronized block?
- What is volatile keyword?
- What are lambda expressions?
- What is a functional interface?
- What is Stream API?
- Difference between map() and flatMap()?
- Default and static methods in interface?
- Difference between abstract class and interface?
- Can we create an object of an interface?
- Can interfaces have constructors?
- What happens if a class does not implement all interface methods?
- Can a class implement multiple interfaces?
- How does garbage collection work in Java?
- Types of references in Java?
- Difference between System.gc() and Runtime.gc()?
- What is a memory leak in Java?
- Can we force garbage collection in Java?
- What is serialization in Java?
- How to make a Java class serializable?
- What is serialVersionUID?
- What happens if a class has a non-serializable field?
- Difference between Serializable and Externalizable?
- What is an inner class?
- What are anonymous inner classes?
- Can static classes be inner classes?
- Difference between static and non-static inner classes?
- Use cases for inner classes?
- What is the memory structure of JVM?
- What is PermGen and Metaspace?
- What is heap and stack memory?
- How to avoid memory leaks?
- Tools to analyze memory usage in Java?
- What is the use of transient keyword?
- Difference between static block and constructor?
- Can we override static methods?
- Can main() be overloaded?
- Why is the main method static?
- What is SOLID in Java?
- Explain the Singleton Design Pattern.
- What is Factory Design Pattern?
- What is Observer Design Pattern?
- Best practices for Java programming?
- Reverse a string without using built-in methods.
- Check if a number is a palindrome.
- Find duplicate elements in an array.
- Implement Fibonacci series using recursion.
- Find the first non-repeated character in a string.
- Sort an array without using sort().
- Check if two strings are anagrams.
- Custom implementation of HashMap?
- Producer-consumer problem using threads.
- Count frequency of each word in a sentence.
- Compile-time vs runtime polymorphism?
- Can a class be both abstract and final?
- What is method hiding?
- How does autoboxing/unboxing work?
- What is the diamond problem and how does Java handle it?..
Python Interview Questions
Essential Python questions covering basics, standard library, and OOP structure.
- What is Python?
- Why is Python called an interpreted language?
- What are the main features of Python?
- What is dynamic typing?
- What are keywords in Python?
- What is PEP 8?
- What is indentation in Python?
- What is a variable?
- Difference between = and ==?
- What is None in Python?
- What are mutable data types?
- What are immutable data types?
- What is a list?
- What is a tuple?
- What is a set?
- What is a dictionary?
- Why are dictionaries fast?
- What is list comprehension?
- What is slicing?
- What is type casting?
- What is a function?
- What are parameters and arguments?
- What is a lambda function?
- What is recursion?
- What is Object-Oriented Programming?
- What is a class?
- What is an object?
- What is the __init__ method?
- What is inheritance?
- What is polymorphism?
- What is encapsulation?
- What is abstraction?
- What is an iterator?
- What is an iterable?
- What is a generator?
- What is exception handling?
- What is a try-except block?
- What is a finally block?
- What is the with statement?
- What is garbage collection?
- How does Python manage memory?
- What is a module?
- What is a package?
- What is pip?
- What is a virtual environment?
- Difference between shallow copy and deep copy?
- Difference between is and ==?
- Why is Python slower than C?
- Where is Python used?
- Why should we use Python?
Coding Problems Practice
Practice these after learning any one language to build strong problem-solving logic.
- Reverse a String
- Check for Palindrome
- Fibonacci Series
- Factorial of a Number
- Prime Number Check
- Count Vowels and Consonants
- Sort an Array
- Merge Two Arrays
- Find the Largest Element in an Array
- Remove Duplicates from an Array
- Check if a Number is Armstrong
- Reverse a Number
- Calculate GCD of Two Numbers
- Check for Anagram
- Count the Number of Digits in a Number
- Print the Prime Numbers in a Range
- Find the Second Largest Element in an Array
- Swap Two Numbers
- Print the Pascal's Triangle
- Find the Missing Number in an Array
- Convert Decimal to Binary
- Check for Perfect Number
- Implementing a Simple Calculator
- Find the Sum of Digits of a Number
- Find the Length of a String
- Check if a String is Empty
- Count the Occurrences of a Character in a String
- Find the First Non-Repeated Character in a String
- Remove All Whitespaces from a String
- Find the Common Elements in Two Arrays
- Find the Factorial of a Number using Recursion
- Generate Random Numbers
- Check if a Year is Leap Year
- Find the Sum of First N Natural Numbers
- Implement a Simple Login System
- Check if a String Contains Another String
- Find the Maximum Occurring Character in a String
- Implementing Bubble Sort
- Implementing Selection Sort
DSA to Practice for Top Companies
Focus on these Leetcode-style standard DSA problems to land a high-paying job.
- LeetCode 1: Two Sum (Arrays)
- LeetCode 121: Best Time to Buy and Sell Stock (Arrays)
- LeetCode 88: Merge Sorted Array (Arrays)
- LeetCode 217: Contains Duplicate (Arrays)
- LeetCode 238: Product of Array Except Self (Arrays)
- LeetCode 53: Maximum Subarray (Arrays)
- LeetCode 15: 3Sum (Arrays)
- LeetCode 56: Merge Intervals (Arrays)
- LeetCode 11: Container With Most Water (Arrays)
- LeetCode 48: Rotate Image (Arrays)
- LeetCode 20: Valid Parentheses (Strings)
- LeetCode 125: Valid Palindrome (Strings)
- LeetCode 242: Valid Anagram (Strings)
- LeetCode 49: Group Anagrams (Strings)
- LeetCode 5: Longest Palindromic Substring (Strings)
- LeetCode 76: Minimum Window Substring (Strings)
- LeetCode 28: Find the Index of the First Occurrence in a String (Strings)
- LeetCode 443: String Compression (Strings)
- LeetCode 14: Longest Common Prefix (Strings)
- LeetCode 459: Repeated Substring Pattern (Strings)
- LeetCode 206: Reverse Linked List (Linked Lists)
- LeetCode 21: Merge Two Sorted Lists (Linked Lists)
- LeetCode 19: Remove Nth Node From End of List (Linked Lists)
- LeetCode 141: Linked List Cycle (Linked Lists)
- LeetCode 2: Add Two Numbers (Linked Lists)
- LeetCode 160: Intersection of Two Linked Lists (Linked Lists)
- LeetCode 234: Palindrome Linked List (Linked Lists)
- LeetCode 25: Reverse Nodes in k-Group (Linked Lists)
- LeetCode 704: Binary Search
- LeetCode 34: Find First and Last Position of Element in Sorted Array (Binary Search)
- LeetCode 74: Search a 2D Matrix (Binary Search)
- LeetCode 33: Search in Rotated Sorted Array (Binary Search)
- LeetCode 81: Search in Rotated Sorted Array II (Binary Search)
- LeetCode 162: Find Peak Element (Binary Search)
- LeetCode 104: Maximum Depth of Binary Tree (Trees)
- LeetCode 100: Same Tree (Trees)
- LeetCode 101: Symmetric Tree (Trees)
- LeetCode 144: Binary Tree Preorder Traversal (Trees)
- LeetCode 94: Binary Tree Inorder Traversal (Trees)
- LeetCode 145: Binary Tree Postorder Traversal (Trees)
- LeetCode 102: Binary Tree Level Order Traversal (Trees)
- LeetCode 110: Balanced Binary Tree (Trees)
- LeetCode 39: Combination Sum (Recursion)
- LeetCode 46: Permutations (Recursion)
- LeetCode 78: Subsets (Recursion)
- LeetCode 51: N-Queens (Recursion)
- LeetCode 17: Letter Combinations of a Phone Number (Recursion)
- LeetCode 90: Subsets II (Recursion)
- LeetCode 37: Sudoku Solver (Recursion)
- LeetCode 70: Climbing Stairs (DP)
- LeetCode 198: House Robber (DP)
- LeetCode 322: Coin Change (DP)
- LeetCode 300: Longest Increasing Subsequence (DP)
- LeetCode 1143: Longest Common Subsequence (DP)
- LeetCode 62: Unique Paths (DP)
- LeetCode 5: Longest Palindromic Substring (DP)
- LeetCode 718: Maximum Length of Repeated Subarray (DP)
- LeetCode 416: Partition Equal Subset Sum (DP)
- LeetCode 53: Maximum Subarray (DP)
- LeetCode 133: Clone Graph (Graphs)
- LeetCode 200: Number of Islands (Graphs)
- LeetCode 207: Course Schedule (Graphs)
- LeetCode 785: Is Graph Bipartite? (Graphs)
- LeetCode 994: Rotting Oranges (Graphs)
- LeetCode 323: Number of Connected Components in an Undirected Graph (Graphs)
- LeetCode 136: Single Number (Bit Manipulation)
- LeetCode 190: Reverse Bits (Bit Manipulation)
- LeetCode 191: Number of 1 Bits (Bit Manipulation)
- LeetCode 268: Missing Number (Bit Manipulation)