User Interface Interview Questions (Machine Coding) in Front End Interviews
Find the latest version of this page on GreatFrontEnd's Front End Interview Playbook.
Many Front End Engineers spend a lot of time building UI, and building a UI component is a good way to assess someone's familiarity in the three biggest aspects of front end — HTML, JavaScript, CSS.
Companies that ask such questions usually ask candidates to code in one of these three ways:
- Online editor with preview: You get to write HTML, CSS, JavaScript within the browser and see an instant preview of the page. Common platforms used include CodePen and CodeSandbox.
- Online editor without preview: Similar to the above, but you don't get to see any visual output of the page. A common platform for this is CoderPad. In the past, Google used Google Docs 😱.
- BYOE (Bring Your Own Environment): Candidates bring their own development environment/laptop and free to choose whether they want to do local development using their own editors or use online environments like CodePen or CodeSandbox. This is the most ideal scenario that benefits candidates, but is usually only done during on-sites. You can usually use a JavaScript framework/library and in that case you are recommended to use tools that help you scaffold a fresh app where you can start coding immediately (e.g.
create-react-app
,vue-cli
). You don't want to be spending time during the interview doing unnecessary plumbing that doesn't give your interviewers additional useful signals. - Whiteboard: Candidates have to write all the required HTML, JS, CSS on the whiteboard. There's no preview, no autocomplete, no online documentation to help you; you're totally on your own. So far Facebook and Google are the only companies that are known to make candidates write code on a physical whiteboard during onsite front end interviews.
Where to practice
These questions and many others are available on GreatFrontEnd. Apart from a huge question bank of coding questions that you can filter by frameworks, languages, and topics, each question also comes with detailed test cases and an official solution authored by ex-FAANG senior engineers.
Here are some questions you can start with:
- Components
- Tabs (Free)
- Modal Dialog (Free)
- Image Carousel (Free)
- Accordion (Free)
- Star Rating (Free)
- Progress Bars (Free)
- Refer to Bootstrap's list for other possible components
- Widgets
- Traffic Light (Free)
- Digital Clock (Free)
- Stopwatch (Free)
- Transfer List (Free)
- Apps
- Todo list (Free)
- Data Table (with extensions for sorting and filtering) (Free)
- File Explorer (Free)
- Kanban Board
- Games
- Tic-tac-toe
- Whack-a-mole
- Wordle
- Tetris (advanced)
- Snake (advanced)
Where to practice
Each of these questions and over 200+ more can be found on GreatFrontEnd
- Each question comes with official solutions in popular frameworks such as React, Angular, Svelte and Vue
- With live previews, you can practice online directly, simulating a real interview environment with no set-up required
Considerations
After you complete (or even before you start on) the question, think about these potential issues (where relevant). You may or may not have to handle them, so you can always clarify with the interviewer before starting on it so that you don't write too much/little code.