HTML Put Question Bank
HTML Put Question Bank
1. What is HTML?
a) HTML describes the structure of a webpage
b) HTML is the standard markup language mainly used to create web pages
c) HTML consists of a set of elements that helps the browser how to view the content
d) All of the mentioned
View Answer
Answer: d
Explanation: HTML is the standard markup language mainly used to create web pages. HTML
describes the structure and layout of a webpage. HTML consists of a series of elements that helps
the browser how to display content easily.
Answer: b
Explanation: Timothy John Berners-Lee (TimBL) is known as the father of HTML. He is a British
computer scientist, best known as the inventor of the World Wide Web.
Answer: a
Explanation: HTML stands for “HyperText Markup Language”. HTML is the standard markup language
mainly used to design and create web pages and web applications.
Answer: d
Explanation: The correct syntax of HTML5 doctype is <!doctype html>, doctype is the very first thing
to write in HTML5. <!doctype html> or <!DOCTYPE HTML> both are same because ‘doctype’ keyword
is not case sensitive.
5. Which of the following is used to read an HTML page and render it?
a) Web server
b) Web network
c) Web browser
d) Web matrix
View Answer
Answer: c
Explanation: A web browser (commonly referred to as a browser) is a software application for
retrieving, presenting and traversing information resources on the World Wide Web. A web server
process, store and display output to the client as per their request. Web matrix is a discontinued
cloud-connected website builder and HTML editor for Windows.
advertisement
Answer: a
Explanation: HTML is case insensitive while XHTML is case sensitive. In XHTML, special characters can
be escaped using character entites but not in HTML. Charset in HTML is “text/html” where as it is
“application/xml+xhtml” for XHTML.
7. Which of the following tag is used for inserting the largest heading in HTML?
a) head
b) <h1>
c) <h6>
d) heading
View Answer
Answer: b
Explanation: Headings in HTML starts from <h1> to <h6> in which <h1> heading is the largest one
and <h6> is smallest one among those. The heading tags are <h1> <h2> <h3> <h4> <h5> and <h6>
that are used for the creations of headings.
8. What is DOM in HTML?
a) Language dependent application programming
b) Hierarchy of objects in ASP.NET
c) Application programming interface
d) Convention for representing and interacting with objects in html documents
View Answer
Answer: d
Explanation: The Document Object Model is a cross-platform and language-independent application
programming interface that treats an HTML, XHTML, or XML document as a tree structure. A
document can be viewed as a logical tree with help of DOM Model.
9. In which part of the HTML metadata is contained?
a) head tag
b) title tag
c) html tag
d) body tag
View Answer
Answer: a
Explanation: Metadata is information about data. The meta tag provides metadata/meta information
about the HTML document. Metadata will not be displayed on the page. Metadata is present in
head. The body tag defines document’s body. A title tag is an HTML element which specifies the title
of a web page.
Answer: b
Explanation: The <mark> element is used to highlight a section of text. It is useful for quoting a text
or if one wants to bring attention to the text. The <b> tag is used to make text/paragraph bold. <u>
tag is used to underline the text you wanted.
Answer: c
Explanation: <video> tag is used to display video clips in HTML5. Multiple media resources for media
elements is specified by <source> tag. Text track for media elements i.e. <audio> & <video> is
provided by <track> tag in HTML5. There is no such thing as slider tag in HTML5.
Answer: b
Explanation: Browser ignores comment in a code. There are always two types of command i.e. single
line command and multiple line command. If one wants to add a comment in code, add the text
between these characters <!…..comment….>. It will not visible in the user’s browser.
13. Which of the following elements in HTML5 defines video or movie content?
a) <video>
b) <movie>
c) <audio>
d) <media>
View Answer
Answer: a
Explanation: The media to which linked document is optimized is given by <media> tag. Before
HTML5, videos could only be played with a plug-in (like flash). The HTML5 video element specifies a
standard way to embed a video in a webpage. As like <video> elements, <audio> element contains
additional files or streams like music, recording, etc.
14. Which of the following is not the element associated with the HTML table layout?
a) alignment
b) color
c) size
d) spanning
View Answer
Answer: b
Explanation: There are three elements in HTML table layout i.e. size, spanning and alignment. Layout
type can be achieved by setting Rows elements layout attribute to Fixed or Auto. Auto attribute relies
on browser compatibility whereas fixed layout relies on developer specification.
15. Which element is used for or styling HTML5 layout?
a) CSS
b) jQuery
c) JavaScript
d) PHP
View Answer
Answer: a
Explanation: For styling HTML5, CSS i.e Cascading Style Sheet is used. It is style sheet language and
designed to describe presentation of its content including layouts, colors and fonts. CSS can control
the layout of multiple webpages.
16. Which HTML tag is used for making character appearance bold?
a) <u>content</u>
b) <b>content</b>
c) <br>content</br>
d) <i>content</i>
View Answer
Answer: b
Explanation: By enclosing words in the tags <b>and</b> we can make characters appear bold. <i>
element is for content in italics, <u> is for underlined content, <br> is for vertical breaking.
Answer: c
Explanation: In HTML, <img> tag is used to insert an image in HTML page. Image tag has two
attributes (src and Alt).
–> Src attribute is used to specify the image path.
–> Alt attribute is used to specify the alternate text for the image.
Answer: b
Explanation: HTML is a subset of SGML. SGML (Standard Generalized Markup Language) is a standard
for specifying a document markup language or tag set.
20. Which of the following HTML code will make an image clickable?
a)
b)
<img src="https://www.sanfoundry.com/sanfoundry-logo">
</img>
c)
d)
Answer: d
Explanation: <a> tag defines a hyperlink, which is used to link from one page to another page.
Suppose if we want an image to be clickable then it should go inside <a> Tag.
Answer: a
Explanation: <p> tag is used for paragraph in HTML.
22. In HTML, which attribute is used to create a link that opens in a new window tab?
a) src=”_blank”
b) alt=”_blank”
c) target=”_self”
d) target=”_blank”
View Answer
Answer: d
Explanation: Add the target=”_blank” attribute in the Anchor tag. target=”_blank” attribute makes a
link open in a new window tab.
Answer: c
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in
italic. A section which is quoted from another source is specified by <blockquote>. The <abbr>
defines abbreviation. We used <q> element for shorter quote. Browser put quote around <q>
element.
Disc
Circle
Square
None
Answer: a
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in
italic. We used <q> element for shorter quote. Browser put quote around <q> element. A section
which is quoted from another source is specified by <blockquote>. For using, abbreviation or
acronym <abbr> element is helpful. A title element is to be used with abbr.
26. Which of the following HTML tag is used to add a row in a table?
a) <th>
b) <td>
c) <tr>
d) <tt>
View Answer
Answer: c
Explanation: In HTML, <tr> tag is used to create a row in the table. <th> tag is used to set the header
cell of a table.
Answer: d
Explanation: The contact details for author of a page is specified by <address> attribute. The content
is often displayed in italics,
e.g.
<address>
<a href="mailto:[email protected]">Sanfoundry</a>
</address>
Output:
Sanfoundry
28. Which of the following tag is used to create a text area in HTML Form?
a) <textarea> </textarea>
b) <text></text>
c) <input type=”text” />
d) <input type=”textarea” />
View Answer
Answer: a
Explanation: The text area tag (<textarea>) is used in a form to declare a text area element. It allows
the user to enter text in multiple rows.
Answer: a
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <em>
element indicates emphasis, browser will show the contents of <em> element in italic. <ins> element
shows the content that has been inserted, usually it has underline. <del> element shows text that
has been deleted from, usually it has a line through the content.
Answer: d
Explanation: The correct syntax for a web address is scheme://prefix.domain:port/path/filename,
where scheme is for https or http, prefix is for domain like www, domain denotes domain name, port
defines port number, path defines path at server, filename is for name of the document.
Answer: b
Explanation: <select> element is used to create a drop-down list in HTML Forms. It is mainly used to
collect user input. Option tags are used within the <select> element to define available options from
the drop-down list.
Answer: a
Explanation: <ol> tag is used to create the numbered list or ordered list items in an HTML document.
An ordered list can be numerical or alphabetical order. <li> tag is used to define each list item.
Syntax: <ol> Ordered List Items </ol>
Answer: c
Explanation: <input type=”checkbox”> is used to create a checkbox in HTML Form. Checkboxes allow
a user to select one or more options of a limited number of choices.
b)
c)
d)
<a>https://www.sanfoundry.com/1000-html-questions-answers/</a>
View Answer
Answer: a
Explanation: An anchor tag (<a>) and href attribute are used to create a hyperlink in HTML.
35. Which of the following extension is used to save an HTML file?
a) .hl
b) .h
c) .htl
d) .html
View Answer
Answer: d
Explanation: .html or .htm extensions are used to save the HTML file.
Answer: b
Explanation: In HTML, <br> tag is used to create a blank line. <b> tag is used to specify the bold text.
<em> tag is used to define the emphasized text.
37. Which HTML tag is used to convert the plain text into italic format?
a) <b>
b) <p>
c) <i>
d) <a>
View Answer
Answer: c
Explanation: In HTML, <i> tag is used to convert the plain text into italic format.
Answer: d
Explanation: To create a break between themes-such as a change of topic in a book or a new scene in
a play-you can add a horizontal rule between sections using <hr/> tag
Answer: b
Explanation: The words are written inside <strong> can be said with strong emphasis. Browser shows
contents written inside <strong> element in bold.
Example:
Answer: b
Explanation: In HTML, underline tag (<u>) is used to display the underlined text.
Example: HTML stands for <u>HyperText Markup Language</u>.
42. Which attribute specifies a unique alphanumeric identifier to be associated with an element?
a) type
b) article
c) id
d) class
View Answer
Answer: c
Explanation: HTML is Hyper Text Markup Language that is used to create web pages and applications.
The id attribute is most used to point to a style in a style sheet, and by JavaScript (via the HTML
DOM) to manipulate the element with the specific id. Class is a name given to HTML elements that
can be used by CSS and JavaScript for styling web pages. A self-contained content is called an
attribute.
43. Which of the following is an HTML specification used to add more information to HTML tags?
a) Modifydata
b) Minidata
c) Macrodata
d) Microdata
View Answer
Answer: d
Explanation: The Microdata spec provides a standardized syntax for additional semantic markup to
your web pages to enhance the machine readability of your web pages. The planning for distribution
center operation is offered by minidata. Macrodata and Modifydata are not any terms related to
HTML5.
Answer: d
Explanation: We can host our videos through YouTube and can easily embed them into our website.
<iframe> tag will be used for YouTube videos.
45. Which of the following HTML element is used for canvas graphics?
a) <css>
b) <paint>
c) <canvas>
d) <graphic>
View Answer
Answer: c
Explanation: CSS i.e. Cascading Style Sheet is a scripting language. Canvas graphics are introduced in
HTML5. Element used for canvas graphics is <canvas>. The HTML canvas element is used to draw
graphics, on the fly, via scripting (usually JavaScript).
Answer: a
Explanation: The <cite> tag defines the title of a work. The <hr> tag is used to give a horizontal break.
When we want to link one page to another, then <a> tag is used. The <address> tag is used to define
the contact information about owner of document.
Answer: a
Explanation: <time> tag wrap single piece of information i.e. it defines date, month and year. The
<nav> element identifies a set of navigation links, <footer> is introduced in HTML5 which is present
at the end of page and do conatins footer information i.e copyright information.
Answer: a
Explanation: The <main> element must NOT be a descendant of an <article>, <aside>, <footer>,
<header>, or <nav> element. The article element may contain audio/video clips, images and also text
or embedded content.
advertisement
Answer: c
Explanation: In SVG drawing is done with vectors and it support event handlers. Canvas doesn’t
contains any built-in-animations and drawing is done with pixels.
Answer: c
Explanation: <header> element contains navigation links. Slidebar is for hoverable/sliding text.
<footer> is introduced in HTML5 which is present at the end of page and do contains footer
information i.e copyright information. Main content is the entire article which wraps the <article>
element. It holds the page’s main content. It can be useful for screen readers. E.g. <main>
<article>…………</article> </main>
Answer: d
Explanation: The <section> element represents a section of a document or application. Tags like
<article>, <aside>, <nav>, <section> are the ones that create a nested, new outline inside the page.
Answer: a
Explanation: We can call events like drag, ondragover, etc multiple times in HTML5.
Answer: c
Explanation: The <mark> element is used to highlight a section of text. It is useful for quoting a text
or if one wants to bring attention to the text. The <b> tag is used to make text/paragraph bold. <u>
tag is used to underline the text you wanted.
Answer: a
Explanation: 64% of any website’s page is made up of images. The loading speed of the websites also
slows down due to this much contribution of images in a web page. To reduce this loading time we
use web performance optimization.
Answer: b
Explanation: Optimus WordPress plugin is used for lossless as well as lossy image compression. It
automatically reduces the size of the file. Reduction in size is possible up to 70%. There are three
versions of Optimus i.e. Optimus HQ, Optimus, Optimus HQ PRO. Speed test tools are used to
measure/note down your pages speed performance. WordPress cache enable a plugin used to
enable caching.
Answer: a
Explanation: HTTP stands for Hypertext Transfer Protocol. For fetching, data from server browser
uses HTTP request, and in between client and host. The more HTTP request slower the loading of a
page will be.
advertisement
Answer: d
Explanation: For better web performance we use removal of unnecessary characters from the source
code like white space characters, comments, new line characters, block delimiters etc.
for(var arr=[i=0];++i<10;arr[i]=i);
Answer: b
Explanation: For better loading time of the page it is always recommended to put JavaScript code at
the bottom of the main code of the page before </body> tag. CSS code should be at the beginning of
the code.
Answer: a
Explanation: TTFB stands for time to the first byte and measures the responsiveness of server. Its
calculation is done as: process request time+ HTTP request time+ HTTP response time. This speed up
the website by downloading various smaller images through sockets.
8. 404 HTTP error is generated due to ____________
a) missing JavaScript file
b) any missing file
c) slow loading of the web page
d) on removing the newline character
View Answer
Answer: b
Explanation: HTTP 404 is an error which indicates that the client was able to communicate with the
server but the server could not find the request. Due to missing of any file 404 error is generated,
this is a taxing error for the page.
Answer: a
Explanation: Hotlink protection is a kind of tool. Hotlink protection is related to restricting HTTP, it
stops other sites from displaying images of your webpage. We can create a list of hostnames that can
access the resources of our website.
Answer: c
Explanation: CSS styling and code should be placed at the top of the code for best loading result of
the webpage. JavaScript code should be placed at the bottom of the page for best performance and
rapid loading speed of the website.
Answer: d
Explanation: We store various information in the database. A database is a collection of tables that
contain information. Database delay takes a long waiting time, so there are various techniques for
database optimization. Database optimization basically optimizes data types, tables, data size.
13. Which of the following is the Waterfall tool?
a) WebPageTest.org
b) dotcom-monitor
c) Pingdom Speed Test
d) GTmetrix
View Answer
Answer: a
Explanation: Waterfall views are useful for front end of the websites. These are the kind of graphs
which shows the order of requesting of resources from a browser. One of the best online tools is
WebPageTest.org also known as WPT.
14. Which of the following is not the layer of the OSI Model?
a) Transport Layer
b) Network Layer
c) Session Layer
d) Atomic Layer
View Answer
Answer: d
Explanation: OSI model stands for Open Systems Interconnection model. It is commonly used for
representing various parts of network traffic. There are seven layers in the OSI model, Physical Layer,
Data Link layer, Network Layer, Transport Layer, Session Layer, Presentation Layer and Application
Layer.
Answer: a
Explanation: Parallel downloading is very beneficial to performance. Opera 10 provides the
maximum parallel connections per host i.e. 8, Chrome 1 and 2, Chrome 4 to 23 gives 6 maximum
parallel connections per host, Safari 3 and 4 gives 4 maximum parallel connections per host, Firefox
3, Firefox 4 to 17 gives 6 maximum parallel connections per host.
Answer: a
Explanation: Text input type defines single line text field. Type is the attribute that displays type of
<input> elements. Its default type is text. It is supported by most of the browsers like Chrome,
Internet Explorer, Firefox, Opera. Syntax is: <form action=”jump.php”> Name:<input type=”text”
name=”name”> </form> A password field is defined by password input.
Answer: c
Explanation: color is the attribute of <input> element introduce by HTML5. It defines the color picker
i.e we can select a color of our choice from the color picker. Syntax is Select the color that you want:
<input type=”color” name=”favorite color”>
advertisement
Answer: a
Explanation: Input type button is used for the activation of JavaScript on the clicking of the button. Its
syntax is <input type=”button” value=”click” onclick=”source()”>. This will display a button named
click and when we click that button JavaScript function source() will be invoked.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!
6. How image attribute works?
a) Sets an image background
b) Set an image as submit button
c) Set an image anywhere on the page
d) Bring default image to the page
View Answer
Answer: b
Explanation: the image input type set an image as submit button. The syntax is <input type=”image”
src=”imghj.gif” alt=”Submit”> this sets the image provided by url as the submit button. Input type
image sends the X and Y coordinates of click and hence the image is activated by clicking the submit
button.
Answer: b
Explanation: month and year are defined by month attribute. It does not define the time zone. The
syntax is Anniversary (month and year) <input=”month” name=”anniversary month” >., date
attribute defines the date, datetime-local defines date and time but no time zone.
Answer: b
Explanation: tel is the attribute which specifies field for telephone number. Syntax is <form
action=”hkjk.php”> Telephone number: <input type=”tel” name=”usertelephone”> <br> <input
type=”submit”> </form>, tel attribute is usually supported by newer versions like Safari 8.
Answer: a
Explanation: size attribute denotes the width of text input i.e measured by the number of characters
inputted. E.g. If we input value 3 then it will create a box of width enough to display three characters.
The user can enter more characters if they want. Syntax is <input type=”text” name=”firstname”
size=”12” maxlength=”30”>
Answer: d
Explanation: password is the attribute that creates a text box which is similar to the single line text
input, but the characters are blocked out. They are hidden due to the privacy of the user. The name
attribute with a password set the name of the password input, size and maxlength attributes define
the size and maximum length of the text box which is to be used for the password.
Answer: b
Explanation: For creating multi-line text input we use <textarea> element. This is not empty element
i.e. it requires both opening tag and closing tag. The cols attribute defines a width of the text area.
The row attributes the number of rows that the textarea can require.
Answer: d
Explanation: When we want to pick one option from the given many options we use radio type.
Name attribute sent the value of the option selected to the server. Value attribute indicates the value
that has been sent to the server for the selected option. The checked attribute indicates that which
value should be selected on the loading of the page.
14. Which attribute is used with <select> element?
a) multiple
b) selected
c) name
d) value
View Answer
Answer: a
Explanation: <select> element is used for drop down select box. Size attribute is used for showing
more than one option. For a selection of multiple options, we use multiple attributes. It is a useful
option to select multiple things at a time.
Answer: c
Explanation: In HTML one can use a color name to specify a color e.g. Tomato, Orange, DodgerBlue,
MediumSeaGreen, Gray, SlateBlue, Violet, LightGray etc. For colored fonts, we used text-decoration
property to set the color of the text.
Answer: d
Explanation: Text-transform: capitalize, capitalizes the first letter of each word whereas font-style set
font as normal, italic, oblique. We use text-transform: uppercase and text-transform: lowercase to
change the text from lowercase to uppercase and from uppercase to lowercase respectively.
3. What should be set with text-align property so that every line has equal width like in magazines
and newspapers?
a) text-align: justify
b) text-align: none
c) text-align: bottom
d) text-align: top
View Answer
Answer: a
Explanation: By setting text-align property to “justify”, each line is stretched so that every line has
equal width, left and right margins are straight like in magazines and newspapers. Text-align: center,
text-align: right, text-align: left is also used for aligning the text at center, right and left respectively.
advertisement
4. Which of the following is not used with text-decoration property?
a) overline
b) underline
c) line-through
d) inline
View Answer
Answer: d
Explanation: overline, underline, line-through properties are used to decorate the text.
Syntax:
h1{text-decoration: line-through; },
h3{text-decoration: underline;}
it will produce headings h1 with text having line-through, h2 with text having overline and h3 with
text having underline.
Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <b></b>
makes text bolder. A section which is quoted from another source is specified by <blockquote>. <em>
element indicates emphasis, browser will show the contents of <em> element in italic.
Answer: a
Explanation: The words written inside <strong> can be said with strong emphasis. Browser shows
contents written inside <strong> element in bold.
Answer: a
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in
italic. A section which is quoted from another source is specified by <blockquote>. The <abbr>
defines abbreviation. We used <q> element for shorter quote. Browser put quote around <q>
element.
Answer: c
Explanation: <em> element indicates emphasis, browser will show the contents of <em> element in
italic. We used <q> element for shorter quote. Browser put quote around <q> element. A section
which is quoted from another source is specified by <blockquote>. For using, abbreviation or
acronym <abbr> element is helpful. A title element is to be used with abbr.
e.g.
<address>
<a href="mailto:[email protected]">Sanfoundry</a>
</address>
Answer: b
Explanation: <strong> element shows the importance of text/paragraph between it’s tags. <em>
element indicates emphasis, browser will show the contents of <em> element in italic. <ins> element
shows the content that has been inserted, usually it has underline. <del> element shows text that
has been deleted from, usually it has a line through the content.
Answer: a
Explanation: <del> element shows text that has been deleted from, usually it has a line through the
content. <strong> element shows the importance of text/paragraph between it’s tags. <em> element
indicates emphasis, browser will show the contents of <em> element in italic. <ins> element shows
the content that has been inserted, usually it has underline.
Answer: a
Explanation: For bidirectional override of current text direction, we used <bdo> element, e.g. <bdo
dir=”rtl”>Text is right to left</bdo>. This element was already there before HTML5. It is supported by
all the browsers.
Answer: b
Explanation: For using, abbreviation or acronym <abbr> element is helpful. The contact details for
author of a page is specified by <address> attribute. A section which is quoted from another source is
specified by <blockquote>. The tittle of a Work is defined by <cite> elements, usually it displays in
italics.
Answer: c
Explanation: min is an attribute for input method for inserting minimum value. smaller text is define
by <small>element. <em> is used for emphasis usually it is display in italics.
1. Which of the following value is supposed to be a slightly bolder weight that standard bold in font
attribute?
a) empasize
b) light
c) lighter
d) dark
View Answer
Answer: d
Explanation: Self-explainatory.
2. Which of the following property allows contextual adjustment of inter-glyph spacing, i.e. the
spaces between the characters in text?
a) font-style
b) font-family
c) font-kerning
d) font-variant
View Answer
Answer: c
Explanation: Self-explainatory.
Answer: d
Explanation: Self-explainatory.
advertisement
4. Which of the following value specifies whether the user agent is allowed to synthesize bold or
oblique font faces when a font family lacks bold or italic faces?
a) font-weight
b) font-synthesis
c) font-kerning
d) font-variant
View Answer
Answer: b
Explanation: Self-explainatory.
5. Which of the following selects a normal, or small-caps face from a font family?
a) font-weight
b) font-synthesis
c) font-kerning
d) font-variant
View Answer
Answer: d
Explanation: Self-explainatory.
Answer: c
Explanation: Self-explainatory.
7. Which of the following property adjusts the font-size of the fallback fonts defined with font-family,
so that the x-height is the same no matter what font is used?
a) default
b) font-size-fallback
c) font-adjust
d) font-size-adjust
View Answer
Answer: d
Explanation: Self-explainatory.
8. Which of the following Allows you to expand or condense the widths for a normal, condensed, or
expanded font face?
a) font-style
b) font-stretch
c) font-expand
d) none of the mentioned
View Answer
Answer: d
Explanation: Self-explainatory.
9. Which of the following font-size-adjust is value used in calculating the size of the fallback fonts?
a) auto
b) number
c) count
d) none
View Answer
Answer: b
Explanation: Self-explainatory.
10. “font-style comes first than font-weight in font attribute”.State true or false.
a) True
b) False
View Answer
Answer: b
Explanation: Syntax:
font: font-weight font-style font-variant font-size/line-height font-family .
Answer: b
Explanation: A single web browser window on your desktop may contain several tabs. Each tab is an
independent browsing context. browser context is also defined as the environment in which the
browser displays a document.
2. Nested documents inside the HTML documents can be created using ___________
a) frame
b) nest
c) iframe
d) into
View Answer
Answer: c
Explanation: HTML documents may contain nested documents using an iframe element.
An iframe creates a nested browsing context represented by a Window object of its own.
3. How are windows, tabs, iframes, and frames treated according to client-side javascript?
a) They are all browsing contexts
b) They are all browsing information
c) They are all Window contexts
d) They are all Window objects
View Answer
Answer: a
Explanation: Client-side JavaScript makes very little distinction between windows, tabs, iframes, and
frames they are all browsing contexts, and to JavaScript, they are all Window objects.
advertisement
4. How are windows, tabs, iframes, and frames treated according to javascript?
a) They are all browsing contexts
b) They are all browsing information
c) They are all Window contexts
d) They are all Window objects
View Answer
Answer: d
Explanation: Client-side JavaScript makes very little distinction between windows, tabs, iframes, and
frames they are all browsing contexts, and to JavaScript, they are all Window objects.
5. A new web browser window can be opened using which method of the Window object?
a) createtab()
b) Window.open()
c) open()
d) create()
View Answer
Answer: b
Explanation: You can open a new web browser window with the open() method of the Window
object. Window.open() loads a specified URL into a new or existing window and returns the Window
object that represents that window.
6. What will happen if the first argument of open() is omitted?
a) Error Page
b) Remains in the same page
c) about:blank
d) Reloads the page
View Answer
Answer: b
Explanation: The first argument in the open function is for the url of the page which is to be opened.
When the first argument of the open() is omitted, the about:blank is opened.
7. Which object serves as the global object at the top of the scope chain?
a) Hash
b) Property
c) Element
d) Window
View Answer
Answer: d
Explanation: The Window object serves as the global object at the top of the scope chain in client-
side JavaScript. All global JavaScript objects, functions, and variables automatically become members
of the window object.
8. Which is the property of a Window object that holds the name of the frame?
a) name
b) title
c) description
d) style
View Answer
Answer: a
Explanation: The name property of a Window object holds the name of the frame if it has one. This
property is writable, and scripts can set it as desired. An iframe creates a nested browsing context
represented by a Window object of its own.
Answer: c
Explanation: The fourth argument to open() is useful only when the second argument names an
existing window. This fourth argument is a boolean value that indicates whether the URL specified as
the first argument should replace the current entry in the window’s browsing history (true) or create
a new entry in the window’s browsing history (false). Omitting this argument is the same as
passing false.
10. The inner frame within a top-level window can be referred to as _____________
a) parent(parent)
b) parent.parent
c) parent*parent
d) parent/parent
View Answer
Answer: b
Explanation: Frames returns the window itself, which is an array-like object, listing the direct sub-
frames of the current window. If a frame is contained within another frame that is contained within a
top-level window, that frame can refer to the top-level window as parent.parent.
Answer: d
Explanation: The first child of a node can be accessed using the firstChild property. firstChild returns
the first child node as an element node, a text node or a comment node (depending on which one’s
first).
2. What are the properties supporting CSS styles for a document element?
a) style and font
b) style and className
c) size and style
d) className and font
View Answer
Answer: b
Explanation: Each Element object has style and className properties that allow scripts to specify
CSS styles for a document element or to alter the CSS class names that apply to the element.
firstChild returns the first child node as an element node, a text node or a comment node (depending
on which one’s first).
Answer: a
Explanation: Each Element object has style and className properties that allow scripts to specify
CSS styles for a document element or to alter the CSS class names that apply to the element.
advertisement
4. What is the purpose of the event handlers in the JavaScript?
a) Adds innerHTML page to the code
b) Performs handling of exceptions and occurrences
c) Allows JavaScript code to alter the behaviour of windows
d) Change the server location
View Answer
Answer: c
Explanation: Event handlers allow JavaScript code to alter the behavior of windows, of documents,
and of the elements that make up those documents.
5. Which handler is triggered when the content of the document in the window is stable and ready
for manipulation?
a) onload
b) manipulate
c) create
d) onkeypress
View Answer
Answer: a
Explanation: One of the most important event handlers is the onload handler of the Window object.
It is triggered when the content of the document displayed in the window is stable and ready to be
manipulated. JavaScript code is commonly wrapped within an onload event handler.
6. When a program contains extensive use of event handlers, which of the following is necessary?
a) Modular functions
b) Nested functions
c) Split up programs
d) Global variables
View Answer
Answer: b
Explanation: Nested functions are those functions in which one function is defined inside another
function. Nested functions are common in client-side JavaScript, because of its extensive use of event
handlers.
7. What is the JavaScript code snippet to find all container elements with class “reveal”?
a) var elements = document.getElementsByClassName(“reveal”);
b) var elements = document.getElementByClassName(“reveal”);
c) var elements = document.getElementByName(“reveal”);
d) var elements = document.getElementsClassName(“reveal”);
View Answer
Answer: a
Explanation: The getElementsByClassName() method returns a collection of all elements in the
document with the specified class name, as a NodeList object. The above code snippet finds all
container elements with class “reveal”.
8. What is the JavaScript code snippet to update the content of the timestamp element when the
user clicks on it?
a) timestamp.onLoad = function() { this.innerHTML = new Date().toString(); }
b) timestamp.onclick = function() { this.innerHTML = new Date().toString(); }
c) timestamp.onload = function() { this.innerHTML = new Date().toString(); }
d) timestamp.onclick = function() { innerHTML = new Date().toString(); }
View Answer
Answer: b
Explanation: onclick() function is used to handle events when the user clicks on the mouse. The
above code snippet updates the content of the timestamp element when the user clicks on it.
Answer: c
Explanation: There is no object called Position. Whereas elements, location and window are a
predefined object in JavaScript.
10. What is the JavaScript code snippet to change the class and let the stylesheet specify the details?
a) timestamp.className = “highlight”;
b) timestamp.className = “change”;
c) timestamp.className = “specify”;
d) timestamp.className = “move”;
View Answer
Answer: a
Explanation: Each Element object has style and className properties that allow scripts to specify CSS
styles for a document element or to alter the CSS class names that apply to the element. The above
code snippet changes the class and lets the stylesheet specify the details.
XML MCQs: This section contains multiple-choice questions and answers on the various topics of
XML. Practice these MCQs to test and enhance your skills on XML.
Explanation:
A. design, style
B. design, send
C. store, style
D. store, transport
Explanation:
A. May 2001
B. May 2000
C. May 1999
D. May 1998
Explanation:
4. ____is used to read XML documents and provide access to their content and structure.
A. XML Processor
B. XML Pre-processor
C. XML Compiler
D. XML Interpreter
XML processor is used to read XML documents and provide access to their content and structure.
B. XML codes
C. ASCII codes
D. Characters
Answer: D) Characters
Explanation:
An XML document is a string of characters, it may contain almost every Unicode character.
6. In an XML document, a tag is a markup construct that starts with ___ and ends with ____.
A. <, >
B. <!--, -->
C. <#, >
D. @, @
Explanation:
In an XML document, a tag is a markup construct that starts with < and ends with >.
A. 3
B. 4
C. 5
D. 6
Answer: A) 3
Explanation:
In an XML document, there are three types of tags and they are;
Explanation:
A. /* and */
D. @ and @
Explanation:
In an XML document, the comments are written within <!-- and -->.
Explanation:
11. A Document Type Definition (DTD) is a set of ____ which is used to define the type of
document for an SGML-family markup language.
A. markup definition
B. markup document
C. main declarations
D. markup declarations
Explanation:
A Document Type Definition (DTD) is a set of markup declarations which is used to define the type of
document for an SGML-family markup language.
Explanation:
With respect to XML, SGML stands for "Standard Generalized Markup Language".
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, XML tags are case-sensitive. The following line of code is an example of wrong syntax.
<name>Alex</Name>
Explanation:
A. multiple attributes
Explanation:
A. StringType
B. ArrayType
C. TokenizedType
D. EnumeratedType
Answer: B) ArrayType
Explanation:
17. If element ONE is contained by element TWO, then ONE is known as ____ of TWO.
A. ancestors
B. family
C. descendant
D. child
Answer: C) descendant
Explanation:
If element ONE is contained by element TWO, then ONE is known as descendant of TWO.
18. The containing element which contains other elements is called ____ of other element.
A. ancestor
B. family
C. descendant
D. child
Answer: A) ancestor
Explanation:
The containing element which contains other elements is called ancestor of other element.
19. Which is the correct syntax to link XML file with CSS?
Explanation:
Explanation:
A. Yes
B. No
Answer: B) No
Explanation:
Explanation:
A. 2
B. 3
C. 4
D. 5
Answer: A) 2
Explanation:
XML-enabled database
25. From the below given options, which is not a W3C-recommended Specification?
A. SAX
B. DOM
C. Both A and B
Answer: A) SAX
Explanation:
SAX is not a W3C-recommended Specification.
Explanation:
27. XSNL acts between the meta search interface and targeted system.
Explanation:
XSNL acts between the "meta search interface" and "targeted system".
B. The opening and closing tag are the same i.e., their case must be the same
C. The child tag must be closed within the parent tag i.e., as per the order, before closing the
parent tag.
Explanation:
All the above options (A, B, and C) and true to write a well-formed XML document,
The opening and closing tag are the same i.e., their case must be the same
The child tag must be closed within the parent tag i.e., as per the order, before closing the
parent tag.
A. Yes
B. No
Answer: A) Yes
Explanation:
A. XLink
B. XPointer
C. Both A and B
Explanation:
In an XML document, a graphics can be stirred using the XLink and XPointer.
A. Yes
B. No
Answer: A) Yes
Explanation:
A. xlink:path
B. xlink:url
C. xlink:src
D. xlink:href
Answer: D) xlink:href
Explanation:
XLink attribute xlink:href defines / specifies the URL to link to within an XML document.
A. xlink:type
B. xlink:kind
C. xlink:types
D. xlink:category
Answer: A) xlink:type
Explanation:
A. xlink:target
B. xlink:where
C. xlink:show
D. xlink:path
Answer: C) xlink:show
Explanation:
A. embed
B. new
C. replace
D. other
Answer: C) replace
Explanation:
36. Which XML object is used to request data from the web server?
A. XMLHttpReq
B. XMLHttpRequest
C. XMLHttpsReq
D. XMLHttpsRequest
Answer: B) XMLHttpRequest
Explanation:
37. Can all XML elements be accessed through the XML DOM?
A. Yes
B. No
Answer: A) Yes
Explanation:
Yes, all XML elements can be accessed through the XML DOM.
38. Which is the correct XML DOM statement to get the text value of the first element named
"city" in an XML document?
A. result = xmlDoc.getElementsByTagName("city")([0]).childNodes[0].nodeValue;
B. result = xmlDoc.getElementsByTagName("city").childNodes[0].nodeValue;
C. result = xmlDoc.getElementsByTagName("city")[0].nodeValue;
D. result = xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
Explanation:
The correct XML DOM statement to get the text value of the first element named "city" in an XML
document is:
result = xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
<book>
<title>The Secret</title>
<author>Rhonda Byrne</author>
<pages>198</pages>
<price>120.00</price>
</book>
A. Yes
B. No
Answer: A) Yes
Explanation:
A. Yes
B. No
Answer: B) No
Explanation: