TestGorilla LogoTestGorilla Logo
Pricing
homeblogsHiring & recruiting
45 coding interview questions to hire the best software engineers and programmers

45 coding interview questions to hire the best software engineers and programmers

Share

Hiring great programmers and software engineers is an absolute must for tech companies: The success of these businesses depends on the quality of technical staff they can attract. 

It’s why it’s so important to ask the right coding interview questions to sift out mediocre candidates. 

Prior to that, however, we recommend using online assessments to evaluate candidates’ expertise and knowledge accurately and objectively – and invite only the best to an interview. This way, you can save a lot of time, money and energy and make sure you’re able to hire the right person each time. 

For example, if you use the Algorithms for Software Engineering test, you can be assured that your candidates can solve situational programming tasks and are proficient in applying algorithms. 

In this article, we’ve put together a complete guide to coding interviews.

To give you an idea of what to look out for, we’ve also provided sample answers to each question.

Let’s dive in. 

What qualities should you look for in a programmer or a software engineer? 

If you’re looking to hire a knowledgeable software engineer or programmer, there are certain skills you should look for to make sure they can be successful in their role, such as problem solving, critical thinking, and different programming languages. 

To assess these skills, however, you don’t need to rely on CVs or wait until you meet the candidate in person during the interview. You also don’t need to use a whiteboard coding test. Instead, you can use online skills tests, such as the one that we offer. 

For example, if the job role calls for proficiency in a particular coding language, you can test candidates’ programming skills in C#, Java, Ruby, and more. 

You can also assess specific aspects of coding languages. For example, if the job role specifically calls for entry-level programming of Python algorithms, you can use the Python (Coding) Entry-level Algorithms test. Or, if you need a person who has strong object-oriented programming skills in Python, you can opt for the Python (Coding) Data Structures and Objects test.

With skills tests, by the time you invite candidates to interview, you’ll already have a very good understanding of their capabilities. This means you save a lot of time and money by not interviewing applicants who simply lack the skills you need. 

However, once you invite candidates to interview, it’s worth assessing a few specific skills to see who is your best talent. Here are some examples you can assess during interviews: 

What qualities should you look for in a programmer or software engineer?

Attention to detail

If you choose to do live coding interviews, it’s a great sign if a candidate wants to check with you whether their approach is correct before they start coding. 

This shows good attention to detail and the willingness to clarify requirements and double-check them before starting projects. Both are qualities that help improve the overall quality of work of software developers.

See what candidates do when they finish their live coding exercise, too. Do they review their code to ensure there are no bugs or syntax errors? 

Communication skills

Another important aspect to look out for during interviews is the applicant’s communication skills. Are they adept at communicating their thought process? Do they explain complex concepts clearly? Are they able to explain the method they used in a live coding exercise? 

Most programmers don’t code and give a running commentary of their thought process. However, if the role calls for a person who needs to communicate with team members often and well, the ability to communicate their thought process could be crucial to their success. 

Curiosity

A great programmer always asks “Why?”, they have an innate sense of wanting to know the inner logic of projects, even when something is working perfectly fine. 

Programmers who are curious and open-minded can often spot an issue before it becomes a major problem. You’re looking for the opposite of the “if it ain’t broke, don’t fix it” mentality. 

At interviews, look for candidates who question why your company does certain things in certain ways or who want to know more about the different projects their potential future team is working on. It’s a good sign. 

Self-learning and motivation

Today, many programmers are self-taught and learn on the job, which is actually an amazing skill to have. 

Look for candidates who are excited to learn new programming skills and are happy to learn outside formal training programs. A great question you can ask is, “How do you learn new skills?”. Or, when they’re talking about a particular skill they have, ask, “How did you acquire that skill?”

You can also see if they read programming blogs, books, and magazines, as this shows a willingness to learn outside formal settings. 

Passion for code

There are two kinds of programmers – those who live to code and day coders.

Day coders code because it’s a means to make a living. There’s nothing wrong with this, by the way. After all, many (if not most!) people work because they need a wage. 

However, they’ll often be motivated by money and not driven by a true passion for what they do. They’re also more likely to jump ship if another opportunity arises.

We advise you to look for candidates who show enthusiasm and excitement about your projects – and who are eager to demonstrate their skills. Look for the same passion when candidates talk about their past projects and especially about challenges they helped resolve. 

Adaptability

A fact of the programming world is that project requirements can change at the drop of a hat. So, programmers and engineers who can’t cope with this will find it difficult to stay motivated. 

Look at your company’s recent projects. Did requirements sometimes change after the beginning of a project? Did a shift in the market require you to reevaluate a project’s scope? If so, you need adaptable programmers. 

At the interview stage, ask your candidates if projects they’ve worked on in the past changed midway to see how they answer. You want candidates who say things like, “Yes, but that’s normal, right?” as opposed to, “Yes, and I could never get anything done!”

What questions are asked in a programming interview?

For a full assessment of your applicants’ skills, you must ask three types of programmer interview questions: 

  • Questions about concepts and terminology

  • Technical questions

  • Questions related to personality and culture 

That’s also what we’ve covered in the next three sections, along with sample answers to help you evaluate your candidates. 

20 programmer interview questions about concepts and terminology

20 programmer interview questions about concepts and terminology

Ask the following questions to assess a candidate’s understanding of particular programming concepts. 

1. Can you explain what a data structure is?

Data structures are a way of storing, organizing, and manipulating data. Examples of data structures include trees, graphs, and arrays.

2. Can you tell me what an array is?

Arrays are a type of data structure where all items stored belong to the same type. They’re typically known as collections of items stored in contiguous memory locations. The purpose of arrays is to organize data so that a related set of values can be easily searched and sorted.

3. What is a linked list?

Linked lists are similar to arrays in that they refer to linear data structures which form chain-like structures. However, the elements are not always stored in contiguous memory locations. 

4. Can you define LIFO?

LIFO stands for Last In First Out and is a process of accessing, storing, and retrieving data. The name comes from the fact that with this process, the data that it stored last is extracted first. 

5. Can you define a stack?

Stacks are linear data structures that perform operations in a LIFO manner. Elements are accessed from the top to the bottom element.

6. Can you define FIFO?

This acronym means First In First Out, and, similarly to LIFO, it’s a process of accessing, storing, and retrieving data. Unlike LIFO, FIFO extracts the data in the order it was stored. 

7. What is a queue?

Queues are linear data structures performing First In First Out (FIFO) operations. Contrary to stacks, in queues the earliest elements added are removed first. 

8. Can you tell me what binary trees are?

An extension of linked lists, a binary tree has no more than two children per node. They consist of two nodes at all times: a left and a right.

9. Can you define recursion?

Recursion is a function that calls itself after a termination condition has been reached. It uses a Last In First Out (LIFO) operation, which means it uses stacks. 

10. Can you define OOP?

The OOP acronym is short for Object-Oriented Programming, and it’s a paradigm that uses concepts such as classes, objects, and inheritance.

11. Explain the main concepts of OOP. 

The main concepts of OOP are the following: 

  • An object is a basic unit of object-oriented programming. It can be a combination of functions, variables, or data structures and different objects will have different behaviors, states, or attributes.

  • A class is made up of objects with several common methods but that exhibit different behaviors and in different states. 

  • Inheritance is a concept where objects inherit all the behaviors and properties of a parent object.

  • Polymorphism is the quality of existing in more than one form. This means you can give numerous definitions to one interface, and tasks can be performed in different ways.

  • Data abstraction is the ability to hide implementation details and keep only the important information visible.

  • Encapsulation is when data and code are bound together into a single unit. An example of this is a class. You can specify data in one class and hide it from other classes, which is known as data hiding.

12. What is a binary search tree?

A binary search tree is a data structure that allows for efficient data retrieval. The nodes on the left sub-tree contain keys that are lower than the node’s key value, while the right side contains keys greater or equal to the node’s key value. 

13. What are doubly linked lists?

A doubly linked list is a type of linked list data structure where you can traverse elements in both directions because every node has two links, one linking to the node before it and the other to the node after it. 

14. Can you explain what a graph is?

A graph is a type of data structure that contains sets of ordered pairs (arcs or edges), usually used to connect nodes, enabling you to store and retrieve data. 

15. What’s the difference between linear and non-linear data structures?

Linear data structures have elements adjacent to each other. Examples are stacks, linked lists, queues, and arrays.

Non-linear data structures have elements that can connect with two more elements. Examples are trees and graphs.

16. Can you explain what deque is?

A deque is a type of queue data structure that’s double-ended. This means you can insert or remove elements from either end. 

17. How do a stack and array differ from each other? 

Stack structures follow the LIFO (Last In First Out) process. The last data it stores is the first one it extracts. 

Array structures, conversely, don’t follow an order. Instead, you access them by referring to the element indexed within the array. 

18. What sorting algorithms do you know and which one is best?

No sorting algorithm can be described definitively as “the best” because each is designed for specific data structures.

Some types of sorting algorithms are:

  • Balloon sort

  • Radix sort

  • Bubble sort

  • Quick sort

  • Merge sort, among others. 

19. Explain how a variable declaration can affect memory.

A variable declaration affects memory because the data type stored in that variable controls how much memory is allocated. 

20. Can you explain what dynamic data structure is?

Dynamic data structures offer data-manipulation flexibility as they change based on the size of the data. They do this by expanding and contracting while the program runs. 

14 technical coding interview questions

14 technical coding interview questions

Asking some more technical interview questions helps ensure your candidates have the necessary experience and programming skills for the role. In this section, you’ll find 14 coding interview questions to evaluate your applicants’ technical skills. 

1. Explain how you would reverse a string in Java.

To reverse a string in Java, first of all, you need to declare a string. Then, you should take out the length of that string and loop through the string’s characters. Finally, you need to reverse the order of the characters in the new string.

2. How can you tell if a string is a palindrome?

In a palindrome, the order of characters in a string remains the same when reversed. To check, reverse the original string and then see if the reversed string is the same as the original. 

3. In a string, how would you find the number of occurrences of a character?

Loop through the string and find the character at every iteration to find the number of occurrences. The count will be updated whenever it is found.

4. How would you figure out whether two strings were anagrams? 

You can use a boolean variable to check whether two strings are anagrams. If the length of both strings is different, they cannot be anagrams. 

However, equal lengths do not mean they are anagrams. If the lengths are equal, you need to sort both strings after converting them to character arrays. If the sorted arrays are equal, they are anagrams. 

5. How would you calculate how many vowels and consonants a string has?

First, you need to loop through the string. Then, using the if condition, you need to add one to the vowel variable every time a vowel character is found. You need to do the same for the consonant variable. Finally, you need to print the vowel and consonant counts.

6. In an integer array, how do you find the elements that match?

Firstly, declare an array. Then, make a comparison between the numbers with other numbers in the array by nesting a few loops. If there are matching elements, print them.

7. How would you implement a bubble sort algorithm?

First of all, declare an array. Next, to compare the array’s numbers, nest a few loops. Any elements found in a different order will be replaced in ascending order.

8. How would you implement insertion sort?

You can assume that the array’s first element is sorted. The second element is stored separately from the first element in the key. Using this method, you’ll sort the first two elements. Next, take the third element to compare with the elements to the left of it. Continue the process until you sort the array. 

9. What is the process for reversing an array?

First, run the loop until the array reaches half its length. Then, at the beginning and the end, replace the numbers corresponding to the indexes.

10. Without using a third variable, how would you swap two numbers?

First, initialize two variables with values after declaring them. The sum of both numbers is b. Subtract b from a to swap a. Finally, subtract a from b to swap b.

11. What is the process for reversing a linked list?

First of all, declare a linked list and add elements. Apply a descending iterator method to this linked list to reverse the elements. 

12. Explain how you would implement a binary search.

In every iteration step, a binary search divides the array in half until the element is found. It computes the mid-number by comparing the values of adjacent elements in sorted arrays. Whenever low exceeds high, the element isn’t present in the list.

13. In an array, explain how you would find the second largest number.

Loop through the array first. Next, store the value of i in the highest variable and the value of the highest variable in the second-highest variable if the value of i is greater than the highest.

14. If you had to remove all instances of a character from a string, how would you do it?

Replace a character with another character, including symbols and whitespace, using the built-in string method “replace”. 

11 personality and culture questions for coding interviews

11 personality and culture questions for coding interviews

Personality and culture questions help you evaluate if candidates are a good fit for your current team and company. In this section, you’ll find 11 interview questions to help you with this.

Keep in mind, however, that some people are well-versed in saying all the right things in interviews. For the best results, combine these questions with pre-interview skills tests, such as the Motivation test and the Culture Add test.

1. Could you tell me about a time when you positively impacted a company or a product? 

This question allows your candidate to show their ability to innovate and come up with novel solutions to problems. Look for candidates who are proud of the new ideas and concepts they brought to the table. 

2. How do you make yourself a better developer outside of work?

This is another great question that will uncover your candidates’ ability to learn and make progress. The best programmers are always looking for ways to stay on top of the latest ideas and trends. 

3. If you felt you had taken on too much work, would you feel comfortable telling your project lead?

If you’re a hiring manager or HR manager recruiting for a fast-moving company, it can be a stressful environment for a programmer. This question lets you see if your candidates can cope with rapid growth. 

4. The project deadline is an hour away, and the code isn’t working. What will you do?

Situational questions like this reveal how well candidates cope in an ever-shifting environment. The approach will depend from project to project, but look for answers that are in line with your company’s culture. 

5.  How did you deal with a team member who constantly opposes your ideas?

This question reveals how collaborative candidates are, which is especially important if they’ll be working in diverse teams where team members come from all sorts of backgrounds.

6. In your opinion, what makes a good team? Do you need to interact with coworkers in order to be successful?

This is another question to see whether your candidates are capable of teamwork and collaboration. See if their answer aligns with their potential future team.

7. How would you explain an error or a delay to a client or a senior manager?

This question sifts out bad communicators. It’s normal for programmers to need to communicate bad news to others. How they do it can be the difference between success and serious complaints. 

8. How would you explain DevOps to me in under a minute if I knew nothing about programming?

It’s also normal for programmers to need to communicate with non-tech team members. The ability to relay ideas and concepts in layperson’s terms can be a boon. It also demonstrates patience, which is always a virtue! 

9. Describe a time when you discovered an error made by a senior developer. What did you do when you found it? 

No one likes to have mistakes pointed out. However, one tiny error can set a software release back by several weeks. Your candidate must have the attention to detail to spot mistakes and the communication skills to point them out diplomatically. 

10. What do you do when you find errors that aren’t immediately apparent?

Software engineers must be meticulous and thoroughly check their work. Look for candidates who already have error-detection systems and use different tools to find mistakes in their code. 

11.  How do you respond if your CTO asks you to change your code, but you disagree with their decision?

This is a great question for two reasons. First, you’re testing your candidate’s ability to take constructive feedback and learn from mistakes. Secondly, if they are right to disagree, are they able to handle it with diplomacy and tact? 

Hire the best developers with the right coding interview questions

In 2020, 69% of US employers struggled to fill tech roles – and the Covid-19 pandemic has only exacerbated similar trends. 

What this means for hiring managers is that good software engineers and programmers are hard to come by. But for your company to be successful, you must ensure you can attract and retain the best talent. 

So, how do you achieve that? 

With skills tests and the right interview questions. 

Use an online testing platform like TestGorilla to evaluate candidates’ hard and soft skills before interviews. This will help you cherry pick the best candidates to interview, saving you time, effort, and money

Then, you can use the coding interview questions from this article to further assess your applicants’ skills and make sure they have what it takes to succeed at your company.

For the best results, use TestGorilla’s language-agnostic coding tests and personality tests to find the best fits for the role: the ones who will become an asset to your company. Sign up for your free plan today and let us help you find the best developers for your open roles.

Share

You've scrolled this far

Why not try TestGorilla for free, and see what happens when you put skills first.

The best insights on HR and recruitment, delivered to your inbox.

Biweekly updates. No spam. Unsubscribe any time.

TestGorilla Logo

Skills tests to hire the best

Our screening tests identify the best candidates and make your hiring decisions faster, easier, and bias-free.

Free resources

Skills-based hiring checklist cover image
Checklist
The skills-based hiring checklist

A step-by-step blueprint that will help you maximize the benefits of skills-based hiring from faster time-to-hire to improved employee retention.

Onboarding email templates cover image
Checklist
Essential onboarding email templates

With our onboarding email templates, you'll reduce first-day jitters, boost confidence, and create a seamless experience for your new hires.

Skills-based hiring handbook cover image
Ebook
The skills-based hiring handbook

This handbook provides actionable insights, use cases, data, and tools to help you implement skills-based hiring for optimal success

Ebook
How to elevate employee onboarding

A comprehensive guide packed with detailed strategies, timelines, and best practices — to help you build a seamless onboarding plan.

The blueprint for boosting your recruitment ROI cover image
Ebook
The blueprint for boosting your recruitment ROI

This in-depth guide includes tools, metrics, and a step-by-step plan for tracking and boosting your recruitment ROI.

HR cheat sheet cover image
Checklist
The HR cheat sheet

Get all the essentials of HR in one place! This cheat sheet covers KPIs, roles, talent acquisition, compliance, performance management, and more to boost your HR expertise.

Employee onboarding checklist cover
Checklist
Employee onboarding checklist

Onboarding employees can be a challenge. This checklist provides detailed best practices broken down by days, weeks, and months after joining.

Key hiring metrics cheat sheet cover image
Checklist
Key hiring metrics cheat sheet

Track all the critical calculations that contribute to your recruitment process and find out how to optimize them with this cheat sheet.