rh banner

Sunday, 4 January 2015

xQuery Interview Questions - How to tackle tough / Tricky questions?

xQuery Interview Questions - How to tackle tough / Tricky questions?

What is xQuery?

It is designed to be a language in which queries are concise and easily understood. It is also flexible enough to query a broad spectrum of XML information sources, including both databases and documents. The Query Working Group has identified a requirement for both a non-XML query syntax and an XML-based query syntax.

Features of XQuery:
1) Logical and physical data independence
2) Declarative
3) High level
4) Side effect free
5) Strongly typed language

Importance of expression in xQuery?

The basic building block of XQuery is the expression, which is a string of [Unicode] characters. The language provides several kinds of expressions which may be constructed from keywords, symbols, and operands. In general, the operands of an expression are other expressions. XQuery allows expressions to be nested with full generality.

Error handling in xQuery?

XQuery defines a static analysis phase, which does not depend on input data, and a dynamic evaluation phase, which does depend on input data. Errors may be raised during each phase.
There are 3 different types of error handling. They are
A static error is an error that must be detected during the static analysis phase. A syntax error is an example of a static error.
A dynamic error is an error that must be detected during the dynamic evaluation phase and may be detected during the static analysis phase. Numeric overflow is an example of a dynamic error.
A type error may be raised during the static analysis phase or the dynamic evaluation phase. During the static analysis phase, a type error occurs when the static type of an expression does not match the expected type of the context in which the expression occurs. During the dynamic evaluation phase, a type error occurs when the dynamic type of a value does not match the expected type of the context in which the value occurs

How you define atomic values?

 Consider the example that have written given below:
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
  <title lang="en">Jungle Book</title>
  <author>Rudyard Kipling</author>
  <year>1894</year>
  <price>99.89</price>
</book>
</bookstore>
Atomic values are those nodes which have no children and parent.

How to define functions in XQuery? 

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.
When you use function in a let clause
let $name := (substring($booktitle,1,4))

Give us syntax rules of XQuery? 

XQuery is an case sensitive.
In XQuery elements , attributes and variables that we used should have valid XML names.
Should write XQuery with in single and double quotes.
We defined XQuery variable with like: $(variable name).e.g. $book.
We can write XQuery comments between colon(:). like:(:Comment in XQuery:)

How to perform comparisons in XQuery? 

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.

Explain about core validation? 

During the process of XML validation two processes are followed which are 1) Reference validation and 2) Signature validation Record digest value is used to verify digital signature. In signature validation a process called Canonicalization is used, in this key info is used to verify the signature.

How can I find a specific image within a web page?  

To find an image within a web page, you can use one of the following approaches:
► Search for the IMG element whose SRC attribute contains the file name of the desired image. To perform the search, use the Page.NativeWebObject.Find method (see the method?s description above).
► Use TestComplete?s image-search capabilities. You can call the Picture method of the web browser window to obtain a Picture object holding the window image, and then use the Find method of this object to search for the desired image. This method returns a rectangle that specifies coordinates of the image within the web browser window. To obtain the scripting object corresponding to the found image, you can use the Sys.ObjectFromPoint method. Both approaches are equally valid, however, finding the image by name works much faster

What is a UID and how do I get one?

The Unique Identifier (UID) is a unique identification for the binary (EXE or DLL) within the system. Its purpose is to prevent executables from interfering with each other. For S60 3rd Edition applications UIDs have to be reapplied.

What is the importance of xQuery and why it is used?

XQuery is replacing property middleware languages and Web Application development languages. XQuery is replacing complex Java or C++ programs with a few lines of code. XQuery is simpler to work with and easier to maintain than many other alternatives. It is used as a back end for implementing Web sites, Web project, integrating corporate data stores in the enterprise, in the XRX architecture (XForms, REST and XQuery), as well as for large publishing projects, for data mining, and for academic research. It can run on large servers and on mobile devices, as part of commercial software and as open source.

Difference between XQuery and XSLT.
XSLT is document-driven; XQuery is program driven.
XSLT is functional; XQuery is declarative.
XSLT is written in XML; XQuery is not.

Advantage of Xquery:
XQuery statements are shorter than similar SQL or XSLT programs.
XQuery combines the processing power of XPath and XSLT into one consistent language.
XQuery can convert XML into almost any output format, from HTML over XHTML to WML, SVG, SMIL, etc. This allows support not only for HTML clients but also for mobile clients, and for multimedia applications.
User-definable XQuery functions allow for modular query expressions.
The XML Schema type system and namespaces are fully supported.
XQuery 4 features easy-to-read SQL-like syntax. An alternative syntax (XQueryX) allows the formulation of queries as XML documents. XQuery 4 also supports insert, update and delete operations.
XQuery can query both hierarchical and tabular data.
XQuery has a consistent syntax and can be used with other XML standards such as XML Schema datatypes.
XQuery can query many different data structures and its recursive nature makes it ideal for querying tree and graph structures.
XQuery can be learned by anyone familiar with SQL.
Both XQuery and SQL have easy ways to select distinct values from a result set.