0% found this document useful (0 votes)
24 views

HTML Put Question Bank

Html que bnaknsmkkskns

Uploaded by

Dipanshu THAKUR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

HTML Put Question Bank

Html que bnaknsmkkskns

Uploaded by

Dipanshu THAKUR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

HTML Questions & Answers – HTML Introduction – 1

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.

2. Who is the father of HTML?


a) Rasmus Lerdorf
b) Tim Berners-Lee
c) Brendan Eich
d) Sergey Brin
View Answer

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.

3. HTML stands for __________


a) HyperText Markup Language
b) HyperText Machine Language
c) HyperText Marking Language
d) HighText Marking Language
View Answer

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.

4. What is the correct syntax of doctype in HTML5?


a) </doctype html>
b) <doctype html>
c) <doctype html!>
d) <!doctype html>
View Answer

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

6. Which of the following is not a difference between HTML and XHTML?


a) Charset in both html and xhtml is “text/html”
b) Tags and attributes are case-insensitive in HTML but not in XHTML
c) Special characters must be escaped using character entities in XHTML unlike HTML
d) Charset in html is “text/html” where as in xhtml it is “application/xml+xhtml”
View Answer

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.

10. Which element is used to get highlighted text in HTML5?


a) <u>
b) <mark>
c) <highlight>
d) <b>
View Answer

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.

<p>This is the example.<mark> I like this dog. </mark></p>

Output: This is the example. I like this dog.

11. Which of the following is not a HTML5 tag?


a) <track>
b) <video>
c) <slider>
d) <source>
View Answer

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.

12. How do we write comments in HTML?


a) </…….>
b) <!……>
c) </……/>
d) <…….!>
View Answer

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.

17. Which HTML tag is used to insert an image?


a) <img url=”htmllogo.jpg” />
b) <img alt=”htmllogo.jpg” />
c) <img src=”htmllogo.jpg” />
d) <img link=”htmllogo.jpg” />
View Answer

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.

18. HTML is a subset of ___________


a) SGMT
b) SGML
c) SGME
d) XHTML
View Answer

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.

19. Which character is used to represent when a tag is closed in HTML?


a) #
b) !
c) /
d) \
View Answer
Answer: c
Explanation: The forward-slash (/) is used to indicate the closure of a tag within HTML.

20. Which of the following HTML code will make an image clickable?
a)

<a href="https://www.sanfoundry.com/">Sanfoundry Home Page</a>

b)

<img src="https://www.sanfoundry.com/sanfoundry-logo">

<a href="https://www.sanfoundry.com/">Sanfoundry Home Page</a>

</img>

c)

<a href="https://www.sanfoundry.com/">Sanfoundry Home Page</a>

<img src="https://www.sanfoundry.com/sanfoundry-logo" />

d)

<a href="https://www.sanfoundry.com/"><img src="https://www.sanfoundry.com/sanfoundry-logo"


/></a>
View Answer

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.

21. Among the following, which is the HTML paragraph tag?


a) <p>
b) <pre>
c) <hr>
d) <a>
View Answer

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.

23. Which HTML element is used for short quote?


a) <em>
b) <abbr>
c) <q>
d) <blockquote>
View Answer

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.

<p>This is a <q>black dog</q>.</p>

Output: This is a “black dog”.


24. Which of the following HTML tag is used to create an unordered list?
a) <ol>
b) <ul>
c) <li>
d) <ll>
View Answer
Answer: b
Explanation: <ul> tag is used to create the unordered list items in an HTML document. By default,
unordered list items will display in a bulleted format.
Different types of unordered list Attribute Values are:

Disc

Circle

Square

None

Syntax: <ul> Unordered List Items </ul>


25. Which HTML element is used for abbreviation or acronym?
a) <abbr>
b) <blockquote>
c) <q>
d) <em>
View Answer

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.

<p>The <abbr title=”Doctor”>Dr.</abbr> is on the way.</p>

Output: The Dr. is on the way.

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.

27. What is the work of <address> element in HTML5?


a) contains IP address
b) contains home address
c) contains url
d) contains contact details for author
View Answer

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.

29. To show deleted text, which HTML element is used?


a) <del>
b) <em>
c) <strong>
d) <ins>
View Answer

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.

<p>This is <del>not</del> for deletion </p>

Output: This is for deletion.

30. What is the correct syntax of web address?


a) port://domain.filenmae:path/scheme/prefix
b) prefix://scheme.port:domain/filename/path
c) path://prefix.port:domain/filename/scheme
d) scheme://prefix.domain:port/path/filename
View Answer

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.

31. Which tag is used to create a dropdown in HTML Form?


a) <input>
b) <select>
c) <text>
d) <textarea>
View Answer

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.

32. Which tag is used to create a numbered list in HTML?


a) <ol>
b) <ul>
c) <li>
d) <ll>
View Answer

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>

33. How to create a checkbox in HTML Form?


a) <input type=”text”>
b) <input type=”textarea”>
c) <input type=”checkbox”>
d) <input type=”button”>
View Answer

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.

34. How to insert Hyperlink in HTML Page?


a)

<a href="https://www.sanfoundry.com/1000-html-questions-answers/">HTML MCQ</a>

b)

<a target="https://www.sanfoundry.com/1000-html-questions-answers/" HTML Quiz />

c)

<a src="https://www.sanfoundry.com/1000-html-questions-answers/">HTML Test</a>

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.

36. Which tag is used to create a blank line in HTML?


a) <b>
b) <br>
c) <em>
d) <a>
View Answer

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.

38. What is the use of <hr/> tag in HTML?


a) For making content appearance italics
b) To create vertical rule between sections
c) To create a line break
d) To create horizontal rule between sections
View Answer

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

39. Which attribute is not essential under <iframe>?


a) frameborder
b) width
c) height
d) src
View Answer
Answer: a
Explanation: An iframe is equivalent to a window that has been cut into our page, it is created using
<iframe> element. Src, height, width attribute are essentially used inside of this. Src attribute
specifies the URL of the page which is to be shown. Height and width specify the height and width of
an iframe in pixels.

40. Which works similar to <b> element?


a) <blockquote>
b) <strong>
c) <em>
d) <i>
View Answer

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:

<p>1000 <strong>HTML</strong> MCQs.</p>

Output: 1000 HTML MCQs.

41. Which tag is used to underline the text in HTML?


a) <p>
b) <u>
c) <i>
d) <ul>
View Answer

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.

44. Which HTML element is used for YouTube videos?


a) <samp>
b) <small>
c) <frame>
d) <iframe>
View Answer

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.

E.g. <iframe width=”670” height=”612” src= “https://sanfoundry.com”> </iframe>

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).

HTML Questions & Answers – HTML5 Introduction – 2


This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “HTML5 Introduction – 2”.

1. Which of the following defines the title of a work?


a) <cite>
b) <hr>
c) <a>
d) <address>
View Answer

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.

2. Which element is design to wrap a single piece of information?


a) <time>
b) <nav>
c) <footer>
d) <header>
View Answer

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.

3. What an article element should not contain?


a) Main element
b) Text or embedded content
c) Image
d) Video & Audio
View Answer

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

4. Which of the following statement is true?


a) Canvas Contains built-in animations
b) SVG needs scripts to draw elements
c) In canvas, drawing is done with pixels
d) SVG don’t support to event handlers
View Answer

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.

5. What does <main> include?


a) Header
b) Sidebar
c) Article
d) Footer
View Answer

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>

6. Which of the following is not sectioning elements?


a) <article>
b) <aside>
c) <nav>
d) <header>
View Answer

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.

7. How many times can HTML5 events be fired?


a) Multiple
b) One
c) Only two
d) Zero
View Answer

Answer: a
Explanation: We can call events like drag, ondragover, etc multiple times in HTML5.

8. Which element is used to get highlighted text in HTML5?


a) <highlight>
b) <b>
c) <mark>
d) <u>
View Answer

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.

HTML Questions & Answers – Web Performance


Optimization – 1
This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Web Performance
Optimization – 1”.

1. Major portion of web page contributes _________________


a) image
b) text
c) video
d) audio
View Answer

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.

2. For image compression which tool is helpful?


a) WordPress cache enable a plugin
b) Optimus wordpress plugin
c) Glup-uglify
d) Speed test tool
View Answer

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.

3. HTTP request is between _______________


a) client and host
b) client and server
c) server and host
d) user and server
View Answer

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

4. What does not come under minification?


a) removal of comments
b) removal of new line characters
c) removal of white space characters
d) removal of multimedia elements
View Answer

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.

E.g. the given JavaScript code

var arr=[]; for(var i=0;i<10;i++) {arr[i]=i}; }

is equivalent to the code

for(var arr=[i=0];++i<10;arr[i]=i);

5. Which of the following is not render blocking resource?


a) CSS
b) HTML
c) JavaScript
d) Jquery
View Answer
Answer: d
Explanation: HTML, CSS and JavaScript are render blocking resources to the DOM. To enhance the
speed of your web page these resources should be properly used.

6. For best speed position of JavaScript code should be at ______________


a) top of the code
b) bottom of the code
c) middle of the code
d) anywhere in the code
View Answer

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.

7. What is the work of TTFB?


a) measures the responsiveness of web server
b) increases the load speed of web page
c) compresses the image
d) remove unnecessary characters
View Answer

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.

9. What is the work of Gzip compression?


a) compresses an image
b) compresses web pages only
c) compresses JavaScript and CSS code only
d) compresses web pages, JavaScript and CSS
View Answer
Answer: d
Explanation: Basically Gzip compression is used to compress text data in websites. Gzip compression
is very useful in web performance optimization. It compresses web pages, JavaScript and CSS. Gzip is
also one of the file formats. Gzip compression can be enabled via webserver configuration. Common
webservers where it can me make enable is .htaccess, Nginx, Apache and Litspeed.

10. What is hotlink protection?


a) stopping other sites from displaying images
b) stopping other sites from displaying videos
c) stopping access of source code
d) compresses an image
View Answer

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.

11. For best speed position of CSS code should be at __________


a) at the bottom of the code
b) at the middle of the code
c) at the top of the code
d) anywhere in the code
View Answer

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.

12. What is not the work of database optimization?


a) cleaning out old tables
b) creating indexes
c) optimize datatype
d) delete database
View Answer

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.

15. Which browser gives maximum parallel connections per host?


a) Opera 10
b) Chrome 1 and 2
c) Safari 3 and 4
d) Firefox 3
View Answer

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.

HTML Questions & Answers – Input Types for Forms


This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Input Types for Forms”.
1. What is the default type of ‘type’ attribute of <input> element?
a) Text
b) Password
c) Numerals
d) Special Characters
View Answer

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.

2. Which of the following is a new input attribute introduce by HTML5?


a) text
b) checkbox controls
c) submit buttons
d) date
View Answer
Answer: d
Explanation: HTML4 has attributes with <input> elements like radio buttons, Checkbox controls,
submit buttons, text input etc.
HTML5 has introduced new attributes like date, color, month, time, week, datetime-local, email,
number, range, tel, url, search etc.

3. How does the color attribute work?


a) Changes color of the text
b) Changes background color
c) The color picker is defined by it
d) Changes color of the text as well as background
View Answer

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

4. Which attribute is used for activation of JavaScript?


a) button
b) checkbox
c) url
d) submit
View Answer

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.

5. Which attribute defines the file-select field?


a) file
b) checkbox
c) button
d) text
View Answer
Answer: a
Explanation: file input type defines a file-select field, also gives a “Browse” button for file uploads.
Syntax is <input type=”file” name=”image”>. Checkbox gives the facility to select one or more than
one options from the given choices. The button activates JavaScript code. The text defines a single-
line text field.

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.

7. month attribute defines ___________


a) the only month
b) month and year
c) date
d) date and time
View Answer

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.

8. week attribute defines ____________


a) week
b) year
c) week and year
d) week, month and year
View Answer
Answer: c
Explanation: week input type defines a week and year. It does not define the time zone. Syntax is
<form action=”ghu.php”> week: <input type=”week” name=”week and year”> <input
type=”submit”> </form>, this gives a selection box and display a calendar like chart from where we
can select a week and the year as well.

9. tel attribute is supported by the _________ browser.


a) Chrome
b) Safari
c) Opera
d) Internet Explorer
View Answer

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.

10. Which attribute is not used on new forms?


a) size
b) text
c) name
d) maxlength
View Answer

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”>

11. Which of the following is not used with password attribute?


a) name
b) size
c) maxlength
d) min
View Answer

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.

12. Which element is used to create multi-line text input?


a) text
b) textarea
c) submit
d) radio button
View Answer

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.

13. Which attribute is not used for the radio type?


a) name
b) value
c) checked
d) selected
View Answer

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.

HTML Questions & Answers – Fonts in HTML


This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Fonts in HTML”.

1. How many standard color names does HTML supports?


a) 120
b) 130
c) 140
d) 90
View Answer

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.

2. Which of the following is not set with font-style property?


a) font-style: normal
b) font-style: italic
c) font-style: oblique
d) font-style: capitalize
View Answer

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; },

h2 {text-decoration: overline ;},

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.

5. Which works similar to <i> element?


a) <strong>
b) <em>
c) <b>
d) <blockquote>
View Answer

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.

<p>I <em>like</em> dog.</p>

Output: I like dog.

6. Which works similar to <b> element?


a) <strong>
b) <em>
c) <i>
d) <blockquote>
View Answer

Answer: a
Explanation: The words written inside <strong> can be said with strong emphasis. Browser shows
contents written inside <strong> element in bold.

<p><strong>Dog is</strong> an animal.</p>

Output: Dog is an animal.

7. Which element is used for short quote?


a) <q>
b) <blockquote>
c) <em>
d) <abbr>
View Answer

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.

<p>This is a <q>black dog</q>.</p>

Output: This is a “black dog”.

8. Which element is used for abbreviation or acronym?


a) <em>
b) <q>
c) <abbr>
d) <blockquote>
View Answer

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.

<p>The <abbr title=”Doctor”>Dr.</abbr> is on the way.</p>

Output: The Dr. is on the way.

9. What is the work of <address> element?


a) contains contact details for author
b) contains IP address
c) contains home address
d) contains url
View Answer
Answer: a
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>

10. To show deleted text, which element is used?


a) <ins>
b) <del>
c) <em>
d) <strong>
View Answer

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.

<p>This is <del>not</del> for deletion </p>

Output: This is for deletion.

11. Which element is used to show inserted element?


a) <ins>
b) <del>
c) <strong>
d) <em>
View Answer

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.

<p>This is the <ins>inserted </ins> element.</p>

Output: This is the inserted element.

12. How <bdo> element works?


a) override text direction
b) stops writing in the current text direction
c) only override direction of rtl text
d) only changes the direction of ltr text
View Answer

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.

13. Which property is similar to C/C++ can be applied to comments?


a) for loop
b) while loop
c) ifelse
d) switch case
View Answer
Answer: c
Explanation: We can add conditional comments in our web page using if and endif, e.g. <!–[if age
9]>..text….<![endif]–>, there is no provision of “for” or “while” loop in HTML, same apply with switch
case also.

14. Which element defines a title of the Work?


a) <abbr>
b) <cite>
c) <address>
d) <blockquote>
View Answer

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.

<p><cite>Hamlet</cite> by William Shakespeare</p>

Output: Hamlet by William Shakespeare.


15. For smaller text which element is used?
a) <tiny>
b) <min>
c) <small>
d) <em>
View Answer

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.

<p>This is text in <small>small</small>.</p>

Output: This is text in small.

CSS Questions & Answers – CSS Fonts


This set of CSS Multiple Choice Questions & Answers (MCQs) focuses on “CSS Fonts”.

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.

3. Which of the following is not a value for font-style property?


a) normal
b) italic
c) oblique
d) none of the above
View Answer

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.

6. Which of the following is not a appropriate value for font-variant property?


a) inherit
b) default
c) large-caps
d) small-caps
View Answer

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 .

JavaScript Questions & Answers – Error Handling – II


This set of JavaScript Questions and Answers for Freshers focuses on “Error Handling – II”.

1. Each tab in the single web browser window is called as ____________


a) Browser Information
b) Browsing context
c) Both Browser Information & Browsing context
d) Browser Log
View Answer

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.

9. When will the fourth argument to open() useful?


a) When the second argument names a retired window
b) When the first argument names an existing window
c) When the second argument names an existing window
d) When the first argument names a retired window
View Answer

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.

JavaScript Questions & Answers – JavaScript in Web


Browsers – II
This set of JavaScript Interview Questions and Answers focuses on “JavaScript in Web Browsers – II”.

1. What is the property to access the first child of a node?


a) timestamp.Child1
b) timestamp.Child(1)
c) timestamp.Child(0)
d) timestamp.firstChild
View Answer

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).

3. Which of the following object belongs to the style property?


a) Element
b) Window
c) Location
d) Dynamic
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.

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.

9. Which of the following is not an object?


a) Element
b) Location
c) Position
d) Window
View Answer

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 Multiple-Choice Questions (MCQs)


XML is a markup language and also a file format that is used to store, transmit, and reconstruct
arbitrary data. XML defines a set of rules for encoding documents in a format that is both human-
readable and machine-readable.

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.

List of XML MCQs

1. XML stands for ____.

A. eXtensible Margin Language

B. Xtensible Markup Language

C. eXtensible Markup Language

D. Xtensible Margin Language


Answer: C) eXtensible Markup Language

Explanation:

XML stands "eXtensible Markup Language".

Discuss this Question

2. XML is designed to ____ and ____ data.

A. design, style

B. design, send

C. store, style

D. store, transport

Answer: D) store, transport

Explanation:

XML is designed to store and transport data.

Discuss this Question

3. XML Schema, published as a W3C recommendation in ____.

A. May 2001

B. May 2000

C. May 1999

D. May 1998

Answer: A) May 2001

Explanation:

XML Schema, published as a W3C recommendation in May 2001.

Discuss this Question

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

Answer: A) XML Processor


Explanation:

XML processor is used to read XML documents and provide access to their content and structure.

Discuss this Question

5. An XML document is a string of ____.

A. HTML character codes

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.

Discuss this Question

6. In an XML document, a tag is a markup construct that starts with ___ and ends with ____.

A. <, >

B. <!--, -->

C. <#, >

D. @, @

Answer: A) <, >

Explanation:

In an XML document, a tag is a markup construct that starts with < and ends with >.

Discuss this Question

7. How many types of tags are there in an XML document?

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;

 start-tag, such as <section>;

 end-tag, such as </section>;

 empty-element tag, such as <line-break />.

Discuss this Question

8. Which is the correct XML declaration?

A. <xml version="1.0" encoding="UTF-8"/>

B. <xml version="1.0" encoding="UTF-8"></xml>

C. <?xml version="1.0" encoding="UTF-8"?>

D. <?xml type="document" version="1.0" encoding="UTF-8"?>

Answer: C) <?xml version="1.0" encoding="UTF-8"?>

Explanation:

The correct XML declaration is:

<?xml version="1.0" encoding="UTF-8"?>

Discuss this Question

9. In an XML document, the comments are written within ____.

A. /* and */

B. <!-- and -->

C. <# and >

D. @ and @

Answer: B) <!-- and -->

Explanation:

In an XML document, the comments are written within <!-- and -->.

Discuss this Question

10. In XML, DTD stands for ____.

A. Document Type Declaration

B. Data Type Definition

C. Document Type Definition


D. Document To Declaration

Answer: C) Document Type Definition

Explanation:

In XML, DTD stands for "Document Type Definition".

Discuss this Question

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

Answer: 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.

Discuss this Question

12. With respect to XML, SGML stands for ____.

A. Standard Generalized Markup Language

B. Standard General Markup Language

C. Strainer Generalized Markup Language

D. Standard Global Markup Language

Answer: A) Standard Generalized Markup Language

Explanation:

With respect to XML, SGML stands for "Standard Generalized Markup Language".

Discuss this Question

13. XML tags are case-sensitive?

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>

Discuss this Question

14. Which is the correct syntax of an empty element in XML?

A. <#element_name attribute1 attribute2...#>

B. <element_name attribute1 attribute2.../>

C. <element_name attribute1 attribute2…>

D. <element_name attribute1 attribute2...></element_name>

Answer: B) <element_name attribute1 attribute2.../>

Explanation:

The correct syntax of an empty element in XML is:

<element_name attribute1 attribute2.../>

Discuss this Question

15. An XML element can have ____.

A. multiple attributes

B. only two unique attributes

C. multiple unique attributes

D. None of the above

Answer: C) multiple unique attributes

Explanation:

An XML element can have multiple unique attributes.

Discuss this Question

16. Which is not a correct attribute type?

A. StringType

B. ArrayType

C. TokenizedType

D. EnumeratedType
Answer: B) ArrayType

Explanation:

The "ArrayType" is not a correct type.

Discuss this Question

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.

Discuss this Question

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.

Discuss this Question

19. Which is the correct syntax to link XML file with CSS?

A. <?xml type="text/css" href="file.css"?>

B. <?xml type="text/css" src="file.css"?>

C. <?xml-stylesheet type="text/css" href="file.css"?>

D. <?xml-stylesheet type="text/css" src="file.css"?>

Answer: C) <?xml-stylesheet type="text/css" href="file.css"?>


Explanation:

The correct syntax to link XML file with CSS is:

<?xml-stylesheet type="text/css" href="file.css"?>

Discuss this Question

20. What does SAX stand for ____.

A. Simple Application for XML

B. Safe API for XML

C. Super Application for XML

D. Simple API for XML

Answer: D) Simple API for XML

Explanation:

SAX stands for "Simple API for XML".

Discuss this Question

21. SAX in XML is used for ____.

A. Defining format of an XML document

B. Validating the XML file

C. Parsing XML documents

D. None of the above

Answer: C) Parsing XML documents

Explanation:

SAX is used for parsing XML documents.

Discuss this Question

22. Does SAX Parser create any internal structure?

A. Yes

B. No

Answer: B) No

Explanation:

No, SAX Parser does not create any internal structure.


Discuss this Question

23. In XML DOM, what does DOM stand for ____.

A. Document Object Model

B. Date Object Model

C. Document Oriented Model

D. Document Open Model

Answer: A) Document Object Model

Explanation:

In XML DOM, DOM stands for "Document Object Model".

Discuss this Question

24. How many types of XML databases?

A. 2

B. 3

C. 4

D. 5

Answer: A) 2

Explanation:

There are two types of XML databases.

 XML-enabled database

 Native XML database (NXD)

Discuss this Question

25. From the below given options, which is not a W3C-recommended Specification?

A. SAX

B. DOM

C. Both A and B

D. None of the above

Answer: A) SAX

Explanation:
SAX is not a W3C-recommended Specification.

Discuss this Question

26. What does XSNL stand for ____.

A. XML Simple Neutral Language

B. XML Software Neutral Language

C. XML Search Natural Language

D. XML Search Neutral Language

Answer: D) XML Search Neutral Language

Explanation:

XSNL stand for "XML Search Neutral Language".

Discuss this Question

27. XSNL acts between the meta search interface and targeted system.

A. meta search interface, XML document

B. meta search interface, targeted system

C. XML document, targeted system

D. None of the above

Answer: B) meta search interface, targeted system

Explanation:

XSNL acts between the "meta search interface" and "targeted system".

Discuss this Question

28. Which options are true regarding a well-formed XML document?

A. Each tag must have a closing tag

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.

D. All of the above

Answer: D) All of the above

Explanation:
All the above options (A, B, and C) and true to write a well-formed XML document,

 Each tag must have a closing tag

 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.

Discuss this Question

29. In an XML document, can we use graphics?

A. Yes

B. No

Answer: A) Yes

Explanation:

Yes, the graphics can be used within an XML document.

Discuss this Question

30. In an XML document, a graphics can be stirred using the ____.

A. XLink

B. XPointer

C. Both A and B

D. None of the above

Answer: C) Both A and B

Explanation:

In an XML document, a graphics can be stirred using the XLink and XPointer.

Discuss this Question

31. Can we create internal linking using XLink?

A. Yes

B. No

Answer: A) Yes

Explanation:

Yes, we can create internal linking using XLink.


Discuss this Question

32. Which XLink attribute defines the URL to link to?

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.

Discuss this Question

33. Which XLink attribute defines the type of the link?

A. xlink:type

B. xlink:kind

C. xlink:types

D. xlink:category

Answer: A) xlink:type

Explanation:

XLink attribute xlink:type defines / specifies the type of the link.

Discuss this Question

34. Which XLink attribute specifies where to open the link?

A. xlink:target

B. xlink:where

C. xlink:show

D. xlink:path

Answer: C) xlink:show

Explanation:

XLink attribute xlink:show specifies where to open the link.

Discuss this Question


35. What is the default value of XLink 'xlink:show' attribute?

A. embed

B. new

C. replace

D. other

Answer: C) replace

Explanation:

The default value of XLink xlink:show attribute is replace.

Discuss this Question

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:

The XMLHttpRequest Object is used to request data from a web server.

Discuss this Question

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.

Discuss this Question

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;

Answer: 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;

Discuss this Question

39. Is the following XML well-formed?

<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:

Yes, the above given XML well-formed.

Discuss this Question

40. XML has predefined tags?

A. Yes

B. No

Answer: B) No

Explanation:

No, XML has no predefined tags.

You might also like