Docs Index

Doc

Example Questions

Creating questions for technical interviews is hard! Use CoderPad Example Questions as a foundation to building out a tailored, effective interview process. Copy and edit Example Questions to make them unique to your company’s hiring needs.

Example Questions are provided in the Question Bank for our 10 most popular coding languages, and are available on Team, Business, and Enterprise plans. We include a sampling of Example Questions on our Team plan. Upgrade to a Business plan or above to get access to our full library of 50+ Example Questions. They are examples of proven interview questions plus solutions that can easily be customized for your company’s interviewing goals. You can also use them as a foundation to write your own questions.

Before you take a look at our examples, think about the positions you are hiring for, the skills an engineer needs to be successful in the position, and what potential questions you could use to gauge those skills.

Solutions to Example Questions are included for all 10 supported languages, so your team can easily compare a candidate’s work to a good/better/best solution. When you use an Example in a live pad, interviewers will be able to see the Solution in a separate tab (not visible to candidates). The Solution will also be available for any take-home project reviewers.

Example Questions are available for a variety of interview scenarios and difficulty levels. They are difficulty-rated Easy/Medium/Hard, and can be filtered by both difficulty and language in the Question Bank. Check out the full details of an Example Question to see “Candidate Instructions”, “Starter Code”, and “Solutions”. 

Creating your own Questions, Live Pads, and Take-Home Projects from Examples

You can click “Edit a Copy” on any Example question and then choose whether you want to modify and save it as a Live or take-home project question. You also can choose take-home project with Test Cases, adding your own custom test cases in the next step.

If you would like to use the Example questions as-is, you can click on either the “Create Live Pad” or “Create Take-Home” buttons to create a Live/take-home project pad with the Example question.

CoderPad Example Questions in the Question Bank

Additional Examples

  1. API/HTTP Call
  2. React Components
  3. Liars Dice

API/HTTP Call

BACKENDWITH TEST CASES

Although this challenge can be used for all levels, this question is especially great for junior to mid level engineers. The goal of this challenge is to see if the candidate can perform tasks that an engineer would do in their everyday workflow.

While the example makes use of https://www.premierleague.com data – we suggest tailoring this question to your business logic.

For example – as a food delivery company, you’d provide an API/HTTP that works with restaurant menu data/site. If you are a video streaming platform, you’d provide an API/HTTP that handles movie and tv-show data/site.

This provides a great candidate experience, and also gives the candidate a sense of what they would be working on in a day-to-day role at your company. It also lets you see how the candidate works in a real-world environment.

It’s good to leave some parts of the question to the candidate’s discretion. This allows you to see how they handle ambiguities. E.g. are they taking into account other URLs being entered, is the URL valid etc.

We recommend keeping this challenge to a time-limit of 30 minutes to 2 hours.

Candidate Instructions:

### Hey Candidate - Welcome to the API Take-Home Project Challenge Your task is to create a function that makes an API call to request an HTML page, and parse through the HTML to retrieve a soccer team's logo This function should work for every single team page from https://www.premierleague.com link. In the case the URL is not valid - you should return an error message. #### An example: Request: "https://www.premierleague.com/clubs/10/Liverpool/overview" Response: "https://resources.premierleague.com/premierleague/badges/t14.png" You can use C++, Java, Javascript, Python or Ruby. Some of these languages have request libraries. Others you will have to use the language's default HTTP methods. To see the available packages/libraries for the language you choose, simply click on the info button located next to the language. We have included test cases that will allow you to see if your code will pass or fail. The string must match exactly to pass. In the case of no image in the page, please return the message "No image found!". To view the test cases, you can view the test case tab, or when you run the code, you will see each test in the console and whether it failed or passed. You can log your output in the console at any time as well. Good luck!
Code language: Markdown (markdown)

Starter Code:

def solution(url): # Please write your code here. return "example"
Code language: PHP (php)

Test Cases:

ArgumentsExpected Result – Return Value
https://www.premierleague.com/clubs/10/Liverpool/overviewhttps://resources.premierleague.com/premierleague/badges/t14.png
https://www.premierleague.com/clubs/12https://resources.premierleague.com/premierleague/badges/t1.png
https://premierleague.comNo Image Found!

React Components

FRONTENDWITHOUT TEST CASES

The below example shows a frontend setup that can be used inside of CoderPad’s HTML/CSS/JS pads. To use this for take-home projects, you have to build this out using our “Create a Challenge WITHOUT test cases” option.

The benefit of being able to run your frontend challenges through CoderPad is that you can make use of your own design systems. The below example makes use of the Bootstrap React package.

The challenge has a time-limit of 2 hours. It is straightforward if you know React. It is short and precise. If the candidate has a good handle of React, they should be able to complete the challenge quickly and give you a good indication if they should move ahead in the interview process.

Candidate Instructions:

Welcome Candidate and thank you for taking the time to complete the COMPANY NAME take-home project for our frontend position. You will have 2 hours to complete this assignment. Once you have completed your solution, you can use the "Submit Challenge" button located in the bottom right hand corner. If you cannot come to a solution within the 2 hours, the code you have at 2 hours will be auto-submitted. The goal of this challenge is to build out a UI and layout found in this image: URL-GOES-HERE The UI is made up of a main header title and a list of posts that are formatted utilizing Bootstrap's Card component. You will need to make an API call to retrieve the posts. To get the posts, use this URL: https://jsonplaceholder.typicode.com/posts. Here are the strict rules of this challenge...you must: 1) Use the way you see fit to make the API call 2) Only retrieve the first 10 posts that the API gives you. 2) Utilize ReactBootstrap package to create the layout (an example of bringing in the `<Container/>` component from the library is below) 3) Create components as you feel is best suited for your solution The rest is up to you! Feel free to be creative once you have an initial solution. "Wow us!" Resources: 1) API: https://jsonplaceholder.typicode.com/posts 2) React Bootstrap Docs: https://react-bootstrap.github.io/components/alerts/ 3) React Docs: https://reactjs.org/docs/getting-started.html Good luck and if you have questions, please reach out to us recruiting@companyname.com
Code language: Markdown (markdown)

Starter Code:

<html> <head> <meta charset="UTF-8" /> <title>COMPANY NAME -- Frontend Challenge</title> <script src="https://unpkg.com/react/umd/react.production.min.js" crossorigin></script> <script src="https://unpkg.com/react-dom/umd/react-dom.production.min.js" crossorigin></script> <script src="https://unpkg.com/react-bootstrap@next/dist/react-bootstrap.min.js" crossorigin></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous" /> </head> <body> <div id="root"></div> <script type="text/jsx"> var Container = ReactBootstrap.Container, Row = ReactBootstrap.Row; class Main extends React.Component { state = { count: 0 } render() { return ( <Container> <Row> // ----- YOUR CODE HERE ------- // Please create your components below </Row> </Container> ) } } // ----- YOUR CODE HERE ------ // Please create your components here // Render component to the page ReactDOM.render(<Main />, document.getElementById('root')); </script> </body> </html>
Code language: HTML, XML (xml)

Liars Dice

BACKENDWITHOUT TEST CASES

The below example revolves around creating the game Liar’s Dice. This question can be used as inspiration for building other “utilities”. E.g. build a chatbot class, build out an invoice system etc.

This question makes use of both the IDE and the actual console itself. In this case, the candidate’s solution is using Ruby and it utilizes methods within the Game class. It can be instantiated in the console using Game.new(number_of_players).

The starter code is limited, but the challenge details should be enough guidance for the candidate to get started. The great thing about this question is not only are you testing for the mechanical skills, you can also get a good sense of a candidates algorithmic thinking.

Candidate Instructions:

Welcome to your take-home project! For this interview, your task will be to build out the game Liar's Dice. The game is a class of dice games for two or more players requiring the ability to deceive and detect an opponents deception. Each player begins with 5 dice that are hidden from the other players. Each player will roll their dice and hide the results. Player 1 puts X (between 0 and 5 of their own) number of dice in the middle, and declares how many dice of a certain number are in play. For example: Player 1 puts 2 3's into the middle of the table, and says "I believe there are at least 7 3's in play". This means player 1 thinks there is at least 7 3's across everyone's hand (including the 2 that they put into the middle). After a player places the dice in the middle and makes a bid, the player must reroll the remaining dice in their hand. Now the next player, let's call them Player 2 - must either challenge Player 1's claim or make a new claim that is at least one die higher. For example, "I believe there are like 9 3's in play". The goal is this exercise is to write a class that represents a game of Liar's Dice of X number of players (at least 2). The game itself does not have to work complete, but it must implement three public facing methods that are accessible. These methods are: 1) move - you should be able to tell the game that player A put B dice showing the number C in the middle 2) claim - you should be able to ask the game the probability that a claim of A number of B's is correct at any point 3) challenge - you should be able to challenge a claim and the game should tell you if you are correct An example use of this class: 1. Instantiate the game: `game = Game.new(players: 4)` 2. Make player 1 move: `game.move(player: 1, dice: 3, value: 5)` 3. Make player 2 move: `game.move(player: 2, dice: 1, value: 5)` 4. Check claim: `game.claim(dice: 20, value: 5)` ---> low percentage 5. Challenge: `game.challenge(dice: 20, value: 5)` ----> false The formula to determine the probability of k dice of the same value given n total dice: n! / k! (n - k)! <em>* (1/6)^k *</em> (5/6)^(n-k) https://www.thoughtco.com/probabilities-and-liars-dice-4038637 This formula above only tells us the probability when you know the exact number of dice, not "at least this number". You have to sum all the possibilities together for that. Example: There are 17 dice left, and we want to calculate the odds of at least 16. Thus we calculate the probability of getting exactly 16 and add that to the probability that all 17 are the same. 17! / 16!(1!) <em>* (1/6)^16 *</em> (5/6)^1 = 0.0000000000051 17! / 17!(0!) <em>* (1/6)^17 *</em> (5/6)^0 = 0.000000000000059 So... (0.0000000000051 + 0.000000000000059) * 100 = 0.000000000516% or pretty much never. Here is one final example execution to give you a better idea: game = Game.new(players: 4) game.move(player: 3, dice: 2, value: 3) game.move(player: 4, dice: 4, value: 3) game.move(player: 1, dice: 5, value: 3) game.move(player: 2, dice: 5, value: 3) game.move(player: 3, dice: 3, value: 3) There are 19 3's on the board. game.claim(dice: 20, value: 3) Since there is only 1 die left n = 1, k = 1, thus: 1! / 1!0! <em>* 1/6^1 *</em> (5/6)^0 = 16.67%
Code language: Markdown (markdown)