XPath

XPath

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


  1. What does XPath stand for?

    • XML Path Language
    • XML Pattern Analyzer
    • External Path System
    • Extended Pattern Hub
  2. What is the root node symbol in XPath?

    • ./
    • //
    • /
    • #
  3. What does // represent in XPath?

    • Current node
    • Root node
    • Selects nodes anywhere in the document
    • Attribute selector
  4. What does @ symbol denote in XPath?

    • Element
    • Attribute
    • Comment
    • Namespace
  5. Which of the following selects all <book> elements?

    • book/*
    • /book
    • //book
    • @book
  6. What does the ancestor axis select in XPath?

    • Direct parent only
    • All parent and grandparent nodes
    • All child nodes
    • Sibling nodes
  7. What is the result of //book[price>35]?

    • Books with exactly 35 price
    • Books with no price
    • Books with price greater than 35
    • Books without titles
  8. What does the expression //book[1] mean?

    • First book under every parent
    • Only books named “1”
    • First book in the entire document
    • Last book in the document
  9. What does the following-sibling axis select?

    • Siblings before the current node
    • Direct parent node
    • All nodes after current at same level
    • Root node
  10. Which XPath selects all attributes named lang?

    • //@lang
    • //lang
    • /@lang
    • lang/@
  11. Which version of XPath introduced strong typing and regular expressions?

    • XPath 1.0
    • XPath 1.5
    • XPath 2.0
    • XPath 3.0
  12. What does the XPath 2.0 tokenize() function return?

    • Number of tokens
    • A boolean
    • A sequence of strings
    • Null
  13. In XPath 2.0, what does the expression matches("XML123", "\d+") return?

    • FALSE
    • TRUE
    • 123
    • XML
  14. Which XPath version introduced sequence manipulation?

    • XPath 1.0
    • XPath 2.0
    • XPath 3.0
    • XPath 1.1
  15. What does every $x in (1, 2, 3) satisfies $x > 0 evaluate to?

    • FALSE
    • TRUE
    • (1, 2, 3)
    • Error