Microsoft Codility Practice Test

Microsoft Codility Practice Test

Are you applying for a Microsoft SDE1, software internship, or SDET position? If so, expect to take the Microsoft Codility Test also known as the Microsoft Online Assessment (OA). Practicing for the Microsoft Codility test can feel overwhelming. We are here to walk you through what to expect on the test, how to prepare, and what you need to know to get a high score.


Take a Practice Microsoft Codility Test.

What Is the Microsoft Codility Test?

The Microsoft Codility Test, also referred to as the Microsoft Online Technical Screen (OTS) is an evaluation used by Microsoft to evaluate the coding skills of potential candidates. Codility is the name of the coding platform that Microsoft uses to give their candidate's online assessments (OAs). It is made up of three coding challenges that the candidate must complete within 60-90 minutes. The challenges are designed to test the candidate's coding and problem solving skills. The test is given online, and the results are then reviewed by the Microsoft (MS) reviewer. The Codility test is used by other top employers including Tesla, Amazon, and Paypal.


What Types of Questions Are on the Microsoft Codility Test?

The types of questions on the Microsoft Online Assessment (OA) can be divided into three question types:

  1. Coding Questions
  2. Debugging Questions
  3. Multiple-choice questions

Some common question types are:

  • Algorithmic questions: These questions evaluate the applicant's ability to understand and implement algorithms and data structures, including sorting algorithms, dynamic programming, and graph algorithms.
  • Coding questions: These questions evaluate the applicant's ability to write code in specific programming languages and to implement solutions to problems.
  • Design questions: These questions evaluate the applicant's ability to come up with an efficient and effective solution to a problem, taking into account factors such as scalability, performance, and maintainability.
  • Optimization questions: These questions evaluate the applicant's ability to optimize the performance of a string of code making it more efficient.

Before taking the exam make sure you are familiar with the following content:

  • Arrays/Strings
  • Binary Trees
  • Bit Manipulation
  • Dynamic Programming
  • Search Sort
  • Linked Lists
  • Computer Networks
  • Operating Systems
  • Database Management Systems (DBMS)

Free Practice Microsoft Codility Test Questions, Answers, and Solutions

1. Bubble Sort

A bubble sort question on a Codility test may ask the applicant to write a function that sorts an array of integers using the bubble sort algorithm. The bubble sort algorithm repeatedly goes through the array, compares adjacent elements and swaps them if they are not in the right order. The function should take in an array of integers as input and return the sorted array.

Here is an example of a bubble sort question and answer in Python:

Free Practice Microsoft Codility Test: Bubble Sort
Answer + explanation

The function above iterates through the array, compares each element with its neighbor and swaps them if they are in the incorrect order. The outer loop runs times, where n is the length of the array and the inner loop runs n-i-1 times. The loop will finish when the array is sorted.

The test may include variations of the question such as sorting the array in descending order, sorting an array of floating point numbers, sorting an array of strings, or sorting a two-dimensional array.

It is important to test the function with different test cases to make sure that it works correctly and runs in the time complexity O(n²).

2. Search an Element in Sorted and Rotated Array

A question on a Microsoft Codility Test that involves searching an element in a sorted and rotated array may ask the applicant to write a function that takes in an array of integers, the element to be searched and returns the index of the element if it is present in the array, otherwise it returns -1.

Here is a sample of a function in Python that implements a binary search algorithm to search for an element in a sorted and rotated array:

Free practice Microsoft Codility test: Search an Element in Sorted and Rotated Array
Answer + explanation

The function above first finds the pivot element in the array using the findPivot function. After, it checks whether the key is present at the pivot point, if not it checks whether the key is present in the left or right of the pivot and calls the binarySearch function accordingly. The binarySearch function is a standard binary search algorithm that takes in the array, the low and high indices, and the key to be searched.

It is criticall to test the function with different test cases, including edge cases to ensure that it works correctly and runs in O(log n) time complexity.

3. Kadane's Algorithm

A question on a Microsoft Codility Test that involves Kadane's Algorithm may ask the candidate to write a function that finds the contiguous subarray within a one-dimensional array of numbers which has the largest sum.

Here is a sample of a function in Python that implements Kadane's Algorithm:

Free practice Microsoft Codility test: Kadane's Algorithm
Answer + explanation

The function above iterates through the array and uses two variables max_ending_here and max_so_far to track the maximum sum subarray ending at the current position and the maximum sum subarray overall.

It compares the current element with the sum of the current element and the previous max_ending_here and updates max_ending_here accordingly. It also updates max_so_far by comparing it with max_ending_here.

It is important to test the function with different test cases, including edge cases, to ensure that it works correctly and runs in O(n) time complexity.

The above approach doesn't handle the case where all the elements are negative, in that case it will return the least negative number. So, it is a good practice to add a check if all the elements are negative and return the largest one.

4. Longest Consecutive Subsequence

A question on a Microsoft Codility Test that involves finding the longest consecutive subsequence may ask the candidate to write a function that takes in an array of integers and returns the length of the longest consecutive subsequence.

Here is a sample of a function in Python that solves this problem:

Free practice Microsoft Codility test: Longest Consecutive Subsequence
Answer + explanation

The function above converts first the input array into a hash set for efficient lookup. Then it iterates through the array, checks if the current element is the starting point of a subsequence (i.e. it's not present in the set as its previous element) and if so, it uses a while loop to check for the next elements in the subsequence and count its length. Last, it updates the max_length variable with the maximum length of all the subsequences.

It is integral to test the function with different test cases, including edge cases to ensure that it works correctly and runs in O(n) time complexity.

Get More Free Practice for the Microsoft Codility Test.


What Positions Is the Microsoft Codility Test Used For?

The Microsoft Codility Test is typically used as part of the hiring process for software developer and software engineering positions. You will need to take the test if you are applying for a software internship, SDE-1 (software engineer level 1), or SDET (software development engineer in test) role.


How Do I Take the Microsoft Codility Test?

The process for taking the Microsoft Codility Test typically involves the following steps:

  1. Application: You would need to apply for a SDE-1, SDET, or software internship position. 
  2. Invitation: If your application is selected, you will be sent an invitation 1-2 days before the interview. You will get an email saying : "Microsoft invites you to a test at Codility." You can open the invitation link before taking the test and review the instructions.
  3. Test setup: Before you take the test, you will need to set up your computer and test environment according to the instructions provided. You will be required to record the test so make sure you are sitting in an appropriate environment. 
  4. Taking the test: Once your test environment is set up, you will be able to access the test. Once you start the test you cannot stop. Your code will be saved automatically throughout the test.You will be given between 60-90 minutes to complete the exam. It is important to manage your time effectively and to work through the questions as efficiently as possible.
  5. Submitting the test: Once you have completed a question, you will submit your solutions. Once you hit submit you cannot go back and modify it.
  6. Results: After you submit the test, you will receive your Microsoft Codility Test Results. At this time you will find out where you stand in the application process. 

What Is a Passing Score on the Microsoft Codility Test?

The first stage of scoring is automatic. In this phase your score can be broken down into three groups:

  1. Automatic Pass: if you receive 100%.
  2. Under Review: Your code passes on to be reviewed by a MS reviewer if you receive 60%-99%.
  3. Automatic Reject: 60% and below.

If your score passes to a MS reviewer this would typically mean that you have demonstrated the ability to write efficient, well-organized code and to solve problems in a logical and systematic manner. In general, passing the 60% threshold is designed to be challenging, and the aim is to identify candidates who can demonstrate exceptional coding skills. It's also important to note that passing this threshold does not guarantee anything. That being said, once the test is reviewed by an MS reviewer they begin to take into account your thought process behind the answers. So even if you get a question wrong if you used logical sequential reasoning you will be given some points.


What Programming Language Is on the Microsoft Codility Test?

Before taking the test you can choose what programming language you would like. This means you can choose the language you feel most comfortable in. The programming languages offered include:

  • Python
  • Java
  • JavaScript
  • C++
  • SQL

Can I Use Google During the Codility Test?

You are allowed to outside sources like websites and books unless instructed otherwise.


Is the Microsoft Codility Test Recorded?

The test will be recorded. You will be required to turn on your camera, so dress accordingly. 


How Does the Codility Test Detect Cheating?

The Codility Test is recorded. This makes it impossible to cheat. Conversely, it shows the reviewer your thought process when answering the questions. If you made a mistake they can see how you worked through the problem. 


Is the Codility Test Hard?

The Microsoft Codility Test is designed to be challenging and to evaluate the candidate's ability to write efficient, well-organized code and to solve problems in a logical and systematic manner. The difficulty level of the test can vary depending on the amount of experience you have. It is essential you prepare for the test by taking a Microsoft SDE Practice Test. This will help you understand the requirements and perform well on the actual test.


How Can You Prepare for the Microsoft Codility Test?

The Microsoft Codility Test is a challenging obstacle in the hiring process. The worst thing that can happen is that you get to the exam and totally leave a question blank. You should expect to see data structure and algorithmic questions. The most important thing to consider when preparing is managing your time. We recommend using this Microsoft Codility Test Practice and Guide. We like this prep course because it gives you lots of bang for your buck. Over +350 Microsoft SDE questions and simulations. The practice test is timed to exactly mimic the actual exam. It also includes video tutorials, and quizzes on computer subjects. You want to use a practice resource that gives you feedback because the Codility test is not just about getting the questions right but about how you approach them.


Microsoft Codility Test Tips

Here are a few tips for mastering the Microsoft Codility Test:

  1. Narrate your Answer: You will be recorded when taking the exam. So it is important to describe what you are doing when you answer the question. Make sure you use formal coding concepts when you describe what you are doing.
  2. Plan your solution: Before you begin coding, take a moment to plan out your solution. Think about the data structures and algorithms you will need to use and how you will approach the problem. Use clear sequential processes when answering.
  3. Write clean, efficient code: The Microsoft Codility Test is designed to assess your coding skills, so it's important to write clean and efficient code. Use proper naming conventions, indentation, and commenting, and avoid using unnecessary variables or operations.
  4. Test your code: Before submitting your solution, test it thoroughly to ensure it works as expected. Make sure to test edge cases and any special conditions mentioned in the problem statement.
  5. Practice, practice, practice: The more you practice, the better prepared you will be for the test. Take a look at this Microsoft SDE Practice Test
  6. Time management: Make sure you are able to manage time well, whatever you do try not to leave an answer blank. 

Have a Question? Now You Can Ask TSA Test Prep!