XQuery Interview Questions & Answers

  1. Question 1. What Is Xquery?

    Answer :

    XQuery is a XML query language which was designed to query XML data. It is same like SQL for database tables. XQuery is used to retrieve data from the XML file.

  2. Question 2. What Is The Use Of Xquery Language?

    Answer :

    XQuery is a functional language for finding and extracting elements and attributes from XML documents. Its main usages are:

    • To retrieve both hierarchal and tabular data.
    • To query tree and graphical structures.
    • To build web pages.
    • To query web pages.
    • To transform XML documents into XHTML documents.
    • Best for XML-based databases and object-based databases. Object databases are much more flexible and powerful than purely tabular databases.
  3. C Interview Questions

  4. Question 3. In Which Year Xquery Was First Appeared?

    Answer :

    XQuery was first appeared in 2007. It was designed by W3C and became the W3C recommendation on January 23, 2007. XQuery 3.0 is a W3C recommendation from April 8, 2014.

  5. Question 4. Explain The Syntax Rules For Xquery.?

    Answer :

    A list of basic syntax rules for XQuery:

    • XQuery is case sensitive.
    • Attributes and variables that we used should have valid XML names in XQuery elements.
    • XQuery should be written within single and double quotes.
    • XQuery variables should be defined as: $(variable name). For example: $book.
    • XQuery comment can be written between colon (:). like :(: Comment in XQuery:)
  6. C Tutorial

  7. Question 5. What Is The Difference Between Xquery And Xpath?

    Answer :

    Difference between XQuery and Xpath:

    XQuery is a functional programming and query language while XPath is XML path language.

    XQuery is used to extract and manipulate data from either XML documents or relational databases while XPath is used to compute values like strings, numbers and Boolean types from another xml documents.

     

  8. Oracle Interview Questions

  9. Question 6. What Is The Difference Between Xquery And Xslt?

    Answer :

    • XQuery is program driven while XSLT is document-driven.
    • XQuery is declarative while XSLT is functional.
    • XSLT is written in XML while XQuery is not written in XML.
  10. Question 7. How To Define Functions In Xquery?

    Answer :

    XML has many build-in functions. XQuery functions generally made perform with string values, numeric values, date and time comparisons, Boolean values etc.

    XQuery also facilitates you to make your own functions.

  11. Java Tutorial
    Java Interview Questions

  12. Question 8. How To Call Xquery Functions:

    Answer :

    Example 1: When you use function in an element.

    {uppercase($booktitle)}  

    Example 2: When you use function in the predicate of a path expression.

    doc(“bookmart.xml”)/bookstore/book[substring(title,1,5)=’Jungle’]  

    Example 3: When you use function in a let clause

    let $name := (substring($booktitle,1,4))

  13. Question 9. How To Perform Comparison In Xquery?

    Answer :

    In XQuery, comparison is performed with general comparison or value comparison.

    1. General Comparison: It is performed by using the following symbols.

    Ex: =, !=, <, <=, >, >=

    2. Value Comparison: The value comparison is performed by using the following symbols.

    Ex: ne, lt, le, eq, ge, gt.

    See this example:

    $bookstore//book/@q > 100  

    If any q attributes have values greater than 100, the expression will return true otherwise false.

  14. Oracle Service Bus Interview Questions

  15. Question 10. Which Types Of Problems Can Be Solved By Xquery?

    Answer :

    • XQuery can be used to solve the following queries in XML data:
    • XQuery is used to retrieve information in a web service.
    • It is used to generate summary report.
    • It is used to transform data from XML to XHTML.
  16. XPath Tutorial

  17. Question 11. What Do You Mean By Xquery Flwor?

    Answer :

    FLWOR is an acronym which stands for “For, Let, Where, Order by, Return”.

    For – It is used to select a sequence of nodes.

    Let – It is used to bind a sequence to a variable.

    Where – It is used to filter the nodes.

    Order by – It is used to sort the nodes.

    Return – It is used to specify what to return (gets evaluated once for every node).

  18. XPath Interview Questions

  19. Question 12. What Is The Use Of Xquery Html Format?

    Answer :

    XQuery HTML format is a way to transform an XML document into an HTML page.

  20. C Interview Questions

  21. Question 13. What Is Selecting And Filtering Element In Xquery?

    Answer :

    XQuery FLWOR and Path expression are used for selecting and filtering the XML elements. Both are used to select and filter the desired elements.

    For example:

    for $a in doc(“bookmart.xml”)/bookstore/book  
    where $a/price<150  
    order by $a/title  
    return $a/title

  22. XQuery Tutorial

  23. Question 14. How To Perform Conditional Operations In Xquery?

    Answer :

    Conditional operation in XQuery is If-Then-Else operation. Let?s take an example to see how to use it:

    Example:

    for $a in doc(“bookmart.xml”)/bookstore/book  
    return  if ($a/@category=”ADVENTURE”)  
    then {data($a/title)}  
    else {data($a/title)} 

  24. Question 15. What Is The Syntax Of Xquery Language?

    Answer :

    The elements, attributes and variables in XQuery language must be valid XML names and follow case sensitivity.

  25. XSLT Interview Questions

  26. Question 16. What Do You Mean By Xquery Add?

    Answer :

    XQuery Add is used for adding elements, attributes, HTML elements and text in the results from the input documents.

  27. Document Type Definition (DTD) Tutorial

  28. Question 17. How To Use Xquery Flwor With Html?

    Answer :

    If you want to put HTML element with XQuery FLWOR, you should have to add and tags into the FLWOR expression.

    For example:

         
      {    
      for $x in doc(“books.xml”)/bookstore/book/title    
      order by $x    
      return

    • {$x}
    •    
      }    

     

  29. Document Type Definition (DTD) Interview Questions

  30. Question 18. What Are The Different Types Of Xquery Functions?

    Answer :

    A list of different types of XQuery functions:

    • Accessor Functions
    • Error and Trace Functions
    • Numeric Functions
    • String Functions
    • AnyURI Functions
    • Boolean Functions
    • Duration/Date/Time Functions
    • QName Functions
    • Node Functions
    • Sequence Functions
    • Context Functions
  31. Oracle Interview Questions

  32. Question 19. What Is The Use Of Time And Date Function In Xquery?

    Answer :

    In XQuery, time and date function is used to get time and date.

    There are three types of time and date functions in XQuery:

    1. current-date()
    2. current-time()
    3. current-datetime()
  33. XSD Tutorial

  34. Question 20. What Is The Use Of Current-date() Function In Xquery?

    Answer :

    The XQuery current date function is used to retrieve the current date.

  35. XSD Interview Questions

  36. Question 21. What Is The Use Of Current-time() Function In Xquery?

    Answer :

    The XQuery current-time function is used to retrieve the current time.

  37. Question 22. What Is The Use Of Current-datetime() Function In Xquery?

    Answer :

    The XQuery current-date time() function is used to return the current date and time.

  38. WSDL Tutorial