HTML Basics Quiz
8 Questions
5 Views

HTML Basics Quiz

Created by
@EnergyEfficientHedgehog

Questions and Answers

What is the primary purpose of the 'head' element in an HTML document?

  • To define the structure of a table
  • To include scripts and styles
  • To provide meta-information about the document (correct)
  • To contain the main content of the web page
  • Which JavaScript keyword is used to declare a variable that cannot be redeclared in the same scope?

  • dynamic
  • var
  • const
  • let (correct)
  • In HTML, which tag is used to define an ordered list?

  • <ol> (correct)
  • <list>
  • <items>
  • <ul>
  • Which of the following is NOT a primitive data type in JavaScript?

    <p>object</p> Signup and view all the answers

    What is the purpose of the 'src' attribute in an HTML tag?

    <p>To define the image's source URL</p> Signup and view all the answers

    Which JavaScript method is used to access an element by its ID?

    <p>getElementById()</p> Signup and view all the answers

    Which of the following describes a 'function-scoped' variable in JavaScript?

    <p>It is accessible only within the function it is declared in</p> Signup and view all the answers

    Which of the following elements is considered a semantic HTML5 element?

    <section> Signup and view all the answers

    Study Notes

    HTML Basics

    • Definition: HyperText Markup Language; standard markup language for creating web pages.

    • Structure:

      • Doctype Declaration: <!DOCTYPE html> - defines document type.
      • HTML Element: <html> - root element.
      • Head Element: <head> - contains meta-information (e.g., <title>, <meta>, <link>, <script>).
      • Body Element: <body> - contains content of the web page (text, images, etc.).
    • Common Tags:

      • Headings: <h1> to <h6> - define headings.
      • Paragraph: <p> - defines a paragraph.
      • Links: <a href="URL">Link Text</a> - creates hyperlinks.
      • Images: <img src="URL" alt="description"> - embeds images.
      • Lists:
        • Unordered: <ul><li></li></ul>
        • Ordered: <ol><li></li></ol>
      • Tables: <table><tr><td></td></tr></table> - defines tables.
    • Attributes: Provide additional information about elements, e.g., id, class, style, src.

    • Forms:

      • <form> element for user input; includes <input>, <textarea>, <button>, etc.
    • Semantic HTML: Use of HTML5 elements like <article>, <section>, <footer>, <header> to improve readability and accessibility.

    JavaScript Fundamentals

    • Definition: A high-level, dynamic, untyped programming language primarily used for enhancing web pages.

    • Basic Syntax:

      • Variables: Declared using var, let, or const.
        • var - function-scoped, can be redeclared.
        • let - block-scoped, cannot be redeclared in the same scope.
        • const - block-scoped, cannot be reassigned.
    • Data Types:

      • Primitive: string, number, boolean, null, undefined, symbol.
      • Objects: Collections of values and more complex entities.
    • Operators:

      • Arithmetic: +, -, *, /, %
      • Comparison: ===, !==, >, <, >=, <=
      • Logical: &&, ||, !
    • Control Structures:

      • Conditional Statements: if, else if, else, switch.
      • Loops: for, while, do...while.
    • Functions:

      • Declaration: function name() { }
      • Expression: const name = function() { }
      • Arrow Functions: const name = () => { }
    • DOM Manipulation:

      • Accessing elements: document.getElementById(), document.querySelector().
      • Modifying content: element.innerHTML, element.style.
      • Event Handling: element.addEventListener('event', function).
    • JSON: JavaScript Object Notation; a format for structuring data as key-value pairs, often used for API responses.

    • ES6 Features:

      • Template literals: `string`
      • Destructuring: const { key } = object;
      • Modules: import and export statements.

    HTML Basics

    • HyperText Markup Language (HTML) is the standard markup language for creating web pages.
    • The document begins with a Doctype Declaration (<!DOCTYPE html>), which defines the document type.
    • The root element of an HTML document is encapsulated within <html> tags.
    • The <head> element contains meta-information such as page title (<title>), character set (<meta charset>), and stylesheets (<link>).
    • The <body> element holds the content visible on the web page, including text, images, and other media.
    • Headings are defined using tags from <h1> to <h6>, where <h1> represents the highest importance.
    • The <p> tag defines a paragraph of text.
    • Hyperlinks are created with the <a> tag, utilizing the href attribute for the link destination.
    • Images can be embedded using the <img> tag, requiring the src attribute for the image source.
    • Lists can be unordered using <ul> or ordered using <ol>, with list items defined by <li>.
    • Tables are defined using the <table> tag, which includes rows (<tr>) and cells (<td> and <th>).
    • Attributes such as id, class, style, and src provide additional context and information about elements.
    • Forms for user input utilize the <form> element, incorporating various controls like <input>, <select>, and <textarea>.
    • Semantic HTML enhances readability and accessibility through elements like <header>, <footer>, <article>, and <section>.

    JavaScript Fundamentals

    • JavaScript is a high-level, dynamic programming language used primarily for enhancing interactivity in web pages.
    • Basic syntax involves variable declarations using var, let, or const, each with distinct scoping rules.
    • var is function-scoped and can be redeclared, while let and const are block-scoped, with const not allowing reassignment.
    • JavaScript has several primitive data types: string, number, boolean, null, undefined, and symbol, along with objects that involve collections of values.
    • Arithmetic operators include +, -, *, /, and %, while comparison operators are ===, !==, >, <, >=, and <=.
    • DOM manipulation enables dynamic changes to the web page by accessing elements with document.getElementById() or document.querySelector().
    • Content can be modified using element.innerHTML or element.style, and event handling can be done with element.addEventListener('event', function).
    • JSON (JavaScript Object Notation) is a format for structuring data in key-value pairs, widely used for API responses.
    • ES6 features include template literals for string interpolation (``string``), destructuring assignment (const { key } = object;), and module system using import and export statements.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Description

    Test your knowledge on the fundamentals of HyperText Markup Language (HTML) with this quiz. Explore key concepts such as document structure, common tags, and HTML elements. Perfect for beginners and web development enthusiasts.

    More Quizzes Like This

    HTML Elements Basics
    28 questions

    HTML Elements Basics

    AstoundedBamboo8130 avatar
    AstoundedBamboo8130
    HTML Syntax Basics
    16 questions

    HTML Syntax Basics

    FirmerJudgment697 avatar
    FirmerJudgment697
    Introduction to HTML
    10 questions

    Introduction to HTML

    IndividualizedBlueLaceAgate4709 avatar
    IndividualizedBlueLaceAgate4709
    Introduction to HTML
    8 questions

    Introduction to HTML

    LuxuriantCarnelian4523 avatar
    LuxuriantCarnelian4523
    Use Quizgecko on...
    Browser
    Browser