I. HTML
- What is the purpose of Semantic HTML, and how did you use it in your Ride Booking project?
- Answer: It uses tags like <header>, <nav>, and <section> to provide meaning to the code.
- Explain the difference between block-level and inline elements.
- Answer: Block-level elements (like <div>) take up the full width available; inline elements (like <span>) only take as much width as necessary.
- What are HTML5 data attributes?
- Answer: They allow us to store extra information on standard HTML elements without using non-standard attributes.
- How do you optimize an HTML document for accessibility (a skill you listed)?
- Answer: Using proper ARIA roles, alt text for images, and ensuring high contrast ratios.
- What is the significance of the <!DOCTYPE html> declaration?
- Answer: It tells the browser that the document is an HTML5 document.
- Explain the use of the <picture> tag versus the <img> tag.
- Answer: The <picture> tag allows for more flexibility in specifying multiple image resources for different screen sizes.
- What is the difference between localStorage and sessionStorage?
- Answer: localStorage has no expiration date, while sessionStorage is cleared when the page session ends.
- How do you create a hyperlink that opens in a new tab?
- Answer: By using target=”_blank” within the <a> tag.
- What is the purpose of the <meta charset=”UTF-8″> tag?
- Answer: It specifies the character encoding for the HTML document.
- In your Job Application project, how did you handle user input via HTML forms?
- Answer: By using various <input> types like text, email, and submit to capture data.
- What are “void elements” in HTML?
- Answer: These are elements that do not have a closing tag, such as
<img>,<br>, and<hr>.
- Answer: These are elements that do not have a closing tag, such as
- Explain the purpose of the
altattribute for images.- Answer: It provides a text description for screen readers and displays if the image fails to load, which is critical for accessibility.
- What is the difference between
<strong>and<b>, or<em>and<i>?- Answer:
<strong>and<em>carry semantic meaning (importance/emphasis), whereas<b>and<i>are purely for visual styling.
- Answer:
- How do you group related options in a
<select>dropdown?- Answer: By using the
<optgroup>tag.
- Answer: By using the
- What is the purpose of the
<iframe>tag?- Answer: It is used to embed another document or website within the current HTML page.
- What are the different types of lists in HTML?
- Answer: Ordered lists (
<ol>), Unordered lists (<ul>), and Description lists (<dl>).
- Answer: Ordered lists (
- How do you specify the character encoding for a document?
- Answer: Using
<meta charset="UTF-8">in the<head>section.
- Answer: Using
- What is the “canonical” link tag used for?
- Answer: It tells search engines which version of a URL is the “master” copy to prevent duplicate content issues in SEO.
- What does the
<head>element contain?- Answer: Metadata about the document, such as the title, links to scripts, stylesheets, and character sets.
- Answer: Metadata about the document, such as the title, links to scripts, stylesheets, and character sets.
II. CSS
- Explain the CSS Box Model.
- Answer: It consists of margins, borders, padding, and the actual content.
- What is the difference between flexbox and grid?
- Answer: Flexbox is designed for one-dimensional layouts (row OR column), while Grid is for two-dimensional layouts (row AND column).
- How do you handle responsiveness without a framework?
- Answer: Using CSS Media Queries to apply different styles at specific breakpoints.
- What is CSS Specificity, and how does it affect styling?
- Answer: It is the rank that determines which style rule is applied by the browser when multiple rules target the same element.
- Explain the difference between relative, absolute, and fixed positioning.
- Answer: Relative is positioned relative to its normal position; absolute is relative to its nearest positioned ancestor; fixed is relative to the viewport.
- What are CSS Variables (Custom Properties)?
- Answer: Entities defined by CSS authors that contain specific values to be reused throughout a document.
- How do you use the z-index property?
- Answer: It specifies the stack order of an element (which element should be in front of others).
- What is the purpose of the box-sizing: border-box; property?
- Answer: It ensures that padding and borders are included in the element’s total width and height.
- How can you center a div horizontally and vertically?
- Answer: Using Flexbox: display: flex; justify-content: center; align-items: center;.
- How do you optimize CSS performance (another skill you listed)?
- Answer: Minifying files, using shorthand properties, and avoiding overly deep selectors.
- What is the difference between
hex,rgb, andhslcolor codes?- Answer: Hex is base-16; RGB defines Red, Green, and Blue levels; HSL defines Hue, Saturation, and Lightness (often considered more intuitive).
- Explain the CSS “Cascade” hierarchy.
- Answer: It determines which styles win based on Importance, Specificity, and Source Order.
- What is the difference between
opacity: 0anddisplay: none?- Answer:
opacity: 0makes an element invisible but it still takes up space and is clickable.display: noneremoves it entirely from the layout.
- Answer:
- What are “Pseudo-classes” versus “Pseudo-elements”?
- Answer: Pseudo-classes (
:hover,:active) style states. Pseudo-elements (::before,::after) style specific parts of an element.
- Answer: Pseudo-classes (
- What is a CSS “Reset” or “Normalize”?
- Answer: A set of styles used to reduce browser inconsistencies by providing a standard baseline.
- How does the
calc()function work?- Answer: It allows you to perform calculations to determine CSS property values (e.g.,
width: calc(100% - 20px)).
- Answer: It allows you to perform calculations to determine CSS property values (e.g.,
- What is the difference between
emandremunits?- Answer:
emis relative to the font size of its parent;remis relative to the font size of the root (<html>) element.
- Answer:
- What is “Float” in CSS, and how do you “Clear” it?
- Answer: Float pushes an element to one side. You clear it using the
clearproperty or a “clearfix” hack to prevent parent container collapse.
- Answer: Float pushes an element to one side. You clear it using the
- Explain the
object-fitproperty.- Answer: It defines how an
<img>or<video>should be resized to fit its container (e.g.,coverorcontain).
- Answer: It defines how an
- What is the purpose of the
@importrule?- Answer: It is used to import one stylesheet into another.
III. JavaScript
- What is the difference between let, const, and var?
- Answer: var is function-scoped; let and const are block-scoped. const cannot be reassigned.
- Explain how you used JavaScript to create the “Like/Dislike” functionality.
- Answer: By attaching event listeners to buttons that update a counter state when clicked.
- What is an Arrow Function, and how does it differ from a regular function?
- Answer: It provides a shorter syntax and does not have its own this context.
- Explain the concept of “Hoisting” in JavaScript.
- Answer: Variables and function declarations are moved to the top of their scope during the compile phase.
- What are “Promises,” and why are they used?
- Answer: They handle asynchronous operations, representing a value that may be available now, in the future, or never.
- How does the map() function work?
- Answer: It creates a new array by calling a specific function on every element in the calling array.
- What is the difference between == and ===?
- Answer: == performs type coercion; === checks for both value and type equality.
- How did you implement the “Search functionality” in your Ride Booking project?
- Answer: Likely by using JavaScript’s .filter() method to match user input against an array of objects.
- What is the DOM (Document Object Model)?
- Answer: An interface that treats an HTML document as a tree structure where each node is an object representing part of the document.
- Explain “Event Bubbling.”
- Answer: When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up to other ancestors.
- What is a “Callback Function”?
- Answer: A function passed into another function as an argument, which is then invoked inside the outer function.
- Explain the difference between
nullandundefined.- Answer:
undefinedmeans a variable has been declared but not assigned a value.nullis an assignment value representing no value.
- Answer:
- What are “Template Literals”?
- Answer: Strings wrapped in backticks (
`) that allow for embedded expressions and multi-line strings.
- Answer: Strings wrapped in backticks (
- How do you check the data type of a variable?
- Answer: Using the
typeofoperator.
- Answer: Using the
- What is the difference between “Synchronous” and “Asynchronous” code?
- Answer: Synchronous code runs line by line. Asynchronous code allows the program to continue running while waiting for a task (like an API call) to finish.
- What is the purpose of
JSON.stringify()andJSON.parse()?- Answer:
stringifyconverts an object to a string;parseconverts a string back into an object.
- Answer:
- What is a “Closure” in JavaScript?
- Answer: A function that remembers its lexical environment even when that function is executed outside its original scope.
- What is the “Strict Mode” (
'use strict')?- Answer: A way to opt into a restricted variant of JavaScript that catches common coding bloopers and throws errors.
- What is the difference between an Array and an Object?
- Answer: Arrays are ordered lists of values indexed by numbers. Objects are unordered collections of key-value pairs.
- How do you stop a function from executing after a certain amount of time?
- Answer: Using
setTimeoutto trigger it andclearTimeoutto stop it if necessary.
- Answer: Using
IV. Bootstrap
- How does the Bootstrap Grid System work?
- Answer: It uses a series of containers, rows, and columns to layout and align content, based on a 12-column system.
- In your Restaurant Web Page, how did you use Bootstrap to make it responsive?
- Answer: By using Bootstrap’s responsive utility classes and grid columns (e.g., col-md-6).
- What is the difference between .container and .container-fluid?
- Answer: .container has a fixed maximum width; .container-fluid is full-width, spanning the entire viewport.
- How do you create a navigation bar that collapses on mobile in Bootstrap?
- Answer: By using the .navbar class along with the .navbar-expand-lg and .collapse classes.
- What are Bootstrap “Utilities”?
- Answer: Classes designed to handle common tasks like spacing (m-3, p-2), alignment, and colors.
- How do you add a Modal to a page using Bootstrap?
- Answer: By using the .modal class and triggering it with a button using data-bs-toggle=”modal”.
- What is the purpose of the img-fluid class?
- Answer: It makes an image responsive by setting max-width: 100% and height: auto.
- How do you handle spacing (margins and padding) in Bootstrap?
- Answer: Using shorthand classes like mt-* for margin-top or px-* for horizontal padding.
- What are “Bootstrap Components”?
- Answer: Pre-styled UI elements like buttons, alerts, cards, and carousels.
- How do you customize Bootstrap’s default styles?
- Answer: By overriding Bootstrap’s CSS variables or writing custom CSS that targets Bootstrap classes.
- What are “Breakpoints” in Bootstrap?
- Answer: Defined screen sizes (xs, sm, md, lg, xl, xxl) where the layout changes to adapt to the device width.
- Explain the “Mobile-First” approach in Bootstrap.
- Answer: Styles are applied to small screens first, and more complex styles are added via media queries for larger screens.
- What is a “Card” component in Bootstrap?
- Answer: A flexible and extensible content container that includes options for headers, footers, and content.
- How do you align text in Bootstrap?
- Answer: Using utility classes like
.text-center,.text-start, or.text-end.
- Answer: Using utility classes like
- What is the purpose of the
.activeclass?- Answer: It indicates the current page or selection within components like navbars or pagination.
- How do you hide an element on specific screen sizes in Bootstrap?
- Answer: Using display utilities like
.d-noneor.d-md-block.
- Answer: Using display utilities like
- What is the “Gutter” in the Bootstrap grid?
- Answer: The space between columns, created by horizontal padding.
- What are “Alerts” in Bootstrap?
- Answer: Components used to provide feedback messages (e.g.,
.alert-success,.alert-danger).
- Answer: Components used to provide feedback messages (e.g.,
- How do you make a table responsive in Bootstrap?
- Answer: By wrapping the
<table>in a<div>with the.table-responsiveclass.
- Answer: By wrapping the
- What is the purpose of “Z-index” utilities in Bootstrap?
- Answer: To control the stacking order of elements like modals and tooltips.
V. Tailwind CSS
- What is “Utility-First” CSS, as used in your Doormat Landing Page?
- Answer: It involves building designs by applying small, single-purpose classes directly in the HTML.
- How does Tailwind handle responsiveness?
- Answer: By using screen size prefixes like md: or lg: directly on the utility classes (e.g., md:flex).
- What are the benefits of using Tailwind over a framework like Bootstrap?
- Answer: It offers more design flexibility without being tied to pre-built components, leading to more unique UIs.
- How do you handle hover or focus states in Tailwind?
- Answer: Using prefixes like hover: or focus: (e.g., hover:bg-blue-700).
- What is the @apply directive in Tailwind?
- Answer: It allows you to extract common utility patterns into custom CSS classes to keep the HTML clean.
- How do you customize the Tailwind configuration?
- Answer: By modifying the tailwind.config.js file to add custom colors, spacing, or breakpoints.
- Explain “Just-in-Time” (JIT) mode in Tailwind.
- Answer: It generates styles on-demand as you write your HTML, rather than generating the entire library upfront.
- How do you center a container in Tailwind?
- Answer: By using the container class combined with mx-auto.
- What are “Arbitrary Values” in Tailwind?
- Answer: Using square brackets to apply values not defined in the theme, like top-[117px].
- What is the difference between Tailwind and Bootstrap?
- Answer: Bootstrap provides pre-designed components; Tailwind provides low-level utility classes to build custom designs.
- How do you create a “Grid” in Tailwind?
- Answer: Using classes like
grid,grid-cols-3, andgap-4.
- Answer: Using classes like
- What is the
tailwind.config.jsfile used for?- Answer: To customize the theme, add plugins, or configure the “content” paths for the compiler.
- How do you apply a custom font size in Tailwind?
- Answer: Using classes like
text-xs,text-lg, ortext-[20px](arbitrary value).
- Answer: Using classes like
- What are “Modifiers” in Tailwind?
- Answer: Prefixes like
hover:,focus:, orlg:that change how a utility class behaves under certain conditions.
- Answer: Prefixes like
- How do you handle background images in Tailwind?
- Answer: Using
bg-[url('...')]or by defining a custom background in the config file.
- Answer: Using
- What is the purpose of the
groupclass?- Answer: It allows you to style child elements based on the state of a parent (e.g.,
group-hover:text-white).
- Answer: It allows you to style child elements based on the state of a parent (e.g.,
- How do you add transitions or animations in Tailwind?
- Answer: Using classes like
transition,duration-300, andease-in-out.
- Answer: Using classes like
- What is “Purging” in Tailwind?
- Answer: The process of removing unused CSS classes from the final production build to keep the file size small.
- How do you apply “Flex” properties in Tailwind?
- Answer: Using classes like
flex,flex-row,items-center, andjustify-between.
- Answer: Using classes like
- How do you handle dark mode in Tailwind?
- Answer: By using the dark: prefix on classes and enabling the dark mode strategy in the config file.
Scenario-Based Questions (Generic)
- Scenario: A website works perfectly on Chrome but has layout issues on Safari. How do you approach this?
- Answer: Check for vendor-specific CSS prefixes, verify if the CSS properties used are supported by Safari via “Can I Use,” and use cross-browser testing tools.
- Scenario: You are given a static image of a website and asked to code it. What are your first three steps?
- Answer: 1. Analyze the layout (Grid vs Flexbox); 2. Identify repeating components (Cards, Buttons); 3. Define the global color and typography system.
- Scenario: A user reports that a button on your site isn’t working. How do you find the error?
- Answer: Open Browser Console to check for JavaScript errors, inspect the element to see if it’s covered by another invisible layer, and check the network tab to see if a request is failing.
- Scenario: You need to build a page that must load extremely fast on slow 3G connections. What technical choices do you make?
- Answer: Optimize images (WebP format), use a lightweight CSS approach (Tailwind), minify JS files, and use semantic HTML to reduce DOM depth.