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
-
split()
-
document.clear()
-
join()
-
charAt()
D
Correct answer
Explanation
Among the options, charAt() is a standard string method that was supported in MSIE 3.x. It returns the character at a specified index in a string. Options A (split), B (document.clear), and C (join) were not supported in MSIE 3.x - these methods were added in later versions of JavaScript.
-
The duration of the browser session.
-
The duration the current document stays loaded.
-
Twenty-four hours from the time the cookie is set.
-
There is no default setting.
A
Correct answer
Explanation
By default, if the expires or max-age attribute is omitted from a cookie, it behaves as a session cookie. This means the cookie expires and is deleted when the user closes the browser session, making the first option correct.
-
<javascript>
-
<script>
-
<js>
-
<scripting>
B
Correct answer
Explanation
JavaScript code should be placed inside tags in HTML. Option A uses <javascript> which is not a valid HTML tag, options C and D use <js> and <scripting> which are also not valid standard tags for including JavaScript.
-
("Hello World")
-
document.write("Hello World")
-
response.write("Hello World")
-
"Hello World"
B
Correct answer
Explanation
To write text to a webpage in JavaScript, you use document.write() which outputs content to the document. Option A is just a string literal, option C uses response.write() which is server-side, and option D is just a string without writing it to the document.
-
<script type="text/javascript" name="javascript.js">
-
<script type="text/javascript" src="javascript.js">
-
<script type="text/javascript" href="javascript.js">
-
<script type="text/javascript" link="javascript.js">
B
Correct answer
Explanation
The correct HTML tag to include an external JavaScript file is `with thesrcattribute pointing to the script's URL. Attributes likehref,link, orname` are incorrect for linking scripts in HTML.
-
Both the <head> section and the <body> section are correct
-
The <body> section
-
The <head> section
-
The <JavaScript> section
A
Correct answer
Explanation
JavaScript can be inserted in both the section and the section of an HTML document. The section doesn't exist in HTML, and while both head and body work, the question asks for the correct place implying either is acceptable.
-
body {color: black}
-
body:color=black
-
{body:color=black(body}
-
{body;color:black}
A
Correct answer
Explanation
CSS uses selector {property: value} syntax, where the selector targets an HTML element and the declaration block in braces contains styles. Option A correctly shows 'body {color: black}' with proper selector, braces, and property-value colon separator. Option B incorrectly uses equals sign instead of colon, Option C misplaces braces outside the selector, and Option D uses semicolon instead of colon before the value.
-
background-color:
-
bgcolor:
-
color:
-
backgroundcolor:
A
Correct answer
Explanation
The background-color property sets an element's background color in CSS. bgcolor is an obsolete HTML attribute (not CSS), while color only changes text color, not the background. Option D is incorrect because CSS uses hyphens in multi-word properties, making it 'background-color' not 'backgroundcolor'.
-
all.h1 {background-color:#FFFFFF}
-
h1 {background-color:#FFFFFF}
-
h1.all {background-color:#FFFFFF}
-
h1.all {color:#FFFFFF}
B
Correct answer
Explanation
To style all elements of a type, use the element name directly as the selector without modifiers. 'h1 {background-color:#FFFFFF}' correctly targets all h1 elements. Options A and C incorrectly add '.all' which is not valid CSS syntax for targeting all elements of a type, and Option D changes the wrong property (color instead of background-color).
-
Inline
-
Embedded
-
Internal
-
External
-
Home Tool Markup Language
-
Hyperlinks and Text Marking Language
-
Hyper Text Markup Language
-
Hyperlinks and Text Markup Language
C
Correct answer
Explanation
HTML stands for Hyper Text Markup Language. 'HyperText' refers to links that connect pages, 'Markup' means tags that define elements, and 'Language' indicates it's a coding language. Options A, B, and D are incorrect expansions - HTML specifically uses 'Markup' not 'Marking' or 'Marking Language'.
-
<h6>
-
<head>
-
<heading>
-
<h1>
D
Correct answer
Explanation
HTML headings range from
(largest, most important) to (smallest, least important). is the correct tag for the largest heading. contains metadata, not content headings, and is not a valid HTML tag.
-
<body background="yellow">
-
<background>yellow</background>
-
<body style="background-color:yellow">
-
<body color="background-color:yellow">
C
Correct answer
Explanation
Modern HTML uses inline CSS with the style attribute to add background color: . Option A uses the obsolete 'background' attribute, which is deprecated. Option B uses a non-existent tag, and Option D has incorrect attribute syntax ('color' with a colon-separated value isn't valid HTML).
-
<input type="checkbox" />
-
<check>
-
<input type="check" />
-
<checkbox>
A
Correct answer
Explanation
HTML checkboxes are created using the input element with type="checkbox". Options B and D use non-existent HTML tags and , while option C uses type="check" which is not a valid input type. Option A is the only correct syntax.
-
<img>image.gif</img>
-
<image src="image.gif" />
-
<img src="image.gif" />
-
<img href="image.gif />
C
Correct answer
Explanation
Images in HTML are inserted using the self-closing img tag with the src attribute specifying the image path. Option A incorrectly uses closing tags, option B uses the non-existent tag, and option D uses 'href' instead of 'src'. Only option C uses the correct img tag syntax.