- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
XQuery Interview Questions & Answers - Learning Mode

XQuery Interview Questions & Answers - Learning Mode

XQuery is designed to query XML data - not just XML files, but anything that can appear as XML, including databases. XQuery contains a superset of XPath expression syntax to address specific parts of an XML document. It supplements this with a SQL-like "FLWOR expression" for performing joins.

Try XQuery Interview Questions & Answers - Exam Mode


Sort By : Latest First | Oldest First | By Rating

XQuery Interview Questions & Answers - Learning Mode
Try XQuery Interview Questions & Answers - Exam Mode
Question: How to perform comparisons in XQuery?

Answer: In XQuery we can compare the values with general comparisons and value comparisons.

1. General Comparisons : We perform general comparisons by using these symbols.
Ex. =, !=, <, <=, >, >=

2. Value Comparisons : We use these symbols to perform value comparisons.
Ex. ne, lt, le, eq, ge, gt.

Now, I given you how to use comparisons in XQuery.
$bookstore//book/@q > 100
If any q attributes have values which is greater than 100 expression will return tru Source:
Question: How to perform conditional operations in XQuery?

Answer: I have given you how to use conditions in XQuery.
For example I told you how to use
"If-Then-Else" expressions in XQuery.
for $a in doc("bookmart.xml")/bookstore/book
return if ($a/@category="ADVENTURE")
then <child>{data($a/title)}</child>
else <adult>{data($a/title)}</adult>

<adult>Jungle Book</adult>
<child>The Book of the Thousand Nights and a Night </child>
<adult>XML Programing< Source:
Question: How to add elements and attributes with XQuery in XML data?

Answer: Consider the example "bookmart.xml".I write an expression to return litle and lang elements both.
for $a in doc("bookmart.xml")/bookstore/book/title
order by $a
return $a

<title lang="en">Jungle Book</title>
<title lang="en">The Book of the Thousand Nights and a Night</title>
<title lang="en">XPath and XPointer</title>
<title lang="en">XML Programing</title>

Now, I will told you how to add elements and Source:
How you use XQuery FLWOR with HTML?

Answer: Consider previous example.If you want to find list of all titles from book in our bookstore with in HTML.Than we should have to add <ul> and <li> tags into the FLWOR expression.

Question: What do you mean by selecting and Filtering elements in XQuery?

Answer: We can selecting and filtering the xml elements with FLWOR and Path expression.
I have given you a FLWOR expression:
for $a in doc("bookmart.xml")/bookstore/book
where $a/price<150
order by $a/title
return $a/title
1. for : It is an optional and use to bind a variable to each item.
for $a in (1 to 5)
return <test>{$a}</test>
Question: 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 has also give us facility to made our own functions.
Now, I told you how to call XQuery functions.
Ex 1: When you use function in an element.

Ex 2: When you use function in the predicate of a path expression.
doc("bookmart.xml")/bookstore/book[substring(title,1,5) Source:
Question: Give us syntax rules of XQuery?

Answer: I have given you some basic syntax rules of XQuery.
1. XQuery is an case sensitive.
2. In XQuery elements , attributes and variables that we used should have valid XML names.
3. Should write XQuery with in single and double quotes.
4. We defined XQuery variable with like: $(variable name).e.g. $book.
5. We can write XQuery comments between colon(:). like:(:Comment in XQuery:)
Question: What is the major difference when we use xslt or xquery to transform any xml. My question is more in terms of getting the xml schema definition changed. who actually makes this kind of impact on schema definition of xml, xslt or xquery.

Answer: No answer available currently.
Question: How you define terms in XQuery?

Answer: Ther are seven kinds of nodes in XQuery.These are,
6.document or root
7.processing-instruction nodes
Question: How to perform operation on node using XQuery function in XML?Explain with an example?

To explain given problem first I written a example in XML.
Save the given XML file with "bookmart.xml"

<?xml version="1.0" encoding="ISO-8859-1"?>
<book category="CHILDREN">
<title lang="en">Jungle Book</title>
<author>Rudyard Kipling</author>
<book category="ADVENTURE">
<title lang="en">Th Source:
Question: How to use FLWOR expression given by XQuery in XML data?

Answer: We use FLWOR expression with XQuery like that,

for $a in doc("bookmart.xml")/bookstore/book
where $a/price<150
return $a/title

We use above expression to select all title elements in bookmart element from bookstore element those has price smaller than 150.


<title lang="en">Jungle Book</title>
<title lang="en">The Book of the Thousand Nights and a Night </title>
We can also acheive this by using path expression like th Source:
Question: WHich type of problems we can solved with XQuery?

Answer: We use XQuery to solve some queries in an XML data like:
1. Use XQuery to retrieve information in a web service.
2. Use XQuery to generate summary report.
3. Using XQuery we can transform data from XML to XHTML.
4. Use XQuery when we want some relevant information from Web documents. Source:
Question: How you define atomic values?

Answer: Consider the example that have written given below:
<?xml version="1.0" encoding="ISO-8859-1"?>
<title lang="en">Jungle Book</title>
<author>Rudyard Kipling</author>
What is XQuery?

Answer: XQuery is stands for XML Query. XQuery 1.0 has W3c recommendation Since 23 Jan 2007.
We use XQuery to solve the queries of XML database.
Some basic information about XQuery are:
1.Using XQuery we can solve the queries of an XML data.
2.We can say work of XQuery for XML are same as SQL for database.
3.XQuery is compatible with database engines like: Oracle, Microsoft etc.
4.XQuery can work with many W3C standardds like: XML, XPath, XML Schema and XSLT.



India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.09375 Seconds