61 Interview Coding Questions for Practice and Master Programming

You can not master any of the programming languages without Practice. The common things that I see among all the expert programmers- they do Practice. Lots of Practice. Practice solving interview coding questions.

The more you practice the better you become in the programming.

Programming is a skill best acquired by Practice and Example rather than from Books.

– Alan Turing

For every beginner, it is easy to start reading programming books and gaining theoretical knowledge. But what’s the next?

No one has become the programmer by reading the books. You should actually do the programming.

Before going to list out interview coding questions for practice, let me tell you, these are the generic coding questions. You can use this coding questions to challenge yourself and to practice any programming language like Python, C/C++, Java, and all other generic computer languages.

How to Improve Coding Skills?

If you want to improve your coding skills, there is only one way- practice solving coding questions.

What are the Advantages of Practicing Programming over Reading Programming Books?

Doing programming teaches you many things…

  • Problem Solving Mindset
    How are programmers different from others? Because programmers think differently. The real programmer has the best problem-solving mindset. And to make that problem-solving mindset, you need to practice hard.
  • Building Logic
    It makes you think. You see the problem, think about it and you build your logic.
  • Improving Coding Ability
    Programming is not about memorizing all the programming syntax. It varies from the programming language. It is ok if you forget, you can always Google it. Programming helps you to build your logic. It teaches you – how you can improve your logic or your coding ability.
  • Thinking Efficiently
    There can be multiple solutions to a single problem. Practicing programming is also about trying different solutions and choosing the most efficient one.
  • Preparing for Placement
    I have curated this list of programming questions for your practice and it will also help you to prepare for coding rounds of any company. Many of the below programming questions have been asked in many placement interview rounds for IT jobs.
  • Grasping over different Programming topics
    I have tried out to add the coding questions from each topic.
  • Understanding Data Structure Real-Time
    You will never understand the essence and real purpose of data structure reading from the books. Practicing coding questions help you to understand data structure in real-time.

Call-of-Action to Improve Coding Skills

So, if you are serious about programming and want to be the unicorn programmer, here is the call-of-action for you.

The More You Practice, The Better You Become.

So let’s dive right into our list…

Interview Coding Questions for Practice

List of Interview Coding Questions

Here I’m listing basic programming questions you should practice to master any of the programming languages.

Basic Coding Questions

  1. Writing “Hello, World!” program. (C/C++Python, Java)
  2. Write a program to display the list of even numbers.
  3. Find the Factorial of a given number.
  4. Compare Two Numbers using else-if statement and output smaller and larger numbers.
  5. Write a program to determine If the given year is a Leap year.
  6. Print all the elements in the Fibonacci number series.
    This program can be implemented using a loop or recursion technique.
  7. Write a program to check if the number is Palindrome number or not.
  8. Generate all the prime numbers between one & the given number.
  9. Print the Pyramid of stars using nested for loops.
  10. Print Reversed pyramid on programming console using for loops & decrement operator.
  11. Write a program for Nested Switch.
  12. Write a program to calculate Circle Area using radius.
  13. Fins the Factorial of a number using recursion technique.
  14. Print the Pyramid of numbers using for loops.
  15. Write a program to Find a Maximum of Two Numbers using the conditional operator.
  16. Write a program to Find Minimum of Two Numbers using the conditional operator.
  17. Write a program that will read a float type value from the keyboard and print the following output.
    1) the smallest integer which is not less than the number
    2) given number
    3) the largest integer which is not greater than the number
  18. Choose the random number from the array. (Python)
  19. Check if all the elements in the array are the same. (Python)
  20. Print all the unique numbers from the array. (Python)
  21. Write a program to generate 5 Random nos. between 1 to 100 and the number should not contain a decimal value.
  22. Write a program to display a  grade according to Marks obtained by the student.
  23. Find SUM AND PRODUCT of a given Digits in the number.
  24. Write a program to find the sum of all integers greater than 150 and less than 290 that are divisible by 3
  25. Write a program to concatenate string using for Loop.
  26. Display Multiplication Table for the given number.
  27. Write a program to Swap the values given by the user without using the third variable. (Python)
  28. Write a program to convert given the number of days into months and days. (For the sake of simplicity, Assume that each month contains 30 days).
  29. Print the Invert Triangle using the while loop.
  30. Write a program to find whether given no. is Armstrong or not.
  31. How to check if the given number is the power of 3 (k- any integer)?
  32. Write a program to print the day of the week based on the given number using the switch case. (For example, print “Monday” for user input 1, print “Tuesday” for user input 2…)
  33. What is the Harmonic Series? Write a program to generate the Harmonic Series.
  34. Write a program to find the average of consecutive n-Odd numbers and n-Even numbers.
  35. Print the Triangle as follow, using for loops. 1 2 3 4 5 6 7 8 9 10 … N
  36. Create the class having a member variable of employee detail and getter and setter function for each variable.
  37. Write the program to read and write a file. (Python, C/C++)
  38. Find the longest line from the file. (Python)
  39. Take the students Mark as User input and check the range of Mark. (Java)

String Handling

  1. Find the first duplicate/repeated character in the string. (Python)
  2. Write a program to check if the substring is present in the given string. (C/C++)
  3. Write a program to reverse the given string. (Python)
  4. How to reverse a string without affecting special characters?
  5. How to convert the given string to an integer value? (C/C++)
  6. Write a program to check the Palindrome String. (C/C++)
  7. Write a program to check the Anagram String. (C/C++)
  8. Remove white spaces from the given string. (C/C++)
  9. Find all the permutation of the given string. (Python)
  10. Find Remainder without using Modulus Operator
  11. Remove all the duplicates characters from the string

Sorting Algorithm

  1. Write a program to check if the array is sorted. (C/C++)
  2. Selection Sort (PythonC/C++)
  3. Insertion Sort
  4. Bubble Sort (C/C++)
  5. QuickSort (Example | Algorithm | Programming | Complexity)

Bit Manipulation

  1. Count the number of ones in the binary string. (C/C++)
  2. How to Find 2’s Complement?
  3. Write a program to convert the Decimal number to Binary. (C/C++)

If you are learning Python, check the bitwise operators in Python.

Advanced Coding Questions

  1. Write a C program to upload the file to another PC connected to the network?
  2. Write a C program to download the file from the network?

These two questions are more related to network programming. If the job profile is related to networking, you have to prepare for such questions. These questions were asked in the Persistent coding interview as per the experience shared by the candidate.

Dictionary (Only for Python)

  1. How to convert nested dictionary into flatten dictionary in Python?

Make a Routine and Stick with It

Tips to make the best use of this Interview Coding Questions:

  • If you want to master any programming language, move to a Linux system for coding practice.
  • I have mentioned the list of programs you should practice. We are writing a solution for each of the programs listed here. I keep updating this space. You can bookmark this page for anytime reference.
  • I need your help. You can also write the program for any of the programming questions. Submit your program or even you can send an email at [email protected] (don’t forget to add the description to the program you are sharing). I will publish your article on our portal. Along with your practice, you are helping other programmers.
  • Make a schedule and challenge yourself to solve n coding questions every day.

Programming Tutorials for Reference

If you want to learn fundamentals of any of the programming languages, do refer following links for the particular programming tutorial.

Interview and Placement Preparation References

If you are looking for a job in the IT sector or preparing for interviews, find the following resources useful.

If you face any challenges to write a program for any of the mentioned interview coding questions, feel free to discuss in the comment section. It is all about, how you make the best use of all the resources you have on your plate.

If you put a gun to my head, I will try to remember more coding questions and will add to this list for you. 😉 

Stay Tuned and Keep Practicing!


  • daniel
    March 28, 2018 at 5:27 pm

    good work

    • Aniruddha Chaudhari
      March 28, 2018 at 7:09 pm

      Thanks, Daniel!

      Glad to see you here…

  • Firasath
    April 10, 2018 at 7:03 pm

    Good Collection, I am a beginner in python and I can answer few but not all of them. Can you kindly share the solutions in python. Thank you

    • Aniruddha Chaudhari
      April 10, 2018 at 7:16 pm

      Thanks, Firasath!

      We will keep updating this post with more solutions for each question.

      To get it done early, we are seeking for help from fellow programmers. Please, if you get the answer to any of the questions, keep sharing with us. We will update this list with your answer.

  • Rishav Kumar
    August 8, 2018 at 9:09 pm

    Thanks for sharing this information about coding.
    It really works great for me.
    Great work.

    • Aniruddha Chaudhari
      August 8, 2018 at 10:24 pm

      Thanks, Rishav.

      Glad to see you as you find this questions useful.

      Happy Coding!

Leave a Reply