Crio Interview Questions - by own
Crio Interview Questions - by own
Questions
1. How does the browser loads HTML and JS files upon visiting a particular website?
2. What is the purpose of the 'doctype' declaration in HTML documents?
3. What are the differences between block elements, inline elements and inline-block
elements?
4. What are the differences between HTML and HTML5?
5. What are the differences between semantic and non-semantic HTML tags?
6. Explain CSS selectors and their types
7. What is CSS selector specificity and how does it work?
8. What is CSS Box Model?
9. What is the difference between absolute and relative length units in CSS? Provide
examples.
10. What is CSS Flexbox?
11. What is responsive web design?
12. What are the differences between CSS Grids and Flexbox?
13. What is Bootstrap?
14. What are the different CSS position property values?
15. What is z-index in CSS?
Chatgpt Answers
1. How does the browser load HTML and JS files upon visiting a particular website?
When you visit a website, the browser follows these steps to load HTML and JavaScript files:
1. DNS Resolution: The browser first resolves the domain name into an IP address
using the Domain Name System (DNS).
2. Sending HTTP Request: The browser sends an HTTP request to the server where
the website is hosted.
3. Server Response: The server responds by sending the requested HTML document
(and any associated assets like CSS, JavaScript, images, etc.).
4. Parsing HTML: The browser begins parsing the HTML document and constructing
the DOM (Document Object Model) tree.
5. Fetching External Resources:
○ The browser identifies external resources like CSS and JavaScript files
(linked with <link> or <script> tags).
○ It sends additional HTTP requests to fetch those resources.
○ JavaScript files are executed in the order they appear (unless async or
defer attributes are used).
6. Applying Styles: The browser parses CSS files and applies styles to the DOM
elements.
7. Rendering: After the HTML and CSS are parsed and styles are applied, the browser
renders the page on the screen.
8. Execution of JS: JavaScript files can manipulate the DOM and CSSOM to update
the content and style dynamically (e.g., user interactions, animations, etc.).
2. What is the purpose of the 'doctype' declaration in HTML documents?
The <!DOCTYPE> declaration tells the browser which version of HTML the document is
written in, ensuring that the page is rendered correctly.
● In modern web development, <!DOCTYPE html> is used to declare the document
type as HTML5, instructing the browser to render the document in standards mode.
● Without a doctype declaration, browsers may switch to quirks mode, which can lead
to inconsistent rendering across different browsers.
3. What are the differences between block elements, inline elements, and inline-block
elements?
● Block Elements:
○ Occupy the entire width of their parent container.
○ Always start on a new line (they are stacked vertically).
○ Examples: <div>, <p>, <h1>, <ul>.
● Inline Elements:
○ Do not start on a new line and only occupy the width necessary for their
content.
○ They can be placed inside block elements and other inline elements.
○ Examples: <span>, <a>, <strong>, <em>.
● Inline-block Elements:
○ Behave like inline elements (do not start on a new line), but they can have set
widths and heights like block elements.
○ Examples: <button>, <img>, <input>.
5. What are the differences between semantic and non-semantic HTML tags?
● Semantic HTML Tags:
○ These tags describe the meaning of the content enclosed within them,
providing context for both developers and search engines.
○ Examples: <article>, <section>, <header>, <footer>, <nav>,
<main>.
○ They improve accessibility and SEO (Search Engine Optimization).
● Non-Semantic HTML Tags:
○ These tags do not convey any meaning about their content; they are used
mainly for structuring or styling the page.
○ Examples: <div>, <span>.
○ These elements require additional context or class names to define their
purpose.
9. What is the difference between absolute and relative length units in CSS? Provide
examples.
● Absolute Length Units: Fixed units that are not affected by any other factors (e.g.,
screen size, parent elements).
12. What are the differences between CSS Grids and Flexbox?
Both CSS Grid and CSS Flexbox are powerful layout systems, but they serve different
purposes and are used in different scenarios:
● CSS Grid:
In this example, .overlay will be stacked above the first div because its z-index is
higher.