5 Software Engineering Interview Questions to Identify Outstanding Programmers

Ask these analytical questions to hire the best out of the best.

Shalitha Suranga
Dec 6, 2020 · 4 min read
Image for post
Image for post
Photo by Kaleidico on Unsplash

As a developer, you may conduct interviews with other developers who are willing to join your company. Frequently asked software engineering questions can be categorized into several categories such as domain knowledge, data structures, algorithms, critical thinking, technical experience, etc. Undoubtedly, any developer could grasp technical experience and domain knowledge easily. But all developers won’t become experts in topics such as data structures, algorithms, and critical thinking. Therefore, many interviewers who are hiring developers test these areas more if they need to hire the best out of the best. Also, top tech companies that are looking for outstanding developers prioritize these types of problems over technical experience-based questions because it’s hard to improve someone’s analytical skills than technical skills after they were hired.

The following problems fall into the most important topics that were mentioned above. If you conduct interviews, try asking a problem from these. Otherwise, if you are practicing for a software engineering interview give a try to solve all without checking the solution first.

The swapping problem

Everybody wrote codes for swapping values of two variables using a third variable. Swapping two variables is easy with the help of a third variable because there is a place to temporarily hold one variable while the other variable is being changed.

Problem: Swap the values of variables A and B without a third variable.

Solution: Let’s assume that A is 5 and B is 6. We can add B’s value to A. Thereafter, A becomes 11 and we can assign the value of A minus B to B. Eventually, the value of A minus B can be set to A to obtain the value of the previous B to A. The following pseudo-code explains this solution better.

A = 5, B = 6
A = A + B // A becomes 11
B = A - B // B becomes 5
A = A - B // A becomes 6

The birds-problem

If we are given a maths problem that can be solved easily using algebraic expressions, we may try to solve it by using some random numbers instead because we played with these kinds of mathematical problems many years ago. Therefore, giving a problem that has hidden algebraic expressions to a person could be used to test his/her ability to use memory to solve problems.

Problem: There are two groups (Let’s say A and B) of birds and each group has a leader. Group A’s leader said that the total birds of his group become twice as the other group if one bird comes from group B. On the other hand, Group B’s leader said that the total birds of his group will be the same as the other group if one bird comes from group A. How many birds in those two groups?

Solution: Simply take the number of birds in group A as x and y for the other group. There are two algebraic equations: x+1 = 2(y-1) and x-1 = y+1. Answers will be 5 and 7 if we solve these two.

The stack construction

Asking questions about data structures is very popular to test the basic computer science knowledge of applicants. Interviewers often ask about several data structures. For example, What is the difference between an array and a linked list? Whereas, we can examine their practical knowledge about data structures by asking a question like this.

Problem: How to construct a stack using two queues?

Solution: Let’s name queues as Q1 and Q2. If the action is “push”: If Q1 is empty enqueue to it. Otherwise, move all elements from Q1 to Q2. Put the given element to Q1, and move all elements back to Q1 from Q2. If the action is “pop”: simply dequeue from Q1.

The water puzzle

Every software engineering project often creates engineering problems that need to be solved by thinking smart. Problem-solving skills are needed to find optimal solutions for these kinds of engineering problems by applying theories from computer science. This is a nice problem to test the problem-solving skills of a particular software engineering job applicant.

Problem: How to measure 4L of water with only a 5L cup and a 3L cup (assume that you have an unlimited supply of water).

Solution: Fill the 5L cup with the 3L cup. Thereafter, fill 5L again until it gets filled with water. Now you have 1L in the 3L cup. Empty the 5L cup. Fill existing 1L to the 5L. Finally, fill 3L of water into the 5L cup.

The deadlock

Engineering discussions require good communication skills. It’s not just about speaking and writing. But, it’s about explaining something to a person without confusing the person. Almost all developers know about the deadlock problem in the operating systems theory. But not every developer can explain it without confusing the interviewer.

Problem: Explain deadlock with two processes (P1, P2) and two resources (R1, R2)?

Solution: P1 that is already using R2 is waiting for R1. P2 that is already using R1 is waiting for R2. This situation creates a never-ending waiting cycle that is called “deadlock”.

The Startup

Medium's largest active publication, followed by +771K people. Follow to join our community.

Shalitha Suranga

Written by

Software Engineer at 99x | Apache PMC member | Open Source Contributor (Author of Neutralinojs) | Technical Writer

The Startup

Medium's largest active publication, followed by +771K people. Follow to join our community.

Shalitha Suranga

Written by

Software Engineer at 99x | Apache PMC member | Open Source Contributor (Author of Neutralinojs) | Technical Writer

The Startup

Medium's largest active publication, followed by +771K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store