Docs Index

Doc

Example Questions

Last updated on

The best questions are the ones tailored to your business. Use CoderPad Examples questions as a foundation to build out a tailored, effective interview process. Copy and edit the 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 Business and Enterprise plans. Team plans will have access to a small sample of Example 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 the example questions are included for all 10 supported languages. 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.

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

You can click Edit a Copy on any CoderPad Example question and then choose whether you want to modify and save it as a Live Interview or Take-Home project question. You also can choose a 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 Interview/Take-Home project pad with the CoderPad Example question.

CoderPad Example Questions in the Question Bank


Additional example questions

Below you’ll find additional example questions you can use for inspiration:



HTTP API calls

Question type: backend with test cases.

Target experience level: Junior to mid-level engineers

Recommended time limit: 30-120 minutes

This example uses data from https://www.premierleague.com. Feel free to use data that is more in line with your business which can provide an insight into life at your company.

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)

Code language: Markdown (markdown)

Starter code:

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

Code language: Python

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

Question type: frontend without test cases.

Recommended time limit: 120 minutes

This example asks the candidate to create a simple frontend view using CoderPad’s HTML/CSS/JS pads with the React Bootstrap package. If the candidate knows React well, they should be able to complete the challenge quickly.

For take-home projects, build this question out using our ‘Create a Challenge WITHOUT test cases’ option.

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 that you feel are best suited for your solution. The rest is up to you! Feel free to be creative once you have an initial solution. 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)

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)

Code language: HTML, XML (xml)



Liars dice

Question type: backend without test cases

This take-home project example question is based on the game liar’s dice. It tests the candidates coding skills and aptitude in algorithmic thinking. The question requires use of both the IDE and the console. 

Use this question as a starting point for writing more questions based on mini-applications; for example, build a chatbot class, build out an invoice system, etc.

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 opponent’s 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 are 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 of 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 completely, 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)