Create and save an HTML document MCQs Quiz | Class 10

This quiz for Class X Computer Applications (Code 165), Unit 2: HTML, focuses on creating and saving HTML documents. It covers essential topics such as using the `.html` file extension, best practices for file naming, and understanding basic character encoding. Test your knowledge on how to properly set up your HTML files and download a PDF of your answers for revision.

Understanding HTML Document Creation and Saving

Creating and properly saving an HTML document is the foundational step in web development. An HTML file is essentially a plain text file containing markup that web browsers interpret to display web pages. Understanding the correct procedures ensures your web pages are accessible and function as intended.

The Importance of the .html Extension

Every HTML file must be saved with either a .html or .htm file extension. While both work, .html is the more common and recommended standard today. This extension tells the operating system and, more importantly, web browsers (like Chrome, Firefox, Edge) that the file is an HTML document. Without it, browsers might treat the file as plain text, display its raw code, or prompt you to download it instead of rendering it as a web page.

Best Practices for File Naming

Proper file naming is crucial for organization, maintainability, and search engine optimization (SEO). Here are some key guidelines:

  • Lowercase Letters: Always use lowercase letters for filenames. Web servers can be case-sensitive (especially on Linux-based systems), so `MyPage.html` and `mypage.html` can be treated as two different files.
  • No Spaces: Avoid spaces in filenames. Spaces are often replaced by `%20` in URLs, which makes them less readable and can sometimes lead to issues. Use hyphens (-) or underscores (_) instead. Hyphens are generally preferred for readability and SEO.
  • Keep it Concise and Descriptive: Choose names that clearly indicate the content of the page, but avoid making them excessively long.
  • Avoid Special Characters: Steer clear of characters like `!, @, #, $, %, ^, &, *, (, ), +, =, { }` etc. These can cause problems with file systems or web servers. Stick to alphanumeric characters, hyphens, and underscores.
  • Start with a Letter: While not strictly enforced, starting filenames with a letter is a good convention.
Good Filename Examples Bad Filename Examples
index.html Index.html (Capital letter)
about-us.html about us.html (Space)
products_list.html products&list.html (Special character)

Understanding Character Encoding Basics (UTF-8)

Character encoding specifies how characters are represented in bytes. For web pages, specifying the correct character encoding is vital to ensure text displays correctly across different browsers and devices. The most widely recommended and used encoding for modern web pages is UTF-8.

  • UTF-8: It is a variable-width character encoding that can encode almost all characters and symbols in the world. It is backward-compatible with ASCII and is the default encoding for HTML5.
  • ASCII: An older, limited encoding that only represents English letters, numbers, and basic symbols.
  • Specifying Encoding: You declare the character encoding in your HTML document using the <meta> tag within the <head> section: <meta charset="UTF-8">. This informs the browser how to interpret the bytes of your document into visible characters.

Without proper encoding specified, characters might appear as “mojibake” (garbled text), especially for non-English characters or special symbols.

Quick Revision Points

  • HTML files should always end with .html (or .htm).
  • Use plain text editors (Notepad, VS Code, Sublime Text) to write HTML.
  • Filenames should be lowercase, use hyphens or underscores instead of spaces, and avoid special characters.
  • Specify character encoding as UTF-8 using <meta charset="UTF-8"> inside the <head> tag.
  • Proper saving and naming are key for browser recognition and website organization.

Practice Questions

  1. Which tag is used to specify the character encoding in an HTML document?
  2. What is the recommended substitute for a space in an HTML filename?
  3. Name two common plain text editors used for writing HTML.
  4. If an HTML file is saved without the .html extension, how might a browser typically handle it?
  5. Why is it important to use lowercase letters in HTML filenames?

Author

  • CBSE Quiz Editorial Team

    Content created and reviewed by the CBSE Quiz Editorial Team based on the latest NCERT textbooks and CBSE syllabus. Our goal is to help students practice concepts clearly, confidently, and exam-ready through well-structured MCQs and revision content.