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
-
<body style="background-color:yellow">
-
<background>yellow</background>
-
<body background="yellow">
-
<body backcolor=”yellow“>
A
Correct answer
Explanation
Inline CSS is the modern way to set a background color, using `. The other forms are deprecated (background` attribute) or nonsensical tags, making the stored answer the correct one.
A
Correct answer
Explanation
The tag is the correct HTML element for making text bold. While CSS font-weight is preferred for styling, remains valid. , , and are not valid HTML elements.
B
Correct answer
Explanation
The tag is the correct HTML element for italicized text. Though CSS font-style is preferred for styling, remains valid. , , and are not valid HTML elements.
-
<table><head><tfoot>
-
<thead><body><tr>
-
<table><tr><tt>
-
<table><tr><td>
D
Correct answer
Explanation
A complete structure includes the table element itself, a row (), and a cell (). The option provides exactly those tags, while the other choices contain non‑table elements or malformed tags.
-
<img src="background.gif" background />
-
<body background="background.gif">
-
<background img="background.gif">
-
<back-image img="background.gif">
B
Correct answer
Explanation
The background attribute on the element sets a page background image in traditional HTML. Modern practice uses CSS, but this syntax remains valid. and are not real HTML elements.
-
<img src="image.gif" />
-
<image src="image.gif" />
-
<img>image.gif</img>
-
<img href="image.gif />
A
Correct answer
Explanation
The
tag with src attribute is the correct syntax for images. It is a self-closing element ending with /> in XHTML. is not valid, the path goes in src not href, and
does not wrap content.
-
<input type="text" />
-
<textinput type="text" />
-
<input type="textfield" />
-
<textfield>
A
Correct answer
Explanation
The element with type='text' creates a single-line text input field. The type value must be 'text', not 'textfield'. and are not valid HTML elements.
-
Alphabetical order
-
Random. No order.
-
Argument-declaration order
-
Based on the datatype
C
Correct answer
Explanation
Javadoc @param tags should follow the same order as parameters appear in the method or constructor declaration. This convention ensures documentation consistency with the actual code signature, making it easier for developers to correlate documentation with implementation.
-
@param
-
@throws
-
@see
-
@author
-
@exception
-
@throwing
-
@threw
-
@except
A
Correct answer
Explanation
The @exception tag is a complete synonym for @throws in Javadoc. Both tags serve the identical purpose of documenting exceptions that a method may throw, and Javadoc treats them identically. The @throws tag is more commonly used in modern practice.
-
@since
-
@dontUse
-
@deprecated
-
@thows
C
Correct answer
Explanation
The @deprecated tag is used to mark APIs as obsolete and indicates they should no longer be used. When an API is deprecated, the tag typically includes a comment recommending the replacement API or method that developers should use instead.
-
<script>
-
<scripting>
-
<js>
-
<javascript>
A
Correct answer
Explanation
JavaScript code must be placed inside the element in HTML. This is the standard HTML tag defined for embedding or referencing JavaScript code. Tags like <scripting>, <js>, or <javascript> are not valid HTML elements.
-
response.write("Hello World")
-
"Hello World"
-
document.write("Hello World")
-
("Hello World")
C
Correct answer
Explanation
The correct JavaScript syntax to output text is document.write("Hello World"). The document object's write() method outputs text to the HTML document. Response.write() is ASP syntax, and just writing the string or parentheses alone are not valid JavaScript.
-
The <body> section
-
Both the <head> section and the <body> section are correct
-
The <head> section
-
None of the above
B
Correct answer
Explanation
JavaScript can be placed in either the or section. While placing scripts at the end of the body is often recommended for performance, both locations are technically valid. The section is useful for functions that should be loaded before the page content.
-
<script src="xxx.js">
-
<script name="xxx.js">
-
<script href="xxx.js">
-
<script id="xxx.js">
A
Correct answer
Explanation
The HTML `tag uses thesrc(source) attribute to link external JavaScript files like "xxx.js". Usinghrefis incorrect because it is reserved for stylesheets and links, whilenameandid` are used for identifying elements, not loading external files.