Microsoft Codility Test (OA)- Practice Questions & Guide [2024]
Arbel Yellin

Arbel, Microsoft Exam Expert at JobTestPrep.

Have a question? Contact me at: ask_the_team@jobtestprep.com

What is a Microsoft Codility Test?

Codility is a coding platform that Microsoft uses for its Online Assessment. The Microsoft Codility Test is an online programming exam later reviewed by a Microsoft (MS) reviewer. On this test, you will typically receive a combination of 3 coding questions to be solved in 60-90 minutes.

The Microsoft Online Assessment, also called the Online Technical Screen (OTS), is one of the first stages of the hiring process for software engineer roles. It will mostly involve a Codility exam, a phone interview, or both. 

What is the passing score for Microsoft’s Codility Test?

Your code will be graded automatically depending on its efficiency with all possible inputs:

  • 100% = Automatic Pass
  • 60% and below = Automatic Reject
  • 60%-100% = Code goes through a review by an MS reviewer. 

When reviewed, your code will be assessed based on your understanding of the solution and how optimal it is.

 

What questions will you be asked on the Microsoft Codility test?  

Microsoft online test questions will generally assess basic algorithm and data structure knowledge. On the Codility test, question types may be:

  • Debugging Questions 
  • Coding questions that require implementing data structures and algorithms (Strings, Binary Trees, etc.)  
  • MCQ (multiple choice questions) 
    For example, how many comparisons do you need to find the minimum value of a 5-element array? 
    Answer: (n-1)(4)

 

Microsoft’s most common question topics:

  1. Arrays/ Strings (most frequent)
  2. Linked lists
  3. Binary trees
  4. Search/ Sort
  5. Dynamic programming
  6. Bit manipulation

You will also be expected to answer questions related to computer subjects

  • Operating systems
  • DBMS
  • Computer Networks

 

Practicing all these topics may seem like a lot, but once you practice the most common Microsoft coding questions you will be able to save tons of time and effort.  

 

Here is what a Microsoft Coding question looks like on our Codility Test Prep:   

Codility test example question

 

What programming language will you be using on Codility?  

You’ll be given the option to choose your preferred programming language before you begin the test. Therefore, when practicing for the Microsoft Codility Assessment, we recommend choosing the language you prefer to code with.

 

Is Microsoft’s Codility test hard? 

Microsoft’s coding interview questions are easy-medium on the first round Codility test or phone screen. Their difficulty also depends on your experience level and the specific role you’re applying for.

The main challenges here are:

  • Working under time pressure.  
  • Not being able to tell the interviewer your thought process directly. 

Because of this, some people finish this test with blank answers and fail to pass Microsoft's code review. 


Do you still have questions about Microsoft's Codility test? Check these Codility test FAQs


Microsoft Codility Test Questions

Try solving some of the most popular Microsoft online assessment questions available on our prep course:


1. Bubble Sort

Write a function that sorts an array of integers in ascending order using the bubble sort algorithm. It should take an array as an input, sort it, and return it as an output.

Here's a code example by Python:

 

bubble sort
Explanation

The bubble sort algorithm repeatedly steps through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order. This process is repeated until no more swaps are needed, so the list is sorted.

The algorithm steps:

  1. Start with the current first element of the array.

  2. Compare the current element with the next one.

  3. If the current element is greater than the next element, swap them.

  4. Move to the next element and repeat the process until reaching the end of the array.

  5. Repeat this entire process until no more swaps are needed.


Input example:

arr = [64, 34, 25, 12, 22, 11, 90]

Output:

11, 12, 22, 25, 34, 64, 90


2. Search an Element in Sorted and Rotated Array

Write a function that searches for an element in a sorted and rotated array. If the element is found, return its index; otherwise, return -1. Assume that no duplicate exists in the array.

Here's a code example by Python:

 

sort and rotate
Explanation

Explanation:
Before the rotation, the array elements are arranged in an ascending order. Then occurs the following process

Approach:

  1. A modified binary search finds the pivot point (smallest element in the array).
  2. Determination of which segment of the array (left or right of the pivot) the target value belongs to.
  3. A binary search is performed on the relevant segment to find the target.

Thus, if ar = [15, 18, 2, 3, 6, 12]

and target = 3

Output index is 3


3. Longest Consecutive Subsequence

Given an unsorted array of integers, find the length of the longest consecutive element sequence.

Here's a code example by Python:

longest streak
Explanation
  1. A set 'num_set' stores all unique numbers from the array.
  2. The algorithm iterates through each number in the set and checks if it is the beginning of a sequence.
  3. If so, it continues counting the sequence length by checking for consecutive numbers.
  4. The longest streak is updated if the current sequence is longer than the previously recorded longest sequence.

So, given the input:

A = [1, 9, 3, 10, 4, 20, 2]

The output will be: 4

Explanation: The subsequent 1, 3, 4, 2 is the longest subsequence of consecutive elements.


4. Kadane's Algorithm

Find a contiguous subarray containing at least one element that has the largest sum within an array. Return its sum.

Here's a code example by Python:

Kadane's algorithm
Explanation

Kadane's algorithm is used to find the maximum sum of a contiguous subarray in an array of integers. It works by iterating through the array while maintaining the maximum sum ending at the current position and the overall maximum sum found so far.

How the algorithm works:

Two variables are required, current_sum, and max_sum:

  • current_sum is the maximum sum of the subarray ending at the current position.
  • max_sum is the maximum sum found so far.

Doing iterations through the array

  • For each element, update current_sum to be the maximum of the current element itself and current_sum + current_element.
  • Update max_sum to be the maximum of max_sum and current_sum.

Return max_sum

So, if the input array is:

Arr = [1, 2, 3, -2, 5]

The output will be:

9, including all the elements in the array.

 

Get detailed answers & access to over 312 Microsoft Codility practice questions on our full Microsoft Codility Prep Course.

 

How Can You Prepare and Pass Microsoft’s Codility Test?

Learn how not to leave any blank questions because of time constraints

It may be difficult and sometimes unrealistic to come up with the optimal solution for all coding questions given to you under time limits. To ensure you provide the best possible solution on time:

  • Track your speed and work on solving questions more quickly.
  • Learn your speed limits so you can manage your time and divide it between questions on the actual Microsoft Codility test.

Practice data structures and algorithms thoroughly

Practice all types of coding questions asked on online assessments, especially strings and lists questions that are frequently asked in Microsoft's Codility test and coding interviews. The more programming questions you solve, the better be better prepared.

Focus on the how as opposed to the what

Practicing the vast number of coding questions available on the web may take a lot of time and energy. To get the most out of your practice time, use practice resources that provide examples of optimal solutions to receive feedback regarding your answer and learn how to improve it. It will sharpen your ability to:

  • Ask important clarification questions.
  • Consider different and alternative solutions for the same problem.
  • Approach new problems more smoothly and with more confidence.

 

Our prep course can help

In our preparation pack, you’ll get access to a thorough prep course covering all question types found on Microsoft’s actual Codility test.  

  • Practice relevant and Microsoft- specific coding questions based on Microsoft’s SDE interview experiences.
  • Practice data structures and algorithms thoroughly to solve any coding problem  
    With 350+ coding questions and simulations (Arrays, Linked Lists, and more).
  • Learn how not to leave any blank questions  
    Keep track of your solving time with a timer on every question and time-limited coding simulations. 
  • Code with the same language as on the actual Codility test  
    Your choice of preferred language: C++, Java, Python, or Javascript.

All on one online coding platform.

Other Microsoft Codility Practice Resources  

There are MANY different practice resources when it comes to coding interviews. Here is a list of the best practice resources for your upcoming Microsoft coding test. The idea is to get familiar with the program, learn solving strategies, and improve your coding skills:

The Codility platform

Take the (free) Codility sample test to boost familiarity with the coding platform and reduce stress on the Microsoft Codility test. Note that Codility test questions are usually quite different (mostly easier) than the questions asked by Microsoft. Yet, exploring the platform is recommended to ensure you know how to use it before the exam. 

Leetcode Questions

Free practice questions in this Leetcode Thread are great for checking that you are familiar with the type of questions people recently received on their Microsoft Codility Test. However, the solutions are written by users and can often be inaccurate. In addition, it lacks more in-depth explanations that are vital for learning how you can improve.

 

Top 3 Tips for Microsoft's OA & Coding Interviews  

1. Communicate your thought process
It is important to Communicate your rationale and write comments during the OA when possible. This is especially important for Microsoft’s First Round OA since it may not involve personal interaction with the reviewer. Here are a few tips for that:

  • Speak about what you're doing out loud as you solve each coding problem.
  • Use clear and formal coding concept names when making comments.
  • Use logical sequences to build your explanations.

2. Ask clarification questions
If possible, the first step when approaching a problem should be asking important (but not excessive) clarification questions. What if you can’t ask any questions? No problem. Write your questions in a comment, along with the appropriate adjustments that are needed for each case scenario.

3. Describe the efficiency of your code
Commenting on your code’s time and space complexity and its benefits and drawbacks will show the reviewer that you fully understand your solution.

 

Microsoft Codility Test FAQs 

How can I access the Codility test?

You’ll receive a link 1-2 days before the scheduled interview. Feel free to open the link and read the instructions, this doesn’t mean you’ll have to start the test.  

Will I have to turn on my camera?

Codility usually requires turning on your camera, so be sure to be fully dressed, and if you thought about cheating - you may want to reconsider that. 

Can I google during the Codility test?

You can use websites and books unless instructed otherwise by the recruiter.  

What will happen once I hit “start the test”?

You will not be able to stop the timer. Your code will be saved automatically throughout the test, even if you close the browser window and open it again.  

Is the Codility test recorded?

Codility Usually records the whole history, including runs and corrections. This does NOT mean you have to be perfect- the opposite is true. Mistakes tell the reviewer about your ability to work your way to the solution.

Could I go back and change my code?

When finishing a coding task, clicking “submit” will not allow you to go back and modify your code.  

 

Applying for Other FAANG Companies?

Make sure you visit your thorough prep guides for the Google Software Engineer Interview and Amazon Online Coding Assessment

 

 

Microsoft, Codility, and other trademarks are the property of their respective trademark holders. None of the trademark holders are affiliated with JobTestPrep.