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
-
Strict, Transitional, Loose, Frameset
-
Strict, Transitional, Frameset
-
Strict, Transitional, Loose
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.
-
Loose
-
Normal
-
Transitional
-
Frameset
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.
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.
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.
-
eXtensible Markup Language
-
X-Markup Language
-
Example Markup Language
-
eXtra Modern Link
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.
-
1-2-4_6
-
:3:-3:5:-7
-
;123456
-
3:4;-7
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.
-
Elements may nest but not overlap
-
Quoting attributes is optional
-
Elements may have multiple attributes with the same name
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.
-
<?xml version="1.0" />
-
<?xml version="1.0"?>
-
<xml version="1.0" />
B
Correct answer
Explanation
XML declarations are processing instructions that must start with and end with `?>`. The correct syntax is where the xml keyword is followed by the version attribute. Option A incorrectly closes with /> (processing instructions don't use self-closing tags), and Option C uses element tags `` instead of processing instruction syntax.
-
<name></name
-
<name />
-
<name/>
-
All of the above
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.
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.
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.
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.
-
<![CDATA[ Text to be ignored ]]>
-
<xml:CDATA[ Text to be ignored ]>
-
<PCDATA> Text to be ignored </PCDATA>
-
<CDATA> Text to be ignored </CDATA>
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.
-
<stylesheet type="text/xsl" href="style.xsl" />
-
<link type="text/xsl" href="style.xsl" />
-
<?xml-stylesheet type="text/xsl" href="style.xsl" ?>
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.