Computer Knowledge

Markup and Web Languages

1,492 Questions

Test your understanding of HTML tags, XML structures, and web page creation technologies. The questions cover elements like CSS styling, parsing documents, and defining web attributes. This section is essential for candidates appearing for computer proficiency tests in various competitive exams.

HTML tags and attributesXML document parsingCSS styling levelsWeb page creation basicsBrowser compatibility

Markup and Web Languages Questions

Multiple choice xhtml
  1. Strict, Transitional, Loose, Frameset

  2. Strict, Transitional, Frameset

  3. Strict, Transitional, Loose

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

XHTML 1.0 defines three Document Type Definitions (DTDs): Strict (no deprecated elements), Transitional (allows deprecated elements for compatibility), and Frameset (for documents with frames). 'Loose' is not a valid DTD type in XHTML.

Multiple choice xhtml
  1. Loose

  2. Normal

  3. Transitional

  4. Frameset

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The Transitional DTD is the most commonly used because it supports deprecated HTML elements and attributes while still enforcing XHTML's stricter syntax rules. This provides a migration path from HTML to XHTML without requiring immediate cleanup of legacy markup.

Multiple choice xhtml
  1. Yes

  2. No

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Yes - all XHTML documents must include a DOCTYPE declaration to be valid. The DOCTYPE tells the validator and browser which DTD to use for validation and rendering. Without it, the document is not valid XHTML.

Multiple choice xhtml
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

XHTML is case-sensitive and requires all element and attribute names to be in lowercase. This is different from HTML, which is case-insensitive. Writing

or

would make an XHTML document invalid.

Multiple choice xml
  1. eXtensible Markup Language

  2. X-Markup Language

  3. Example Markup Language

  4. eXtra Modern Link

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

XML stands for eXtensible Markup Language. The 'extensible' means you can define your own custom tags and elements, unlike HTML which has a predefined set of tags. This flexibility is why XML became foundational for many technologies including XHTML, RSS, and more.

Multiple choice xml
  1. 1-2-4_6

  2. :3:-3:5:-7

  3. ;123456

  4. 3:4;-7

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

XML names have strict rules: must start with a letter or underscore, can contain letters, digits, hyphens, underscores, and periods. Option A starts with a number (invalid). Option C starts with semicolon (invalid). Option D contains semicolon and dash after colon. Option B (:3:-3:5:-7) starts with a colon, which is technically allowed as it represents a namespace prefix - though unusual without a namespace declaration, it follows XML name rules.

Multiple choice xml
  1. Elements may nest but not overlap

  2. Quoting attributes is optional

  3. Elements may have multiple attributes with the same name

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In XML, elements must be properly nested, meaning a child element must be closed before its parent element is closed; they cannot overlap. Unlike HTML, quoting attributes is mandatory in XML, and elements cannot have multiple attributes with the same name.

Multiple choice xml
  1. <?xml version="1.0" />

  2. <?xml version="1.0"?>

  3. <xml version="1.0" />

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

XML declarations are processing instructions that must start with and end with `?&gt;`. The correct syntax is where the xml keyword is followed by the version attribute. Option A incorrectly closes with /&gt; (processing instructions don't use self-closing tags), and Option C uses element tags `` instead of processing instruction syntax.

Multiple choice xml
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

An XML document is required to be well-formed to be parsed, but it does not strictly have to be valid. Validity requires conformance to an external schema or DTD, whereas well-formedness only requires correct syntactic structure.

Multiple choice xml
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Every XML document must be well-formed, which means it must follow XML syntax rules: proper nesting of elements, correct attribute quoting, single root element, and proper closing of all tags. This is a fundamental requirement for any document to be processed by an XML parser.

Multiple choice xml
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

XML documents do NOT require an associated DTD or schema. While DTDs and schemas can be used to define document structure and validate content, they are optional. Many XML documents are well-formed without any schema definition. The requirement is for well-formedness, not validity.

Multiple choice xml
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

XML preserves whitespace in element content by default, unlike HTML which collapses multiple spaces. This means spaces, tabs, and newlines within elements are maintained as part of the document's character data. The xml:space attribute can further control whitespace handling in specific elements.

Multiple choice xml
  1. <![CDATA[ Text to be ignored ]]>

  2. <xml:CDATA[ Text to be ignored ]>

  3. <PCDATA> Text to be ignored </PCDATA>

  4. <CDATA> Text to be ignored </CDATA>

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

CDATA (Character Data) sections use the syntax `to tell the XML parser to treat the enclosed content as literal text, ignoring any special characters like<,>, or&that would normally be interpreted as markup. The other options either use incorrect prefixes (xml:), wrong element names (PCDATA), or missing the required![` sequence.

Multiple choice xml
  1. <stylesheet type="text/xsl" href="style.xsl" />

  2. <link type="text/xsl" href="style.xsl" />

  3. <?xml-stylesheet type="text/xsl" href="style.xsl" ?>

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Stylesheets are referenced using the processing instruction with attributes for `type` and `href`. Options A and B use incorrect element-based syntax ( and ``) which are not valid for associating XSL stylesheets with XML documents. The processing instruction must appear in the XML prolog.