XML interview questions

XML quiz questions

  • 1.

    What are the advantages of XML DOM Document?

    Answer:

    Advantages of XML DOM:

    • XML structure is traversable, and it can be randomly accessed by traversing the tree.

    • XML structure is modifiable, and values can be added, changed and removed

    View
  • 2.

    Can we have empty XML tags?

    Answer:

    Yes, we can have empty tags in XML. Empty tags are used to indicate elements that have no textual content. Empty tags can be represented as

     <person></person>
     
     <person/>

     

    View
  • 3.

    What is an attribute?

    Answer:

    An attribute provides more or additional information about an element than otherwise.

    Example:

    <Person name=”Peter”>

    Attribute name can be given to an element person.

    View
  • 4.

    What is XPath?

    Answer:

    XPath is used to find information in an XML document and contains standard functions. XPath is the major element in XSLT, and it is w3c recommendation.

    View
  • 5.

    What is XML DOM Document?

    Answer:

    XML Document object represents the whole XML document, and it is the root of a document tree. It gives access to entire XML document – Nodes and Elements, and it has its own properties.

    View
  • 6.

    Which tag is used to find the version of XML and the syntax?

    Answer:

    Declaring the XML version is very important for each XML document and platform needs to be specified in which it is running.

    <?xml version=”1.1” encoding=”|ISO-8859-1|”?>

     

    View
  • 7.

    What are the differences between HTML and XML?

    Answer:

    Following are the differences between HTML and XML:

    HTML

    XML

    Markup language used to display data Markup language used to store data
    Case Insensitive Case sensitive
    Designing web pages Used to transport and store data
    Predefined Tags Custom Tags
    Does not Preserve white spaces Preserve white spaces
    Static Dynamic
    View
  • 8.

    What are the features of XML?

    Answer:

    Main features of XML are:

    • Very easy to learn and implement

    • XML files are text files, and no editor is required

    • Minimal and a limited number of syntax rules in XML

    • It is extensible, and it specifies that structural rules of tags

    View
  • 9.

    What is a markup language?

    Answer:

    Markup languages are designed for presentation of text in different formats, and it can also be used for transporting and storing data. This markup language specifies the code for formatting, layout and style of data .This markup code is called Tag.

    HTML and XML are examples of Markup Language.

    View
  • 10.

    What is XML Namespaces?

    Answer:

    Provide a way for preventing tags with same names & different meanings from conflicting. 

    Has the form: <html xmlns = "http://www.w3.org" >
    Doesn't actually use the URLs

    You must declare a namespace with a prefix; the XML namespace without colons and a prefix is the default namespace (in the case below, HTML):

    <table xmlns="http://www.w3.org" xmlns:furn="http://www.furniture.org/tables" >
    <tr><td><furn:table sku="12312">Table</td></tr>
    <tr><td><furn:type>Coffee Table</td></tr>

    View
  • 11.

    Character Data Sections in XML

    Answer:

    Used to contain character data that you don't want to be parsed 

    <![CDATA[some text data]]>

    - Aka CDATA sections
    - Typically used when the character data contains a lot of characters like & or < that would be illegal in XML markup
    - Cannot nest--no CDATA section inside of another

    View
  • 12.

    Attribute naming conventions in XML

    Answer:

    - Specified at the start tag of an element
    - Must begin with underscore or letter, followed by letters, digits, periods, hyphens, or underscores
    - Can't use "xml" in the name at all
    - Attributes can only appear one time per element (invalid ex: <element attr="1" attr="2">

    View
  • 13.

    Tag naming conventions in XML

    Answer:

    <? xml version="1.0" encoding="utf-8" standalone="yes"?>

    - Must be at the very start of the document, no white space
    - Assumes encoding is UTF-8 if you don't set it otherwise
    - Standalone declaration states whether the documents stands by itself, or references other markup

    View
  • 14.

    XML Declaration

    Answer:

    <? xml version="1.0" encoding="utf-8" standalone="yes"?>

    - Must be at the very start of the document, no white space
    - Assumes encoding is UTF-8 if you don't set it otherwise
    - Standalone declaration states whether the documents stands by itself, or references other markup

    View
  • 15.

    Some disadvantage of XML

    Answer:

    - Handling large amounts of data
    - Difficult to read if a file has a large amount of information
    - Images and binary data not well represented
    - Simplicity makes it easy to get in over your head

    View
  • 16.

    XPointer and XLink

    Answer:

    Used to create hyperlinks to XML documents and arbitrary points within XML documents

    View
  • 17.

    What is XQuery?

    Answer:

    Used to perform query functions on XML data, similar to SQL for databases

    View
  • 18.

    What is Xpath?

    Answer:

    Extensible Path Language
    - Used to extract data from inside an XML file
    - Uses a path-like syntax

    View
  • 19.

    What is XML used for?

    Answer:

    - Intended for the Internet
    - A way to interchange data between disparate systems
    - Foundation for XTHML, RSS, AJAX
    - Does not replace HTML; more of a way to create tag sets like HTML for specific purposes

    View
  • 20.

    What is XML?

    Answer:

    Extensible Markup Language
    Used to structure and describe information

    - Tag-based syntax like HTML
    - You can make up your own tags

    View

© 2017 QuizBucket.org