Web Development Interview Questions for Freshers
The short answer
Web interviews test HTML, CSS and JavaScript basics. These 10 questions cover the box model, block versus inline, Flexbox versus Grid, semantic HTML, var versus let and const, and closures. Each has a note on a good answer, and a minute is enough to answer one.
10 questions. Open one to see what a good answer covers.
What is the CSS box model?
Every element is a box made of content, padding, border and margin. Knowing it explains an element's real size, and box-sizing: border-box makes width include padding and border.
What is the difference between block, inline and inline-block?
Block elements start on a new line and take the full width. Inline elements flow in the text and ignore width and height. Inline-block flows inline but accepts width and height.
When would you use Flexbox, and when Grid?
Flexbox arranges items in one direction, a row or a column, and suits menus and cards. Grid lays out rows and columns together and suits whole page layouts.
What is semantic HTML and why does it matter?
Using elements for their meaning, such as header, nav, main and button. It helps accessibility, search engines and readable code, compared with using div for everything.
What is the difference between var, let and const?
var is function-scoped and hoisted with an undefined value. let and const are block-scoped, and const cannot be reassigned. Prefer const, and let when the value changes.
What is a closure in JavaScript?
A function that remembers the variables of the place where it was created, even after that place has finished running. It is used for private data and callbacks.
What is the difference between == and === in JavaScript?
== converts types before comparing, which gives surprises such as 0 == '0'. === compares value and type with no conversion, so it is the safer choice.
What are promises and async/await?
A promise stands for a value that will arrive later. async/await is a cleaner way to write code that waits for promises, and errors are handled with try and catch.
What happens when you type a URL into the browser?
The browser finds the server's address through DNS, opens a connection, sends an HTTP request, receives the HTML, and then loads CSS and scripts and draws the page.
How do you make a page responsive?
Use flexible layouts such as Flexbox and Grid, relative units, images that scale and media queries for different screen widths, and test on a real phone.
Everything runs in your browser. What you type is not sent anywhere.
How to: Web Development Interview Questions for Freshers
- 1Read the question and sketch the idea on paper.
- 2Say your answer aloud, with a tiny code example.
- 3Open the tip and compare.
- 4Practise again in practice mode.
At a glance
- Questions
- 10 web development questions
- Includes
- Box model, layout, semantic HTML, JavaScript scope
- Time to aim for
- About 60 seconds each
Frequently asked questions
When do I use Flexbox and when Grid?
Use Flexbox to lay items out in one row or column, and Grid when you need rows and columns together. The bank's tip gives a one-line way to say it.
Should I bring a portfolio?
Yes, for web roles. Keep two or three projects live and be ready to explain one choice you made in each, such as how you structured the layout.
More quick answers
- HR Interview Questions for Freshers: Tell Me About Yourself
- Behavioural Interview Questions and the STAR Method
- Python Interview Questions for Freshers
- Java Interview Questions for Freshers
- SQL Interview Questions for Freshers
- Data Structures and Algorithms Interview Questions for Freshers
- CS Fundamentals Interview Questions: OOP, OS and Networks
- Excel and Data Analysis Interview Questions for Freshers