Computer Knowledge
Markup and Web Languages
1,701 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
-
It should be easy to write programs that process XML documents
-
Optional features should be kept to a minimum, ideally zero
-
XML documents should be human legible and reasonably clear
-
None
-
Optional but makes a document more portable
-
Highly discouraged by W3C standards
-
Recommended for HTML programming only
-
None
-
<style>
-
<css>
-
<script>
-
None of the above
A
Correct answer
Explanation
The tag is used to define an internal style sheet in HTML. It is placed within the <head> section and contains CSS rules. There is no <css> tag in HTML - <script> is for JavaScript, not styles.
A
Correct answer
Explanation
The correct answer is A. "style" is the HTML attribute used to define inline styles. This attribute is applied directly to the HTML element and allows you to specify CSS styles for that particular element.
Let's go through the other options and explain why they are incorrect:
B. "font": This attribute is not used to define inline styles. It was commonly used in older versions of HTML to specify font-related styles, but it is now considered deprecated and should be avoided.
C. "class": The "class" attribute is used to define a class for an HTML element, which can be used to apply styles defined in CSS. However, it is not specifically used for defining inline styles.
D. "styles": This is not a valid HTML attribute. The correct attribute is "style".
So, the correct answer is A. "style".
-
body {color: black}
-
{body;color:black}
-
{body:color=black(body}
-
body:color=black
A
Correct answer
Explanation
CSS syntax uses: selector { property: value; }. The selector (body) is followed by curly braces containing property-value pairs separated by colons. Option A shows this correctly. Option B reverses the order, Option C uses invalid syntax, and Option D uses a colon incorrectly.
-
h1 {background-color:#FFFFFF}
-
all.h1 {background-color:#FFFFFF}
-
h1.all {background-color:#FFFFFF}
-
None of the above
A
Correct answer
Explanation
CSS uses element selectors directly followed by property declarations in curly braces. The background-color property sets the background color, and #FFFFFF represents white in hex color notation. Options B and C use incorrect selector syntax with 'all' keyword.
-
<p style="text-size:bold">
-
p {font-weight:bold}
-
<p style="font-size:bold">
-
p {text-size:bold}
B
Correct answer
Explanation
The font-weight property controls text boldness in CSS. Option B uses correct CSS syntax: 'p' selector with font-weight:bold property declaration. Options A and C incorrectly mix inline style syntax with wrong property names.
B
Correct answer
Explanation
Padding creates space between an element's content and its border, and CSS does not allow negative padding values. Unlike margins, negative padding would push content outside the element's border, which violates the box model concept.
B
Correct answer
Explanation
The C# compiler switch /doc extracts XML documentation comments (///) from source code and generates an XML documentation file. Options /text, /xml, and /help are not valid compiler switches for this purpose. The /doc switch is commonly used for generating API documentation.
-
<style src="mystyle.css">
-
<stylesheet>mystyle.css</stylesheet>
-
<link rel="stylesheet" type="text/css" href="mystyle.css">
-
None of the above
C
Correct answer
Explanation
The correct HTML syntax for linking an external style sheet is using the element with rel='stylesheet', type='text/css', and href pointing to the CSS file. The element is for internal styles, not external linking. Option C shows the standard, W3C-recommended syntax that works across all browsers.
-
<style>
-
<script>
-
<css>
-
None of the above
A
Correct answer
Explanation
The element is used to embed CSS rules directly within an HTML document. It's placed in the <head> section and contains CSS code between opening and closing tags. The <script> tag is for JavaScript, not CSS.
C
Correct answer
Explanation
The style attribute allows you to apply CSS directly to individual HTML elements. It's written as style="property: value;" and takes precedence over external or internal styles. The class attribute references external classes, while font is not a valid style attribute.
-
{body;color:black}
-
{body:color=black(body}
-
body {color: black}
-
body:color=black
C
Correct answer
Explanation
CSS syntax requires a selector, followed by curly braces containing property-value pairs separated by colons. Each declaration ends with a semicolon. Option C shows correct syntax: body {color: black;} where body is the selector and color: black is the declaration.
-
The type of tag used
-
The version of the markup language that the source uses
-
The document type declaration
-
None
C
Correct answer
Explanation
The document type declaration (DOCTYPE) informs the parser or markup processor about the specific rules and DTD/schema to use when interpreting the document's tags. While the language version is related, it is the DOCTYPE declaration itself that explicitly instructs the processor. Tag types alone do not define interpretation rules.
-
LANGUAGE tag
-
Document type definition
-
TYPE tag
-
Document tag
B
Correct answer
Explanation
A Document Type Definition (DTD) tells markup language processors which rules to use to interpret a document. DTDs define the structure, elements, and attributes allowed in a document, providing the validation rules. LANGUAGE and TYPE tags are not standard markup concepts.