XQuery

XQuery

Test your XQuery knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. What is XQuery primarily used for?

    • Creating databases
    • Querying XML data
    • Styling HTML documents
    • Replacing SQL
  2. Which type of data does XQuery work with?

    • JSON
    • YAML
    • XML
    • CSV
  3. What does FLWOR stand for in XQuery?

    • File, Loop, While, Output, Return
    • For, Let, While, Order, Return
    • For, Let, Where, Order by, Return
    • Find, Loop, Write, Output, Read
  4. Which symbol is used to define a variable in XQuery?

    • @
    • $
    • %
    • #
  5. Which keyword is used to assign a value in XQuery?

    • var
    • const
    • let
    • define
  6. What does the typeswitch expression in XQuery do?

    • Switches between XML schemas
    • Switches based on variable type
    • Filters by value
    • Joins multiple queries
  7. Which function is used to retrieve the length of a string?

    • length()
    • strlen()
    • string-length()
    • text-length()
  8. What will substring("XQuery", 2, 3) return?

    • XQu
    • Que
    • uer
    • Que
  9. What does the empty() function return?

    • true if sequence is not empty
    • false always
    • true if sequence is empty
    • the length of the sequence
  10. What is the purpose of exists() in XQuery?

    • Checks if a file exists
    • Tests if a variable exists
    • Returns true if sequence is non-empty
    • Counts elements
  11. What is a primary benefit of using XQuery modules?

    • Minifies output
    • Enables reusable functions across files
    • Adds support for CSS
    • Converts JSON to XML
  12. How do you handle runtime errors in XQuery?

    • Using try-catch
    • Using rescue blocks
    • Using catch-exception
    • Using error-on
  13. Which function raises a user-defined error in XQuery?

    • raise-error()
    • throw()
    • error()
    • fail()
  14. How can you define a function in a module?

    • define function local:name()
    • module function()
    • declare function local:name()
    • public function name()
  15. What does the fn:collection() function do?

    • Returns a sequence of nodes from multiple XML documents
    • Combines arrays
    • Compresses XML
    • Loads stylesheets