100+ Programming and Coding Questions for Technical Interviews
Tags: programming, coding, tech, systemdesign
Published: 2023-02-16 08:58:06

---
title: 100+ Programming and Coding Questions for Technical Interviews
published: true
description: These are 99 programming questions for Software Engineer Interview, it contains array, linked list, binary tree, and system design questions for practice
tags: programming, coding, tech, systemdesign
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0nk0bb1brag0uo3anjh.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-02-14 06:11 +0000
---
*Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided in this article.*

Hello folks, if you are preparing for your next Software Development Job interview and looking for frequently asked Coding or Programming questions to practice then you have come to the right place. 

In the past, I have shared many questions on topics like [System Design](https://dev.to/javinpaul/my-favorite-system-design-interview-questions-and-coding-problems-4m2j), [Dynamic Programming](https://medium.com/javarevisited/20-dynamic-programming-interview-questions-with-solutions-2a144b1a1e07), [SQL and Database](https://javarevisited.blogspot.com/2021/05/sql-and-database-phone-interview-questions.html), and [Linux](https://www.java67.com/2017/08/top-17-sql-and-unix-interview-questions.html) and this article, I am going to share some of the most commonly asked Coding questions from past [Programming Job interviews](https://javarevisited.blogspot.sg/2011/06/top-programming-interview-questions.html). 

In order to do well on the Coding interview you need practice, you just can't go there and try to solve the coding problems in a limited time, that's actually one of the most common reasons to fail your programming Job interviews.  

Sometimes, the interviewer also asks a little bit easier coding questions on a telephonic interview like [revering array in place](https://javarevisited.blogspot.com/2015/03/how-to-reverse-array-in-place-in-java.html) or [reversing a string in place](http://www.java67.com/2016/06/how-to-reverse-string-in-place-in-java.html).

Talking from my own experience, when you hear these coding questions very first time in the real interview, most of us stumble because of nervousness and lack of preparation and that's where knowledge of popular coding questions and how to solve them is important for any Software engineer.

Most of the coding questions are based upon [System Design](https://medium.com/javarevisited/top-30-system-design-interview-questions-and-problems-for-programmers-417e89eadd67) and [data structures](https://www.java67.com/2018/06/data-structure-and-algorithm-interview-questions-programmers.html) like an [array](https://medium.com/javarevisited/20-array-coding-problems-and-questions-from-programming-interviews-869b475b9121), [string](https://medium.com/javarevisited/top-21-string-programming-interview-questions-for-beginners-and-experienced-developers-56037048de45), [linked list](https://medium.com/javarevisited/top-20-linked-list-coding-problems-from-technical-interviews-90b64d2df093), [binary tree](https://medium.com/javarevisited/20-binary-tree-algorithms-problems-from-coding-interviews-c5e5a384df30), etc, but sometimes you also get algorithmic, tricky, logical, and scenario-based questions like [how to swap two integers without using a temp variable](https://www.java67.com/2015/08/how-to-swap-two-integers-without-using.html) or [how to check if two rectangles overlap on each other or not](https://javarevisited.blogspot.com/2016/10/how-to-check-if-two-rectangle-overlap-in-java-algorithm.html), which is also a popular technique for collision detection and frequently used in games to check if two object collided or not.

That's why I have divided this list of coding problems into six  categories , I mean array-based coding questions, string-based questions, linked list questions, binary tree questions, System Design Questions, and other miscellaneous questions, where you will find questions on bit manipulation, [software design](http://www.java67.com/2018/05/top-20-system-design-interview-questions-answers-programming.html), tricky, logical and other miscellaneous topics.

Btw, solid knowledge of Data Structure and Algorithm is essential, and even though you will learn a lot of new concepts by solving these questions, I suggest you first refresh your knowledge of Data Structure and algorithms before attempting these questions by joining a comprehensive course like [**Data Structures and Algorithms: Deep Dive Using Java**](https://click.linksynergy.com/fs-bin/click?id=JVFxdTr9V80&subid=0&offerid=323058.1&type=10&tmpid=14538&RD_PARM1=https%3A%2F%2Fwww.udemy.com%2Fdata-structures-and-algorithms-deep-dive-using-java%2F&u1=JAVAREVISITED) on Udemy.

[![Data Structure and Algorithm cheat sheet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xco8n86zsbcyhtd6n8v1.png)](https://click.linksynergy.com/fs-bin/click?id=JVFxdTr9V80&subid=0&offerid=323058.1&type=10&tmpid=14538&RD_PARM1=https%3A%2F%2Fwww.udemy.com%2Fdata-structures-and-algorithms-deep-dive-using-java%2F&u1=JAVAREVISITED)

There is no point in attempting these questions if you don't have sufficient knowledge of data structure and Algorithms, for example you don't know how much time it take to get an element from array if you know index.

------


##100 Programming, Software Design and Coding Interview Questions for Technical Interviews
Here is my list of some of the most popular coding questions and system design questions to crack any programming job interview.

The questions are more like you find in the popular book [Cracking the Coding Interview](http://www.amazon.com/Cracking-Coding-Interview-6th-Edition/dp/0984782850/?tag=javamysqlanta-20) by Gayle Lakmann Mcdowell,  one of the essential books to do well on a Job interview, but more focus on Data Structure and Coding rather than touching every single possible topic required for a programming job interview like [SQL](http://www.java67.com/2013/04/10-frequently-asked-sql-query-interview-questions-answers-database.html), [UNIX](http://www.java67.com/2012/09/10-linux-and-unix-interview-questions-answers-wipro-tcs-capegemini.html), [Database](https://javarevisited.blogspot.com/2018/05/top-5-sql-and-database-courses-to-learn-online.html#axzz5h5DWdBCL), [Networking](https://javarevisited.blogspot.com/2014/08/socket-programming-networking-interview-questions-answers-Java.html), etc, for that, you need to read books and you can find many good titles [here](http://www.java67.com/2017/06/10-books-to-prepare-technical-coding-job-interviews.html).

We'll start the list by first exploring array-based questions like finding pairs whose sum is given a number and then move to [string-based questions](https://www.java67.com/2018/04/21-string-programming-and-coding-interview-questions-answers.html), [linked list-based questions](https://www.java67.com/2022/11/15-linked-list-interview-questions-for.html), [binary tree questions](https://www.java67.com/2020/02/top-40-binary-tree-interview-questions.html), and finally tackler other topics.

### 1\. Array-based Programming Interview Questions
If you ask me just one topic to prepare really well for coding interviews, I would pick the array. It's one of the essential data structures and favorite darling of coding interviews. 

There are so many [popular coding interview questions](http://javarevisited.blogspot.sg/2015/02/50-programmer-phone-interview-questions-answers.html) that are based upon the array, some of them are easy and some are tough but you can be sure that you will see some questions based upon the array in your next programming job interview.

If you don't know, an array is a data structure that holds other objects like String, int, float, etc. It holds them in a **contiguous location in memory** which makes them easily searchable and retrieval in O(1) time using the index.

Insertion and deletion of an array are tough because you cannot change the size of an array once created and you need to create a new array and copy elements from old to new.

Things to remember before you attempt array based coding problems:
1. array elements are stored at contiguous location.
2. time complexity to get element from array is O(1) with index
3. adding and removing element from array is difficult because array is fixed size and adding more element means allocating new array and then copying all data from one to other array.
4. array are good for search
5. array is used in many data structure like Hash table, stack, or queue.

Anyway, here are some of the **most popular array-based coding interview questions** for your preparation:

**1\. How to find the missing number in a given integer array of 1 to 100?** ([solution](http://javarevisited.blogspot.com/2014/11/how-to-find-missing-number-on-integer-array-java.html))

2\. How to find the duplicate number on a given integer array? ([solution](http://javarevisited.blogspot.com/2014/01/how-to-remove-duplicates-from-array-java-without-collection-API.html))

**3\. How to find the largest and smallest number in an unsorted integer array?** ([solution](http://java67.blogspot.com/2014/02/how-to-find-largest-and-smallest-number-array-in-java.html))

4\. How to find all pairs of integer arrays whose sum is equal to a given number? ([solution](http://javarevisited.blogspot.com/2014/08/how-to-find-all-pairs-in-array-of-integers-whose-sum-equal-given-number-java.html))

**5\. How to find duplicate numbers in an array if it contains multiple duplicates?** ([solution](http://javarevisited.blogspot.com/2014/03/3-ways-to-find-first-non-repeated-character-String-programming-problem.html))

6\. How to remove duplicates from a given array in Java? ([solution](http://javarevisited.blogspot.com/2014/01/how-to-remove-duplicates-from-array-java-without-collection-API.html))

7\. How to sort an integer array in place using the QuickSort algorithm? ([solution](http://javarevisited.blogspot.com/2014/08/quicksort-sorting-algorithm-in-java-in-place-example.html))

**8\. How to remove duplicates from an array in place?** ([solution](http://javarevisited.blogspot.com/2014/01/how-to-remove-duplicates-from-array-java-without-collection-API.html))

9\. How to reverse an array in place in Java? ([solution](http://javarevisited.blogspot.com/2013/03/how-to-reverse-array-in-java-int-String-array-example.html))

**10\. How to find multiple missing numbers in a given integer array with duplicates?** ([solution](http://javarevisited.blogspot.sg/2018/04/how-to-find-k-missing-numbers-in-array-java.html#axzz5E2uHdG3w))

I have linked all the solutions but you should try to solve them by yourself before looking at the solution, especially if you have time. That's the only sure way to learn to program by solving these coding questions.

If you find these questions difficult to solve then once again I suggest you first refresh your knowledge of fundamental data structures like an array by going through a comprehensive course. If you need recommendations, [*Master the Coding Interview: Data Structures + Algorithms**](https://academy.zerotomastery.io/a/aff_nqb6sg6w/external?affcode=441520_zytgk2dn) and [Master the Coding Interview: System Design + Architecture](https://academy.zerotomastery.io/a/aff_z8vtj3dk/external?affcode=441520_zytgk2dn) on ZTM Academy are two of the best course to start with. You will also learn about Big(O) notation and how to calculate time and space complexity.

[![Array based Programming Interview Questions Answers](https://3.bp.blogspot.com/-C5cFdsgBedg/XL5qlpLMKSI/AAAAAAAAN1g/E0t09oxAwywG4adg6E4cNucDipVwgrTjgCLcBGAs/w429-h320/Data%2BStructures%2Bin%2BJava%2BAn%2BInterview%2BRefresher%2BEducative%2Bcourse.png)](https://pluralsight.pxf.io/c/1193463/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fads-part1)

If you think these 10 questions from the array are not enough and you are interested in solving more array-based programming problems then you can also check out these [30 array-based coding questions](http://javarevisited.blogspot.sg/2015/06/top-20-array-interview-questions-and-answers.html) for more practice.

------


### 2\. String-based Coding Interview Questions
After array, String is the next popular topic on Programming job interviews, but if you have a good understanding of array then you can easily deal with [String programming questions](http://www.java67.com/2018/04/21-string-programming-and-coding-interview-questions-answers.html) because String is nothing but a character array.

The string is implemented differently in a different programming language like in C it's a NULL-terminated character array but in Java, it's an object. However, you can still get access to the underlying array to apply your logic.

Things to remember before solving String questions
1. String is like a character array so you can apply most of the tricks you learn while solving array problem with string by converting it to character array.
2. String  is Immutable in Java which means adding or removing character create new String, better use StringBuilder which provides mutable string.

Here is a list of some of the frequently asked coding questions which are based on String. Though some of them are quite old, you can still expect this in your programming job interview:

**11\. How to Print duplicate characters from String?** ([solution](http://java67.blogspot.sg/2014/03/how-to-find-duplicate-characters-in-String-Java-program.html))

12\. How to check if two Strings are anagrams of each other? ([solution](http://javarevisited.blogspot.sg/2013/03/Anagram-how-to-check-if-two-string-are-anagrams-example-tutorial.html))

**13\. How to print the first non-repeated character from String?** ([solution](http://javarevisited.blogspot.sg/2014/03/3-ways-to-find-first-non-repeated-character-String-programming-problem.html))

14\. How to reverse a given string using recursion? ([solution](http://javarevisited.blogspot.sg/2012/01/how-to-reverse-string-in-java-using.html))

**15\. How to check if a string contains only digits?** ([solution](http://javarevisited.blogspot.sg/2012/10/regular-expression-example-in-java-to-check-String-number.html))

16\. How to find duplicate characters in a String? ([solution](http://java67.blogspot.sg/2014/03/how-to-find-duplicate-characters-in-String-Java-program.html))

**17\. How to count a number of vowels and consonants in a given String?** ([solution](http://java67.blogspot.sg/2013/11/how-to-count-vowels-and-consonants-in-Java-String-word.html))

18\. How to count the occurrence of a given character in String? ([solution](http://javarevisited.blogspot.sg/2012/12/how-to-count-occurrence-of-character-in-String.html))

**19\. How to find all permutations of String?** ([solution](http://javarevisited.blogspot.com/2015/08/how-to-find-all-permutations-of-string-java-example.html))

20\. How to reverse words in a given sentence without using any library method? ([solution](http://java67.blogspot.com/2015/06/how-to-reverse-words-in-string-java.html))

21\. How to check if two String is a rotation of each other? ([solution](http://www.java67.com/2017/07/string-rotation-in-java-write-program.html))

**22\. How to check if the given String is Palindrome?** ([solution](http://java67.blogspot.com/2015/06/how-to-check-is-string-is-palindrome-in.html))

Similar to an array, I have also linked to a solution for all of these String problems but if you want to get most of this article, you better solve these questions without looking at the answers. Only when you are stuck and running out-of-time, you can look at the solution.

And, if you find these frequently asked String problems difficult to solve, maybe it's time to go back to the drawing board and learn the fundamentals of String data structure again.  If you need resources then [**Data Structures and Algorithms Specialization**](https://coursera.pxf.io/c/3294490/1164545/14726?u=https%3A%2F%2Fwww.coursera.org%2Fspecializations%2Fdata-structures-algorithms) on Coursera is one of the best online resources you can use to make your foundations rock solid.

[![Top 50 Coding Interview Questions](https://3.bp.blogspot.com/-YmHb72PSsVA/WvwXlehAk6I/AAAAAAAALYY/rSK1ERdlcdAYgO0vKxtNjpg2tiUB0aqngCLcBGAs/w412-h348/Permutation%2Bof%2BString%2Bin%2BJava.png)](https://coursera.pxf.io/c/3294490/1164545/14726?u=https%3A%2F%2Fwww.coursera.org%2Fspecializations%2Fdata-structures-algorithms)

You can also learn from it by comparing your solution with the solution I have given. It's not necessarily to be the same but you can learn a lot by comparing them and if you need more practice, here is another list of [20 String algorithm questions](http://javarevisited.blogspot.sg/2015/01/top-20-string-coding-interview-question-programming-interview.html).

------



### 3\. Linked list based Programming Interview Questions
Along with array and string, a linked list is another popular data structure in the programming world as well as on coding interviews. 

You will find a lot of questions on a linked list like [reversing a linked list](http://javarevisited.blogspot.sg/2017/03/how-to-reverse-linked-list-in-java-using-iteration-and-recursion.html), adding a new element, removing an element from the middle, etc.

It's also the counterpart of an array data structure. While array stores elements on contiguous memory locations, the linked list stores them at different locations and finds them by storing their address. a linked list is made of nodes, an internal data structure that holds the value as well as the address of the next node.

Because of its structure, it's easier to add and remove elements from the [linked list](http://www.java67.com/2016/01/how-to-implement-singly-linked-list-in-java-using-generics-example.html) like on O(1) time if you are adding or removing from the head but the search is equally difficult and takes O(n) time, as you have to literally walk through each element.

Things to remember before solving LinkedList questions:
1. LinkedList is a recursive data structure which means you can use recursion and stack to solve most of LinkedList problems.
2. It's easy to add/remove from LinkedList but search is difficult takes O(n) time where n is number of nodes in linked list.
3. There are many types of linked list like singly and doubly linked list which contains two pointers to both next and previous nodes.
4. LinkedList uses memory more efficiently than array which means you can create a big LinkedList with scattered memory where a big array is not possible.

Anyway, here is a collection of some of the simple and tricky linked list based coding questions for your practice:

**23\. How to find the middle element of a singly linked list in one pass?** ([solution](http://javarevisited.blogspot.sg/2012/12/how-to-find-middle-element-of-linked-list-one-pass.html))

24\. How to check if a given linked list contains a cycle? How to find the starting node of the cycle? ([solution](http://javarevisited.blogspot.sg/2013/05/find-if-linked-list-contains-loops-cycle-cyclic-circular-check.html))

25\. How to reverse a linked list? ([solution](http://www.java67.com/2016/07/how-to-reverse-singly-linked-list-in-java-example.html))

**26\. How to reverse a single linked list without recursion?** ([solution](http://javarevisited.blogspot.sg/2017/03/how-to-reverse-linked-list-in-java-using-iteration-and-recursion.html))

27\. How to remove duplicate nodes in an unsorted linked list? (solution)

28\. How to find the length of a singly linked list? ([solution](http://javarevisited.blogspot.sg/2016/05/how-do-you-find-length-of-singly-linked.html))

**29\. How to find the 3rd node from the end in a singly linked list?** ([solution](http://javarevisited.blogspot.sg/2016/07/how-to-find-3rd-element-from-end-in-linked-list-java.html))

30\. How do you find the sum of two linked lists using Stack? ([program](http://javarevisited.blogspot.sg/2017/07/top-50-java-programs-from-coding-Interviews.html))

Similar to array and string, I have also linked to all the solutions but you should only look at them once you solved the problem on your own or you feel stuck.

A key to solving the linked list is a good understanding of **recursion** because a linked list is a naturally recursive data structure, for example, if you take one node out of the linked list, the result is another linked list, but many programmers struggle to understand recursion.

That was the case with me as well but after practice and visualizing how recursion really works, I overcome that deficiency. 

If you are in the same boat, I strongly suggest you go through a visual course like [**Visualizing Data Structures and Algorithms in Java**](https://click.linksynergy.com/deeplink?id=JVFxdTr9V80&mid=39197&murl=https%3A%2F%2Fwww.udemy.com%2Fvisualizing-data-structures-and-algorithms-in-java%2F&u1=JAVAREVISITED) to learn Recursion and data structure. That will help you a lot in your thought process and problem-solving skills.

[![Top 99 Programming Interview Questions and Solutions](https://4.bp.blogspot.com/-pkuQaE8_rHg/WvwXtEnTa3I/AAAAAAAALYg/WBb5_nL3WH023FLWZZzujwf0Ng4czKqOwCLcBGAs/w459-h339/tortoise%2Band%2Bhari%2Balgorithm%2Bto%2Bdetect%2Bcycle%2Bin%2Blinked%2Blist.png)](https://click.linksynergy.com/deeplink?id=JVFxdTr9V80&mid=39197&murl=https%3A%2F%2Fwww.udemy.com%2Fvisualizing-data-structures-and-algorithms-in-java%2F&u1=JAVAREVISITED)

Once you understand recursion, most of the linked list based problems have an easy recursive solution than their iterative version. 

And if you need more practice, here is another list of [30 linked list programming questions](http://javarevisited.blogspot.sg/2017/07/top-10-linked-list-coding-questions-and.html) for your reference.

------


### 4\. Binary Tree-based Coding Interview Questions
A tree is another popular data structure in the programming world and coding interviews. Unlike [array](http://javarevisited.blogspot.sg/2016/02/6-example-to-declare-two-dimensional-array-in-java.html) and [linked list](http://javarevisited.blogspot.sg/2013/07/difference-between-array-and-linked-list-java.html), which are considered linear data structures, a tree is considered a hierarchical data structure and used to arrange information in hierarchical order.

There are a lot of different types of trees e.g. a binary tree, binary search tree, AVL tree, Red-Black tree, etc but Binary and Binary search trees are also known as BST are two of the most popular ones and most of the questions are based upon them.

Some questions are also based upon theoretical knowledge of tree data structure e.g. finding the height of the tree, finding leaf nodes, checking if the tree is balanced or not, etc, hence you should also spend some time learning the basics, along with practicing coding questions.

Things to remember before solving Tree based questions:
1. Similar ot LinkedList, Tree is also recursive data structure which means you take one element from Tree and remaining is still a tree.
2. You can use recursion and stack to solve many tree based coding problems. 
3. Tree is hierarchical data structure compared to array and linked list which are linear data structure.
4. Binary tree has at most two children but can have one, zero, or two.
5. Binary Search tree is a binary tree where value of left tree nodes are less than root and values of right sub-tree nodes are higher than root node.
6. There are many tree traversal algorithms but divided in two main categories, depth first or level first, which means either you first go deep and cover every node in one path or you go level by level. 


Anyway, here is a list of popular binary tree and binary search tree based coding questions to practice before your job interview:

**30\. Can you write a program to implement a binary search tree? ** ([solution](http://javarevisited.blogspot.sg/2015/10/how-to-implement-binary-search-tree-in-java-example.html#axzz4wnEtnNB3))

31\. How do you perform Pre-order traversal in a given binary tree? ([solution](http://javarevisited.blogspot.sg/2016/07/binary-tree-preorder-traversal-in-java-using-recursion-iteration-example.html#axzz5ArdIFI7y))

**32\. Write a Program to traverse a given binary tree in Pre-order without recursion** ([solution](http://www.java67.com/2016/07/binary-tree-preorder-traversal-in-java-without-recursion.html))

33\. How to perform an In order traversal in a given binary tree? ([solution](http://www.java67.com/2016/08/binary-tree-inorder-traversal-in-java.html))

**34\. How to print all nodes of a given binary tree using inorder traversal without recursion** ([solution](http://www.java67.com/2016/08/binary-tree-inorder-traversal-in-java.html))

35\. How to implement a Post-order traversal algorithm? ([solution](http://www.java67.com/2016/10/binary-tree-post-order-traversal-in.html))

**36\. How to traverse a binary tree in Postorder traversal without recursion** ([solution](http://www.java67.com/2017/05/binary-tree-post-order-traversal-in-java-without-recursion.html))

37\. How to Print all leaves of a binary search tree? ([solution](http://www.java67.com/2016/09/how-to-print-all-leaf-nodes-of-binary-tree-in-java.html))

**38\. How to count a number of leaf nodes in a given binary tree?** ([solution](http://javarevisited.blogspot.sg/2016/12/how-to-count-number-of-leaf-nodes-in-java-recursive-iterative-algorithm.html))

39\. How to perform a binary search in a given array? ([solution](http://javarevisited.blogspot.sg/2015/10/how-to-implement-binary-search-tree-in-java-example.html))

40\. How to merge two sorted array in Java? ([solution](https://javarevisited.blogspot.com/2022/01/how-to-merge-sorted-array-in-java.html))


Like an array, linked list, and string questions, I have also linked to all solutions for [binary tree questions](https://www.java67.com/2020/02/top-40-binary-tree-interview-questions.html) but you should only look at them once you have tried it yourself.

One trick I would like to share with you while solving tree questions is to remember that, similar to a linked list, the tree is also a recursive data structure and most of the tree based problems has an easy recursive solution.

For example, a subtree is also a tree which means you can apply the same steps to a subtree can devise a recursive solution. In the above list, many popular tree algorithms e.g. pre-order, post-order, in-order are implemented recursively as well as iterative.

If you don't feel confident to solve these problems and want to refresh your knowledge of binary tree and other data structure before attempting these questions, then you should check out [**Data Structures and Algorithms: Deep Dive Using Java**](https://click.linksynergy.com/fs-bin/click?id=JVFxdTr9V80&subid=0&offerid=323058.1&type=10&tmpid=14538&RD_PARM1=https%3A%2F%2Fwww.udemy.com%2Fdata-structures-and-algorithms-deep-dive-using-java%2F&u1=JAVAREVISITED) from Udemy.

[![Top 75 Essential Programming Interview Questions to Crack Any Coding Interview](https://3.bp.blogspot.com/-aeZGUMOhWeg/WvwXYJflCAI/AAAAAAAALYU/mde45jTBgNIs6bYgKe5yy3LAju6_aOu8QCLcBGAs/w521-h247/Data%2BStructure%2Barray%2Blist%2Bvector%2Band%2Bmatix.png)](https://click.linksynergy.com/fs-bin/click?id=JVFxdTr9V80&subid=0&offerid=323058.1&type=10&tmpid=14538&RD_PARM1=https%3A%2F%2Fwww.udemy.com%2Fdata-structures-and-algorithms-deep-dive-using-java%2F&u1=JAVAREVISITED)

-------


### 5. System Design Interview Questions
The following are the top  System Design interview questions you can prepare before your next Interview. These are pretty basic question and as a developer you should already be familiar with them but if not then make sure you practice before going for any system design interview.

**41\. What is System Design?**
**Answer**: System Design is a process of defining the elements of a system such as the modules, components, various interfaces and architecture.

**42\. How do you design a web crawler? ([solution](https://www.educative.io/collection/5668639101419520/5649050225344512?affiliate_id=5073518643380224)]**
**Answer**: A web crawler service collects information/crawl from the entire internet and fetches millions of web documents. Things to keep in mind while designing a web crawler are:

-   The approach is taken to find new web pages
-   The approach to prioritize web pages that can change in a dynamic way
-   To ensure that the web crawler service is bounded on the same domain

You can try solving the question but if you stuck, I recommend you to checkout **[Grokking the System Design Interview](https://www.educative.io/collection/5668639101419520/5649050225344512?affiliate_id=5073518643380224)** course on Educative, it provides a step by step solution to not just this question but also other System design question.

Here is a nice system design diagram for web crawler:

[![Top 20 System Design Interview Questions With Answers](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3CNCx9Jn2IHF7ScY9Q2BQDRLGYmAmvp0rIokxwOOCC8Cy9liBGlL_wZ455kNAfqhoON9dkYaofVsFK2T8jA-rrK4FSfzG-ef7RFj8UDO3u3bz6u0EiQAx5xhFAlzdUfYZcTSV4IRhonwQ07wgBWKu0CYIb1Ou8k3tJny_qD8UKCX_Da--_tXpDODW/w579-h598/design%20a%20web%20crawler%20-system%20design%20interview%20questions.png)](https://click.linksynergy.com/deeplink?id=JVFxdTr9V80&mid=39197&murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Fsystem-design-interview-prep%2F&u1=JAVAREVISITED)


**43\. What are the three important skills of system designer?**
**Answer**:

-   Good knowledge of Computer Fundamentals
-   Familiar with API Integration
-   User interaction
-   Familiar with how to deploy and scale systems

In general, System designer should have broad view of different technology and how they work and when to use them to make correct choices while designing system.

**44\. Which is the primary tool used for structured Design?**
**Answer**: Structure charts is a primary tool used for structured Design.

**45\. How do you design YouTube?  [[Solution](https://bytebytego.com/courses/system-design-interview/design-youtube?fpr=javarevisited)]**

Designing a YouTube is an interesting System design question as everyone is familiar with YouTube but a lot goes to design a video streaming service like YouTube.  There are a lot of challenges related to storing data, indexing data, and providing streaming service.

Scalability is another major challenge as it needs to be fast and should be able to support millions of users. You can start designing YouTube on your own but if you stuck or need guidance you can see this free tutorial by Alex Xu from his popular [**System Design Interview Course on ByteByteGo**](https://bytebytego.com?fpr=javarevisited).

Here is a nice flow diagram to explain video upload process:

[![how to design YouTube for System Design interview](https://blogger.googleusercontent.com/img/a/AVvXsEjjQwTRUU40Rk2JpXdqBl5JFE-bMNMGAdUQZpXzOsUPN6m2buD2G-ayzQyUSPW9-5gVWUAbZW92K3CE6FUp6Mhqj16vlSmvHgwBuqg9XYqL8t7UMSD-RPvTnSEzElS7e_1WtCHsGDpdLpu3_KI7BUTlqrIwsdRGgCCZQ91DTCUB50joTvxSGjkhCqqv=w480-h490)](https://bytebytego.com?fpr=javarevisited)

**46\. In System Design process, what is Requirements Determination?**\
**Answer**: A requirement is most important for a new system which includes processing or capturing of data, controlling the activities of a business, producing information and supporting the management. Requirement determination helps you to study the existing system and to gather details to find out what are the requirements, how it works, and what kind of improvements should be made.

**47\. How do you design a URL Shortner like bit.ly or goo.gl?**
This is another popular System design question which is often asked during FAANG interview. This question poses a lot of challenge like where are the short URL and target URL will be stored. How should you create a unique short URL every time for different target URL and return the same short URL for same target URL.

You can try solving this problem on your own but if you stuck then you can also checkout this [step by step solution of URL shortner](https://designgurus.org/link/84Y9hP?url=https%3A%2F%2Fdesigngurus.org%2Fblog%2Furl-shortening) on DesignGuru, one of my favorite portal for preparing System design interview.

[![URL Shortner System Design Problem solution](https://blogger.googleusercontent.com/img/a/AVvXsEh6mfKpJeNf4JHDcf9IwworY6RVSOuD5KHcaKMIIRPvCwB-BB1GqvEghu5eEN0ApLjzPhcy2Ewxe6UkiEzqTZpjBbPW8HSWeQglebsN3TP8xk__HYOyKikfTz3r_ILkowei0I0QiZWrCzQheOE1VTWhcKASwMxPfVPfYa4T1bvhOSwBOjC77jVaHgCq=w602-h307)](https://designgurus.org/link/84Y9hP?url=https%3A%2F%2Fdesigngurus.org%2Fbundles%3Fbundle_id%3Dbuy-both-system-design-courses)

If you like their teaching style, I also recommend you to checkout their**[ System Design Interview Bundle](https://designgurus.org/link/84Y9hP?url=https%3A%2F%2Fdesigngurus.org%2Fbundles%3Fbundle_id%3Dbuy-both-system-design-courses)** where they share their best System design courses for discount.

**48\. How can you design autocomplete functionality?**
**Answer**: Here are important things for developing autocomplete functionality:

-   Typeahead suggestion to be provided.
-   Queries per second handled by the system.
-   Support personalization with the suggestions.
-   Amount of data to be stored.


**49\. In the system design process, where is problem analysis done?**\
**Answer**: Problem analysis is done at the systems analysis phase.


**50\. How is Horizontal scaling different from Vertical scaling in Software Engineering?**\
Here is the key difference between Horizontal and Vertical scaling in Software engineering:

-   Horizontal scaling refers to the addition of more computing machines to the network that shares the processing and memory workload across a distributed network of devices. In simple words, more instances of servers are added to the existing pool and the traffic load is distributed across these devices in an efficient manner.
-   Vertical scaling refers to the concept of upgrading the resource capacity such as increasing RAM, adding efficient processors etc of a single machine or switching to a new machine with more capacity. The capability of the server can be enhanced without the need for code manipulation.

If you want to learn more about Scalability concepts then I highly recommend you to checkout Frank Kane's **[System Design Course on Udemy](https://click.linksynergy.com/deeplink?id=JVFxdTr9V80&mid=39197&murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Fsystem-design-interview-prep%2F&u1=JAVAREVISITED)** where he shared all these key System design concepts in detail.

[![software design interview questions with answers](https://blogger.googleusercontent.com/img/a/AVvXsEinfnlecEnCnwUGPBVNpk5KkJWBKJuZEo3mE7EuzX0eh_XC6IfBFLVX3Btb6Yj7HkIJ47gMqPQyWnn5hSTB-VMs3C-Q7e_-3EGt606sCl35AlxrEADk9NR4S-ijpKBaIAGUoHKtLdTFfzWAteN-Te2lnl_KQo-iw6pXLG7S-WMFFY2eqFC4hrdbL1lz=w444-h352)](https://click.linksynergy.com/deeplink?id=JVFxdTr9V80&mid=39197&murl=https%3A%2F%2Fwww.udemy.com%2Fcourse%2Fsystem-design-interview-prep%2F&u1=JAVAREVISITED)



**51\. What do you understand by load balancing? Why is it important in system design?**
**Answer**: Load balancing refers to the concept of distributing incoming traffic efficiently across a group of various backend servers. These servers are called server pools. Modern-day websites are designed to serve millions of requests from clients and return the responses in a fast and reliable manner. In order to serve these requests, the addition of more servers is required. 

In such a scenario, it is essential to distribute request traffic efficiently across each server so that they do not face undue loads. Load balancer acts as a traffic police cop facing the requests and routes them across the available servers in a way that not a single server is overwhelmed which could possibly degrade the application performance.

**52\. What is Sharding?**
**Answer**: Sharding is a process of splitting the large logical dataset into multiple databases. It also refers to horizontal partitioning of data as it will be stored on multiple machines. By doing so, a sharded database becomes capable of handling more requests than a single large machine. 

Consider an example - in the following image, assume that we have around 1TB of data present in the database, when we perform sharding, we divide the large 1TB data into smaller chunks of 256GB into partitions called shards.

**53\. What are the various Consistency patterns available in system design?**\
Here is the list of popular consistency patterns for Software Design:

-   Consistency from the CAP theorem states that every read request should get the most recently written data. When there are multiple data copies available, there arises a problem of synchronizing them so that the clients get fresh data consistently. Following are the consistency patterns available:
-   Weak consistency: After a data write, the read request may or may not be able to get the new data. This type of consistency works well in real-time use cases like VoIP, video chat, real-time multiplayer games etc. For example, when we are on a phone call, if we lose network for a few seconds, then we lose information about what was spoken during that time.
-   Eventual consistency: Post data write, the reads will eventually see the latest data within milliseconds. Here, the data is replicated asynchronously. These are seen in DNS and email systems. This works well in highly available systems.
-   Strong consistency: After a data write, the subsequent reads will see the latest data. Here, the data is replicated synchronously. This is seen in RDBMS and file systems and are suitable in systems requiring transactions of data.

**54\. What are the most important aspects of the System Study?**\
**Answer**: System Study has three most important aspects which are as follows:

-   Identifying current issues and establishing new goals.
-   Study of an existing system.
-   Documenting the existing system.


**55\. As a system designer, how you can design a universal file sharing and storage apps like Google Drive or Dropbox?**
**Answer**: The above mention apps are used to store and share files, photos, and other media. We can design things like allowing users to upload/search/view files or photos. It checks permissions for file sharing and enables multiple users to make changes in the same document.


**56\. What feature allows one class to derive features from another class?**
**Answer**: The Inheritance feature allows one class to derive features from another class. But more often than not you should use Composition to reuse code from another class instead of Inheritance. 

Composition is flexible than Inheritance and there are many benefits of using Composition like easier to test. You can also see my post [5 Reasons to choose Composition over Inheritance](https://javarevisited.blogspot.com/2013/06/why-favor-composition-over-inheritance-java-oops-design.html) for more details.


**57\. Which language was the first language to be developed as a purely object-oriented programming language?**
**Answer**: Smalltalk was the first programming language to be developed as a purely object-oriented programming language. While there are many great programming language which support OOP like Java, C++, JavaScript, Python, and C#, none of them are pure object oriented programming language, if you think wearing a purist shoes.

**58\. How do you design a Trade position aggregator or Portfolio Manager?**

You need to design a system which can accept Trade and then shows the position for each symbol, much like a Portfolio Manager. Your system needs to support multiple symbols and it should be fast enough to calculate position in real time. 

In order to test your system, you can input a set of trades, both buy and sell side and then query the system to see the live position. You can first try solving this problem yourself but if you stuck you can see my solution of implementing [Trade position aggregator in Java](https://javarevisited.blogspot.com/2022/03/how-to-design-trade-position-calculator.html) for guidance. 

[![system design problems with solution](https://blogger.googleusercontent.com/img/a/AVvXsEgZVTNIWLrp_hhcbdCQyT93noXwe4NDMTZdeZ_TCkHdbyYImBKG0yCp5kMgJJLxWyJ5qdfXsm7OMoF3pkD9rWDyX38rcGszA2zugDhfo_EhNf_T6b_xXEl5syZsGvVsnVnZAcdeAkvX4P8F5TBd_x4dB963pRLHSkN-d0YMP6Hmgbbg2YJV9aOvBJTG=w437-h229)](https://www.java67.com/2018/05/top-20-system-design-interview-questions-answers-programming.html)

**59\. Which is an OOP language but does not support all inheritance types?**
Java is an OOP programming language, but it does not support all inheritance types.

**60\. Name different types of constructors in C++ ?**
There are three types of constructors in C++, which are as follows:

-   Default Constructors: It does not take any argument and has zero parameters.
-   Parameterized Constructors: These types of constructors take some argument.
-   Copy Constructors: It is a member function, and its basic function is to initialize the object using another object of the same class.


**61\. What is RAID? **
RAID stands for a redundant array of independent disks. RAID is the technology that specializes in data storage that combines various physical disk drive components within one or numerous logical units as data redundancy and performance improvement.

**62\. How do you design a Vending Machine in Java?**
This is a common object oriented analysis and design question which is also asked on System design interview. You need to design a Vending Machine which can vend a couple of products like Coke, Biscuits, Chocolates,  and Cake. It can accept coins (Nickle, Dime, Pence, and Cent), and small denomination notes  

There are multiple ways to solve this problem but solution using [State Design Pattern](https://javarevisited.blogspot.com/2021/07/state-design-pattern-example-java-vending-machine.html) is the simplest one. You can try yourself but if you stuck you can also see my post [How to design Vending Machine in Java](https://javarevisited.blogspot.com/2016/06/design-vending-machine-in-java.html) for step by step solution of this OOP Design problem. 

[![system design questions with answers](https://blogger.googleusercontent.com/img/a/AVvXsEhOFbq4QHFnE_ekBMRyCY13rchbuR4kT4SK0tFjITdgRlaEwMSl7FdHH4mOIYVmWNeuJQ_fx0UShw8wZHHByDD5PWrhJHl618yY8q2jRh4hcxzilkU86qkTLjxAzleX_Wi_m-vpgKBs0wujJFH3U7Gl8pIg4cXActkvoxEql5nw-oGjNLqxDzZsMgea=w434-h236)](https://javarevisited.blogspot.com/2016/06/java-object-oriented-analysis-and-design-vending-machine-part-2.html)

**63\. Can a Java application be created without implementing the OOPs concept?**
A Java application cannot be created without implementing the OOPs concept. Java applications are completely based on the Object-oriented programming concept.


**64\. What are the Types of Documentation in System Design?**\
**Answer**: Four types of documentation are:

-   Program documentation
-   System documentation
-   Operations documentation
-   User documentation


------


##6\. Miscellaneous Programming Interview Questions
Even though data structure and System Design based questions make the bulk of the Coding Interview, there are always some questions from topics like sorting algorithms, bit manipulation, [software design](http://www.java67.com/2016/07/top-5-object-oriented-design-interview-questions.html), [Dynamic Programming](https://www.java67.com/2023/01/dynamic-programming-interview-questions.html), and other logical and tricky questions.

In this list below, you will find most of the common searching and sort questions as well as a couple of design and bit manipulation questions.

**65\. How to implement the Bubble Sort algorithm?** ([solution](http://javarevisited.blogspot.sg/2014/08/bubble-sort-algorithm-in-java-with.html#axzz5ArdIFI7y))

66\. How to implement Iterative QuickSort Algorithm? ([solution](http://javarevisited.blogspot.sg/2016/09/iterative-quicksort-example-in-java-without-recursion.html#axzz5ArdIFI7y))

**67\. How to implement the Insertion Sort Algorithm?** ([solution](http://www.java67.com/2014/09/insertion-sort-in-java-with-example.html))

68\. How to implement Merge Sort Algorithm? ([solution](http://www.java67.com/2018/03/mergesort-in-java-algorithm-example-and.html))

69\. How to implement the Bucket Sort Algorithm? ([solution](http://javarevisited.blogspot.sg/2017/01/bucket-sort-in-java-with-example.html))

**70\. How to implement the Counting Sort Algorithm?** ([solution](http://www.java67.com/2017/06/counting-sort-in-java-example.html))

71\. How to implement Radix Sort Algorithm? ([solution](http://www.java67.com/2018/03/how-to-implement-radix-sort-in-java.html))

72\. How to swap two numbers without using the third variable? ([solution](http://www.java67.com/2015/08/how-to-swap-two-integers-without-using.html))

73\. How to check if two rectangles overlap with each other? ([solution](http://javarevisited.blogspot.sg/2016/10/how-to-check-if-two-rectangle-overlap-in-java-algorithm.html))

**74\. How to design a Vending Machine?** ([solution](http://javarevisited.blogspot.sg/2016/06/design-vending-machine-in-java.html))

75\. How to implement an LRU Cache in your favorite programming language? ([solution](http://javarevisited.blogspot.sg/2017/07/top-10-linked-list-coding-questions-and.html#axzz5ArdIFI7y))

76\. How to check if a given number is a Palindrome? ([solution](http://javarevisited.blogspot.sg/2012/12/how-to-check-if-number-is-palindrome-or-not-example.html))

77\. How do you check if a given number is an Armstrong number? ([solution](http://www.java67.com/2012/07/java-program-to-find-armstrong-numbers.html))

**78\. How do you find all prime factors of a given number?** ([solution](http://javarevisited.blogspot.com/2014/05/how-to-find-prime-factors-of-integer-number-java.html#axzz5E2uHdG3w))

79\. How do you check if a given number is positive or negative in Java? ([solution](http://javarevisited.blogspot.sg/2013/01/how-to-check-if-number-is-positive-or-negative-java-example.html#axzz5E2uHdG3w))

80\. How to find the largest prime factor of a given integral number? ([solution](http://javarevisited.blogspot.sg/2015/03/how-to-find-largest-prime-factor-of.html#axzz5E2uHdG3w))

81\. Write a Program to print all prime numbers up to a given number? ([solution](http://javarevisited.blogspot.sg/2012/04/java-program-to-print-prime-numbers-in.html#axzz5E2uHdG3w))

**82\. Write a Program to print Floyd's triangle?** ([solution](http://javarevisited.blogspot.sg/2014/12/how-to-print-floyds-triangle-in-java.html))

83\. Write a Program to print Pascal's triangle? ([solution](http://www.java67.com/2016/06/how-to-print-pascal-triangle-in-java.html))

84\. How to calculate the square root of a given number? ([solution](http://javarevisited.blogspot.sg/2016/10/how-to-find-square-root-of-number-in-java-algorithm.html#axzz5E2uHdG3w))

**85\. How to check if the given number is a prime number?** ([solution](http://www.java67.com/2014/01/how-to-check-if-given-number-is-prime.html))

86\. How to implement the Sieve of Eratosthenes Algorithm? ([solution](http://javarevisited.blogspot.com/2015/05/sieve-of-Eratosthenes-algorithm-to-generate-prime-numbers-in-java.html))

87\. How to add two numbers without using the plus operator in Java? ([solution](http://javarevisited.blogspot.sg/2013/06/how-to-add-two-integer-numbers-without-plus-arithmetic-operator-java-example.html))

88\. Write a Program to subtract two binary numbers? ([solution](http://www.java67.com/2018/03/java-program-to-subtract-two-binary-numbers.html))

**89\. Write a Program to transpose a Matrix?** ([solution](http://www.java67.com/2016/10/how-to-transpose-matrix-in-java-example.html))

90\. Write a Program to add or subtract two Matrices? ([solution](http://www.java67.com/2016/10/how-to-add-and-subtract-two-matrices-in-java.html))

91\. Write a Program to multiply two Matrices in Java? ([solution](http://www.java67.com/2016/10/how-to-multiply-two-matrices-in-java.html))

**92\. How to calculate the average of all numbers in a given array?** ([solution](http://www.java67.com/2016/10/how-to-calculate-average-of-all-numbers-in-given-array-java.html))

93\. How to check if a given number is even/odd without using an Arithmetic operator? ([solution](http://www.java67.com/2012/07/how-to-find-even-and-odd-number-in-java-program.html))

94\. Write a Program to find the GCD of two numbers using Euclid's Algorithm? ([solution](http://www.java67.com/2012/08/java-program-to-find-gcd-of-two-numbers.html))

**95\.  How to find the number of 1s (the Set bit) in a given Bit Sequence?** ([solution](http://www.java67.com/2016/01/how-to-count-number-of-1s-in-given-bit-sequence-in-java.html))

96\. Write a Program to a given Pyramid structure? ([solution](http://www.java67.com/2015/10/how-to-print-pyramid-pattern-in-java-example.html))

97\. How to find the highest repeating world from a given file in Java? ([solution](http://www.java67.com/2015/10/java-program-to-find-repeated-words-and-count.html))

**98\. How to reverse a given Integer in Java?** ([solution](http://www.java67.com/2015/08/how-to-reverse-integer-in-java-leetcode-solution.html))

99\. How to convert a decimal number to binary in Java? ([solution](http://www.java67.com/2014/03/decimal-to-binary-conversion-in-java.html))

**100\. How to check if a given year is a leap year in Java?** ([solution](http://www.java67.com/2012/12/how-to-check-leap-year-in-java-program.html))

Like previous topics, I have provided links to a solution but you should only look at them once you tried to solve the questions yourself. That's important for learning.

That's all about some of the **essential Programming and Coding Interview questions** to crack any programming Job interview. This list covers the most important topics like an array, string, linked list, binary tree, and several others.

Once you have gone through all these coding questions, you can not only solve them when you see them in the interview but also develop the coding sense and problem-solving ability which will help you to solve new and slightly modified versions of these questions in real programming interviews.

Though, if you are not in a rush and want to hone your coding skill further, here are some more resources to practice questions

Some **Useful Resources** for Coding Interviews

-   [Data Structures in Java: An Interview Refresher](https://www.educative.io/collection/5642554087309312/5724822843686912?affiliate_id=5073518643380224)
-   [10 Data Structure, Algorithms, and Programming Courses to Crack Interviews](https://dev.to/javinpaul/10-data-structure-algorithms-sql-and-java-courses-to-crack-any-programming-job-interview-11f6)
-   [10 Algorithms Books Every Programmer should Read](http://www.java67.com/2015/09/top-10-algorithm-books-every-programmer-read-learn.html)
-   [10 Free Courses to Learn Data Structure and Algorithms in Depth](http://www.java67.com/2019/02/top-10-free-algorithms-and-data.html)
-   [LeetCode - The Programming Interview Platform](https://leetcode.com/)
-   [20+ binary tree-based problems for interviews](https://medium.com/javarevisited/20-binary-tree-algorithms-problems-from-coding-interviews-c5e5a384df30)
-   [10 Courses to Prepare for Programming Job Interviews](http://javarevisited.blogspot.sg/2018/02/10-courses-to-prepare-for-programming-job-interviews.html)
-   [50+ Data Structure and Algorithms Problems from Interviews](https://dev.to/javinpaul/50-data-structure-and-algorithms-problems-from-coding-interviews-4lh2)
-   [How to design Vending Machine in Java](https://javarevisited.blogspot.com/2016/06/design-vending-machine-in-java.html)
-   [100+ Coding Interview Questions for Programmers](http://www.java67.com/2018/06/data-structure-and-algorithm-interview-questions-programmers.html)
-   [5 Free Courses to Learn Algorithms for Interviews](https://javarevisited.blogspot.com/2018/01/top-5-free-data-structure-and-algorithm-courses-java--c-programmers.html)
-   [10 Books to Prepare Technical Programming/Coding Job Interviews](http://www.java67.com/2017/06/10-books-to-prepare-technical-coding-job-interviews.html)\
Thanks a lot for reading this article so far. If you like these Coding Interview questions then please share them with your friends and colleagues. If you have any questions or feedback then please drop a note.

**P.S. -** As I have said before, good knowledge of data structure and algorithms is the most important thing to do well on interviews, and if you feel that you have forgotten those concepts or want to fill gaps in your understanding, here are a useful list of [books](http://www.java67.com/2015/09/top-10-algorithm-books-every-programmer-read-learn.html) and [courses](http://javarevisited.blogspot.sg/2018/01/top-5-free-data-structure-and-algorithm-courses-java--c-programmers.html) to learn Data Structure and Algorithms.