30 Interview Questions for HTML, CSS & JS

Interview questions for HTML, CSS & JS | Code Architects

These are general question asked in those topics. Here are few Interview Questions for HTML, CSS & JS. 🙌This blog on Frontend Developer Interview Questions will help you crack your next interview.

HTML | Interview Questions | Code Architects

Interview Questions – HTML

  1. What Is an Attribute in HTML?
    – HTML attributes provide additional information about HTML elements. Attributes are always specified in the start tag of element.
  2. What is Marquee in HTML?
    – An HTML marquee is a scrolling piece of text displayed either horizontally across or vertically down your webpage depending on the settings. This is created by using HTML <marquees> tag. <marquee> is a deprecated tag in HTML5.
  3. What is Doctype in HTML? What’s new in HTML?
    – All HTML documents must start with a declaration. The declaration is not an HTML tag. It is an “information” to the browser about what document type to expect. It is not case sensitive.
  4. What is Semantic HTML? and how does it work?
    – A semantic element describes its meaning to both the browser and the developer (i.e. Human & Machine readable). Using semantic tags instead of conventional <div> makes no change in the view of the Webpage.
    Read more about Semantic HTML here.
  5. How do you Display a Table on an HTML Webpage?
    – By using the <table> tag. I can create rows with <tr> & columns with <td>.
  6. What is SVG?
    <svg> is a container for SVG graphics. We can make use of drawing, element paths, boxes & circles.
    SVG is acronym for Scalable Vector Graphics.
  7. how do you separate a section of text?
    – Creating separate <p> tags for different sections. Or Make use of <br/> tag to separate text in the same paragraph.
  8. How do you Create Nested Web Pages in HTML?
    – By using <iframes>. It means Having a webpage inside a webpage.
  9. Differentiate Between Ordered List and Unordered List
    – Unordered list uses the <ul> tag while ordered list uses the <ol>.
CSS | Interview Questions | Code Arhictects

Interview Questions – CSS

  1. What is the best way to include CSS Styling in HTML?
    – There are 3 ways to include CSS in HTML. They are Inline, Internal & External styles. External Style is the best way to include CSS in HTML. With that the CSS file is stored in a separate file rather than in a HTML file.
  2. Difference between inline style & external style.
    – Inline style is used in the HTML style attribute to update the style of a single element.
    – Internal style is used in the HTML file. When the CSS is supposed to be for the only HTML file in which it is contained.
    – External style means a CSS file is imported in the HTML to use the styles. Using External styles we can import a single CSS style in multiple HTML pages.
  3. Mention the different types of CSS Selectors
    – Universal (*), type, class(.), id(#) selectors.
    Learn more about CSS Selectors.
  4. What are Preprocessors? Sass, Less, and Stylus?
    – A CSS preprocessor is a program that lets you generate CSS from the preprocessor’s own unique syntax. There are many CSS preprocessors to choose from, however most CSS preprocessors will add some features that don’t exist in pure CSS, such as mixin, nesting selector, inheritance selector etc.
  5. Explain Box Sizing Property
    The <strong>box-sizing</strong> CSS property sets how the total width and height of an element is calculated.
  6. What are the different ways to hide an Element using CSS? Difference between display: none, opacity: 0, visibility: hidden

    <strong>Display: none</strong> => The element is not visible on the website & does show take space in the UI. (Not clickable since not visible to click)
    <strong>Opacity: 0</strong> => The element is not visible on the webpage & It takes space on the website UI.
    <strong>visibility: hidden</strong> = >The element is not visible on the webpage & It takes space on the website UI. (Similar to opacity: 0).

    Both <strong>opacity: 0</strong> & <strong>visibility: hidden</strong> are clickable elements.
  7. What does ‘Important’ in CSS mean?
    The important property adds importance to a CSS property of a element. It overwrite all the applied properties by other method like inline style or through combinations of selectors.
  8. What are CSS Sprites?
    Image sprites are used in numerous web apps where multiple images are used. Rather than include each image as a separate image file, it is much more memory- and bandwidth-friendly to send them as a single image; using background position as a way to distinguish between individual images in the same image file, so the number of HTTP requests is reduced.

    We can use different image by positioning the image as background & background-position
  9. Which Property is used to Underline, Strikethrough, and Overline Text?
    <strong>text-decoration</strong> property is used for the underline, strikethrough &overline text.
  10. Explain Flex property.
    The Flexible Box Layout Module, makes it easier to design flexible responsive layout structure without using float or positioning. The flexbox is unidirectional(row-column). The default is flex-direction: row
  11. Explain Grid property.
    The CSS Grid Layout Module offers a grid-based layout system, with rows and columns, making it easier to design web pages without having to use floats and positioning. The grid can be used on 2 directions x & y.
  12. What is Media Queries?
    It uses the @media rule to include a block of CSS properties only if a certain condition is true. Mobile First means designing for mobile before designing for desktop or any other device (This will make the page display faster on smaller devices).
JavaScript | interview Questions | Code Arhitects

Interview Questions – JavaScript

  1. What are the various Data Types in JavaScript?
    Primitive:
    – Boolean
    – null
    – undefined
    – number
    – bigint
    – string
    – symbol
    Objects (collections of properties)
  2. What is Callback in JavaScript?
    A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
  3. What’s the difference between Function Declaration and Function Expression?
    Function Declaration
    function abc(){ return 5; }

    Function Expression
    var a = function abc(){ return }
  4. What is Hoisting in JavaScript? (I was asked in all interviews)
    JavaScript Hoisting refers to the process whereby the interpreter appears to move the declaration of functions, variables or classes to the top of their scope, prior to execution of the code.
    Hoisting allows functions to be safely used in code before they are declared.
  5. What do you understand about Cookies in JavaScript?
    Cookies are data, stored in small text files, on your computer. When a web server has sent a web page to a browser, the connection is shut down, and the server forgets everything about the user.
  6. What are Closures in JavaScript?
    closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment).
  7. What are Imports and Exports in JavaScript?
    The ES6 is a JavaScript standard. With the help of ES6, we can create modules in JavaScript. In a module, there can be classes, functions, variables, and objects as well. To make all these available in another file, we can use export and import. The export and import are the keywords used for exporting and importing one or more members in a module.

    Export: You can export a variable using the export keyword in front of that variable declaration. You can also export a function and a class by doing the same.
  8. What is the difference between Undefined, Undeclared, and Null in JavaScript?
    undefined is a variable that has been declared but no value exists and is a type of itself ‘undefined’.
    null is a value of a variable and is a type of object.
    undeclared variables is a variable that has been declared without ‘var’ keyword.
  9. What is the best way to remove Duplicates from a JavaScript Array?
    A Set is a collection of unique values. To remove duplicates from an array:
    First, convert an array of duplicates to a Set. The new Set will implicitly remove duplicate elements.
    Then, convert the set back to an array.

Thank you for reading the Interview Questions blog. We hope you succeed in the Interview you participate. All the best. ❣️ Follow us on Github.

Read our other blogs here

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

6 − six =