Q1.What is XML?
XML, Extensible Markup Language, is an open, text based markup language that provides structural and semantic information to data. XML is a metalanguage that can be used to create other language. It is used to structure and describe data that can be understood by other applications. Using XML, we can separate the user interface from data.
Q2.Features of XML
XML is a generalized markup language that means one can define his/her own tag sets.
A valid XML document contains rules and is self-describing.
The rules that are found in DTD allow the documents to be validated.
Q3.Describe the logical structure of XML.
XML documents comprise of declaration, elements and comments
XML Declaration
It identifies the version to which XML conforms
Document Type Declaration
It consists of markup code that indicates grammar rules or Document Type Definition (DTD) for the particular class of document.
This statement tells the XML processor that the document is of the class Car that conforms the rules specified in the DTD "cr.dtd".
Document element
The document element contains data of an XML document.
Q4.Why is XML so popular?
Due to the following advantages of using XML, it has become popular:
- It supports Unicode. Therefore documents written in any human language can be communicated.
- Data structures: records, lists and trees can be represented using XML.
- Its format describes structure, field names and their specific values too. Its therefore called self-documenting.
- Its syntax and parsing requirements make the necessary parsing algorithms very simple, efficient, and consistent.
- It can be used as a document storage and processing format.
- It is platform-independent.
Q5.Why is XML referred as self-describing data?
Text labels inside of XML's syntactic delimiters that cause most people to think that XML is self-describing. But these tags aren't part of XML.
Choosing the terms used for tags or naming anything is often a difficult and contentious activity. Everyone naturally creates names that make sense to them.
However, XML is not self describing.
Q6.Why is XML extensible?
Extensibility is another attribute of XML. XML is short of "eXtensible Markup Language. This is so because a developer may easily create his own XML syntax for any applications he wishes to use it for. Any other developer, once having learned how to use his own language's XML parsing routines, can use any XML-based format currently available.
Q7.Explain in detail, XML is a secured language for information exchange over the network.
Applications require a secure exchange of structured data. XML encryption can ensure this by providing end-to-end security as it is iitself a widely used data structuring technology.
XML encryption addresses the issues not covered in by the TLS which are encrypting part of the data that is being exchanged and secure sessions between multiple parties.
XML Encryption can handle XML as well as binary data
Q8.list the rules to be followed by an XML document.
Following rules need to be followed by an XML document:
They must have a root tag, the document should be well formed : the tags should be properly closed, since XML is case sensitive, one should take care that the documents are written with proper care and the attribute values should be inside “”
Q9.Explain about XML Canonicalization.
Canonicalization refers to finding the simplified form of an XML document.XML files may not contain the same sequence of characters (bytes or octets) even if they are logically equivalent. This is where we need to canonicalize them and check their canonical forms.
Steps to canonicalize an XML document
- Encoding schemes should represent characters by octets.XML documents should be encoded in UTF-8 encoding.
- The canonical form needs all line breaks to be #xA.
- All attributes need to be normalized in canonical form.
Q10.Define DTD (Document Type definition).
DTD - Document Type Definition defines the legal building blocks of an XML document.
It defines the document structure with a list of legal elements and attributes.
XML DTD is a rule book that an XML document follows. Once DTD is ready, you can create number of XML documents following the same rules specified in the DTD. DTD can be internal or external DTD. The internal DTD is included in the XML document, while external DTD exists outside the content of the documents.
Q11.Explain DTD and schema.
A DTD provides a list of the elements, attributes, comments, notes, and entities contained in an XML or HTML document and indicates their relationship with each other.
The 'DOCTYPE' tells the browser that it is a Document Type Declaration
Some commonly used attribute types are
- CDATA The value is character data
- ID The value is a unique id
- IDREF The value is the id of another element
- IDREFS The value is a list of other ids
Schema means the organization and the structure of a database.
E.g.: An XML schema is a description of XML document. It is expressed in terms of constraints on the structure and content of documents.
Q12.Define XML DTD.
XML DTD is a rule book that an XML document follows. Once DTD is ready, you can create number of XML documents following the same rules specified in the DTD. DTD can be internal or external DTD. The internal DTD
Q13.What is a CDATA section in XML?
CDATA - (Unparsed) Character Data
The term CDATA is used when you dont want some text data to be parsed by the XML parser.
A CDATA section starts with "":
Q14.What is a CDATA section in XML?
The CDATA section of XML is used to describe the text that should not be parsed by the XML parser.
The characters like "<" ">" are not supported in XML
"<" will cause an error by the parser. Because the parser identifies < as the starting character for an element.
Any text that is included in CDATA section is ignored by the parser.
Example :
The
Q16.Define CSS and XSL.
XSL is a language for expressing style sheets. An XSL style sheet is a file that describes the way to display an XML document.
Cascading Style Sheets is an answer to the limitations of HTML, where the structure of documents was defined and not the display. CSS formats documents for display in browsers that support it.
Q17.How do you display XML with XSLT?
First you need to declare the XSL style sheet:
Then,
you create an XSL Style Sheet with a transformation template.
Add the XSL style sheet reference to your XML document to link them.
Q18.What is XQuery?
Xquery is a query language that is used to retrieve data from XML documents.
XQuery is a way to query the XML data, It is built on XPath expressions and is supported by quite a few database engines.
It can find and extract elements and attributes from XML documents.
XQuery is written in FLWOR fashion which stands for: For, Let, Where, Order by, Return
An example of XQuery is:
for $x in doc("abc.xml")/abc_name
where $x/a>30
order by $x/b
return $x/c
Q19.What is XPATH?
XPath is a language that describes how to locate specific elements (and attributes, processing instructions, etc.) in a document.
An XSL sublanguage designed to uniquely identify or address parts of a source XML document, for use with XSLT.
It is based on a tree representation of XML document. It provides the ability to navigate around the tree and to select the nodes by a variety of criteria.
The simplest XPath is /A/B/C where C is the child of B, B child of A.
Q20.What is XMLA ?
XML for Analysis,
It is a Microsoft specified XML-messaging-based protocol for exchanging analytical data between client applications and servers using HTTP and SOAP as a service on the Web
Q21.What is DOM?
DOM is an interface-oriented Application Programming Interface. It allows for navigation of the entire document. A DOM document can be created by a parser, or can be generated manually by users. Data types in DOM Nodes are abstract. DOM implementations generally require the entire document to be loaded into memory and constructed as a tree of objects before access is allowed. DOM is supported in Java. Its specification is regulated by the World Wide Web Consortium.
Q22.Explain the difference between DOM and SAX.
SAX parser works incrementally and generates events that are passed to the application. DOM parser reads the whole XML document and returns a DOM tree representation of xml document
In DOM the xml file is arranged as a tree and backward and forward search is possible In SAX traversing in any direction is not possible as Top to bottom approach is used.
SAX is essentially an API for reading XML, and not writing it. DOM allows you to read and write.
Q23. Explain the features of DOM.
DOM is Document Object Model. It is used to read data from a XML document. It is more commonly used in applications where data in the document needs to be repeated accessed. DOM supports navigation in any direction. XML DOM is typically used for XML documents. The DOM defines the objects and properties of all document elements, and the methods (interface) to access them.
Q24.What is SAX? Explain its features.
SAX is Simple API for XML. It is used to read data from a XML document. A parser that uses SAX parses the XML serially. The API is event driven and these events are fired when the XML features are encountered. XML parsing is unidirectional. Memory used by a SAX parses is relatively low. Due to the event nature of SAX, the parsing is faster of an XML document.
Q25.What is XML Namespace?
An XSL sheet or a document may have duplicate elements and attributes. Therefore, the XML namespaces define a way to distinguish between duplicate element types and attribute names.
An XML namespace is a collection of element type and attribute names. It is a URI due to which any element type or attribute name in an XML namespace can be uniquely identified.
It consists of two parts : the name of the XML namespace and the local name.
e.g.: xmlns: h=”http://www.abc.com”
After this, you can write
……..
to associate the table with the declared namespace.
Q26.What is XML data binding?
XML data binding refers to the process of representing the information in an XML document as an object in computer memory.
The limitations of data binding include round tripping of elements and attributes. XML data binding product generates documents that are invalid because of sibling order. They do not preserve physical constructs. They do not preserve comments and processing instructions.
Q27.What is an XML encoding error?
XML documents can contain non ASCII characters, like Norwegian æ ø å , or French ê è é which introduce errors.
The 2 types are:
An invalid character was found in text content.
Switch from current encoding to specified encoding not supported.
You can avoid these errors by specifying the XML encoding Unicode
Q28.What is XML Serialization and Binary Serialization?
XML Serialization makes it possible to convert any common language runtime objects into XML documents or streams and vise versa.
The XML Serialization enables it to convert XML documents into such a meaningful format that the programming languages can process the converted documents with ease.
Binary serialization converts the files to a binay format. In this case all the data get converted into a binary format which is not a human readable format. In binary serialization entire object state is saved, instance identity is preserved and it graphs with multiple references can be handled in this.
XML serialization doesnt allow these things.
Q29.How do you load data from XML file to a ORACLE table?
You need to first create a table in oracle that matches with the fields of the XML data.
So to get the XMl into the table, you can create a generic procedure that moves an XML document into a table by converting the elements to Oracle Canonical format.
Q30.What are XML indexes and secondary XML indexes?
The primary XML index is a B+tree and is useful because the optimizer creates a plan for the entire query.
It is always better to split the entire XML columns into relational rows and columns.
The primary XML index contains one row for each node in the XML instance.
The secondary XML indexes can be created to enhance the performance.
There are the types of secondary indexes:
PATH secondary XML index
If the use of path expressions on XML columns is prominant, the PATH secondary XML index can speed up the task.
VALUE secondary XML index
The VALUE index can be used if your task involves quering unknown attribute names.
PROPERTY secondary XML index
Clustering paths within each XML instance in the PROPERTY index can be beneficial when multiple values are retrieved from individual XML instances
Q31.What is the purpose of FOR XML in SQL Server?
SQL Server 2000 provides the facility to retrieve data in the form of XML with the help of the FOR XML clause appended to the end of a SELECT statement.
There are 3 types of FOR XML modes — RAW, AUTO, and EXPLICIT.
They all generate a different style of XML document
Q32.What is the OPENXML statement in SQL Server?
Going through thousands of lines of XML degrades performance to a great extent.This is where the OPENXML function comes into use. It does the parsing work for you quite efficiently.
The syntax of OPENXML is:
OPENXML(idoc int [in],rowpattern nvarchar[in],[flags byte[in]]) [WITH (SchemaDeclaration | TableName)]
OPENXML function is supposed to be used with two system stored procedures:
1.sp_xml_preparedocument
2.sp_xml_removedocuments
Q33.What is the Document Object Model, DOM?
Document Object Model (DOM) is used to query, traverse and manipulate documents like XML or HTML documents. DOM is best suited where the document must be accessed repeatedly or out of sequence order. DOM allows accessing the contents of a web page. It also allows dealing with events that allows capturing and responding to user’s actions. There are different levels of DOM standards depending on the compatibility of the browsers
Q34.What is the HTML DOM?
The HTML DOM API specializes and adds the functionality to relate to HTML documents and elements. It addresses the issues of backwards compatibility with the Level 0 of DOM and provides mechanisms for common and frequent operations on HTML documents
Q35.Difference between XML and SGML
XML does not allow References to external data entities. Named character references are not allowed in XML. XML does not allow empty comment declaration. SGML allows bracketed text entities. SGML declaration cannot be explicit. In XML an end-delimiter is always required
Q36.What is Document Object Model?
Document Object Model (DOM) is used to query, traverse and manipulate documents like XML or HTML documents. DOM is best suited where the document must be accessed repeatedly or out of sequence order. DOM allows accessing the contents of a web page. It also allows dealing with events that allows capturing and responding to user’s actions. There are different levels of DOM standards depending on the compatibility of the browsers.
Q37.What is XML DTD? What are XML documents?
DTD is Document Type Definition is used to define the XML’s document structure. It can be inside an XML document or outside. If it is declared inside the XML, it needs to follow the syntax - . If it is external to the XML document it needs to follow the syntax: . Here, filename is where the DTD is defined. DTD is used to verify data and can be used as a standard for exchanging data. The XML document which uses the DTD has the XML tags in it. It is in the XML document, the tags or the elements are defined for the data.
Q38.Explain what makes XML so important?
- XML is used to transfer data across different networks.
- It supports Unicode thereby accepting almost any form of human language.
- It is strongly used for processing and storage of document.
- It is independent of any platform.
- It has a hierarchical structure thereby making it easier to comprehend.
- Allows validation using schema languages such as XSD.
- Can be used to represent common data structures, trees etc
Q39.Explain the features of XML
- XML or Extensible Markup Language - Provides a standard for easy transfer of data.
- For web applications, using XML avoids many hits on the server.
- XML can be easily converted into formats like PDF, plain text etc.
- Can be used to encode documents and to serialize data.
- XML supports the use of varied Unicode characters in its tags.
- XML is based on international standards
- It is independent of any platform.
Q40.Explain how is partitioning an important part of database optimization.
Database partitioning is the process of splitting one large table of a database logically into smaller physical entities. Partition benefits in
- Improving query performance dramatically in situations when most of the heavily accessed rows of the table are in a single partition.
- To access large percentage of a single partition the queries or updates are accessed by queries, the performance can be improved by taking advantage of scanning the partition sequentially.
- Data that is seldom used could be migrated for cheaper and slower storage media.
Q41.What is database partitioning?
Database partitioning is the process of dividing logical database / its elements into independent parts. Database partitioning is done for manageability, performance reasons. A popular application for database partitioning is distributed database management system. Every partition spreads over multiple nodes and local transactions on the partition can be performed by the users. This process increases the performance of sites which involved with regular transactions. The database partitioning can be done by building databases which holds data of partitions.
Q42.Explain Execution Plan.
- SQL Server caches the plan of execution of query or stored procedure which it uses in subsequent call.
- This is a very important feature with regards to performance enhancement.
- You can view execution plan of data retrieval graphically or textually.
Q43.What are the ways to code efficient transactions?
- We shouldn't allow input from users during a transaction.
- We shouldn't open transactions while browsing through data.
- We should keep the transaction as short as possible.
- We should try to use lower transaction isolation levels.
- We should access the least amount of data possible while in a transaction.
Q44.Reasons of poor performance of query.
- No indexes
- Excess recompilations of stored procedures.
- Procedures and triggers without SET NOCOUNT ON.
- Poorly written query with unnecessarily complicated joins
- Highly normalized database design.
- Excess usage of cursors and temporary tables
Q45.How is index tuning used to improve query performance?
Index tuning improves query performance by using Index Tuning Wizard. SQL profiler is used for capturing a trace of the activity, for the optimizing performance. The trace can be extended for a period of time for the purpose of capturing a wide range of activity. Subsequently, Enterprise manager is used for starting the Index Tuning Wizard and instructs to recommended indexes which are based on the trace that is captured. An estimation of increased performance after making changes is provided apart from appropriate columns suggestion.
Q46.What is Index tuning?
Index tuning is part of database tuning for selecting and creating indexes. The index tuning goal is to reduce the query processing time. Potential use of indexes in dynamic environments with several ad-hoc queries in advance is a difficult task. Index tuning involves the queries based on indexes and the indexes are created automatically on-the-fly. No explicit actions are needed by the database users for index tuning.
Q47.What is a join and explain different types of joins.
Joins are utilized to get the results from two or more tables. There are two types of joins available.
1. Outer Join: Outer join has two categories – left outer join and right outer join. In this join functionality, two or more tables are joined by including blank rows in the specified side, once the criterion satisfies.
The combination of left outer join and right outer join is simple outer join.
2. Inner Join: In this join functionality, two or more tables are joined by leaving the blank rows for checking.
Other than these two joins, there are-
Natural Join: This join is the Cartesian product.
Equi Join: A condition includes an operator
NonEqui Join: They are conditional joins which does not use their conditions
Q48.What is Data Warehousing?
Enterprise’s data is electronic repository in data warehouse. Reporting and analysis facilitates are designated by data warehousing. The means for retrieving and analyzing data for extraction, transformation and loading is considered as mandatory components in data warehousing system. It includes the management of data dictionary. It includes business intelligence tools.
Data warehousing is a framework that permits the enterprise management to manage the information
Q49.What is "correlated sub queries"?
A correlated sub query is a type of sub query. Unlike sub query, a correlated sub query is dependent upon the outer query, which returns a value. When a reference to the outer query is found in the sub query, then the outer query will execute first, and the result will be returned to the correlated sub query. The sub query is executed alter for every row that is selected in the outer query
Q50.What is Data Warehousing?
Enterprise’s data is electronic repository in data warehouse. Reporting and analysis facilitates are designated by data warehousing. The means for retrieving and analyzing data for extraction, transformation and loading is considered as mandatory components in data warehousing system. It includes the management of data dictionary. It includes business intelligence tools.
Data warehousing is a framework that permits the enterprise management to manage the information
Q51.What is "correlated sub queries"?
A correlated sub query is a type of sub query. Unlike sub query, a correlated sub query is dependent upon the outer query, which returns a value. When a reference to the outer query is found in the sub query, then the outer query will execute first, and the result will be returned to the correlated sub query. The sub query is executed alter for every row that is selected in the outer query.
Q52.What are the restrictions applicable while creating views?
The following are the restrictions for creating views in RDBMS;
- Views can be created only in the current database.
- A computed value can not be changed in a view
- INSERT and DELETE statements may be used subject to the integrity constraints
Q53.Define aggregate and scalar functions.
The aggregate functions always return a single value, which is the result of a column values.
EX: SUM(),COUNT(),AVERAGE(),MIN(),MAX()
A scalar functions returns a single value based on the value given as argument to the function.
Ex: UCASE(), LCASE(),LEN(),NOW()
Q54.Difference between clustered and non-clustered index.
A clustered index is unique for a given table. The actual data is at the leaf level of a clustered index and data is resorted.
Non-clustered index has the leaf level which has pointers to the data in the rows, so that one table can have as many as non-clustered indexes in a database
Q55.Explain the use of group by clause.
GROUP BY clause used in SELECT statement for retrieving data from a set of records and group the results in one or more columns. It divides the set of records into sets. The GROUP BY clause fetches the rows of a table into groups, which contains identical column values.
Q56.What is sub-query?
A query within a query is defined as a sub-query. A sub query is executed by enclosing it within another query. Sub queries are used for returning single row as an atomic value. A sub query is nested in DML statements, and enclosed in parenthesis.
Q57.Explain in brief the cursor optimization tips.
The following are few tips for cursor optimization:
- When the cursor is not needed, close the cursor
- Deallocate the cursor after closing it.
- Fetch less number of rows.
- Avoid triggers – because trigger executes whenever data gets updated, leads to overload of the system.
- When the rows are not need to update, use the option FORWARD ONLY
- Use where instead of having clause unless it is essential
Q58.Explain the cursor types.
There are two types of cursors:
1. Implicit Cursor: It is declared automatically when the SQL statement is executed. User is not aware of what is happening and cannot control or process the information available in the implicit cursor.
2. Explicit Cursor: Explicit cursor is defined in PL/SQL block which is to handle the query that fetches more than one row. The developer/programmer needs to declare, open the cursor. Then he/she needs to fetch and process sequentially all the rows and close it.
Q59.What is cursor?
A cursor is a variable that represents an area where the result of a query is stored. A single row query is stored in a cursor called ‘implicit cursor’. If a relation that fetches multiple rows, the cursor is called explicit cursor. An explicit cursor is handled in a PL/SQL block and each row can be handled by putting the relation fetched by the cursor, in a loop.
Q60.What is Union and Union All operator?
UNION is a set operator combines the relations of 2 or more select statements into one relation. Each select statement of UNION operator must have same number of columns with similar data types. Also the columns in both the select statements must in the same order. UNION selects only distinct values.
UNION ALL is a set operator performs the same functionality that of UNION, with one exception – allowing duplicates values in the relations.
Q61.Explain DML and DDL statements.
DDL-Data Definition Language: DDL is the syntax of SQL for defining the way the database is organized physically. Database meta data is created by DDL of SQL. The tables, views, indexes, sequences, triggers, database users (by DBA) are well defined using DDL statement, CREATE. Modification for the metadata or schema is done by ALTER command and removing database objects is done by DROP command.
DML-Data Manipulation Language: DML statements, INSERT, DELETE, UPDATE AND SELECT … INTO are used for data manipulation, adding new rows, deleting unwanted rows and changing data in the rows. These are known as SQL-change statements. DML does not change the schema of database.
Q62.What is denormalization?
Redundant data addition for optimizing the performance of a database, denormalization is the process. The inefficiencies those inherit in RDBMS software are addressed with denormalization. It is a process of combining data into a single table. Denormalization structures are used in databases for providing quick access for a specific user needs
Q63.What is normalization?
Normalization is the technique for designing database tables to eliminate data redundancy, to safe guard the database against certain anomalies (structural problems). It is a step-by-step breakdown of data structure complexity into simple structure that facilitates no loss to information and relationship
Q64.What are the benefits of normalizing database?
The benefits of normalization are:
- The process of searching, sorting and creating indexes is faster
- More tables can be derived for clear and needed tables to be designed
- Clustering indexes can be created which provides the flexibility in fine tuning queries.
- Less redundant data and fewer null values will make the database more compact.
- The indexes of tables make data modification commands execution much faster.
- If redundant data is not maintained, the execution of triggers is quicker.
- Normalization facilitates in reducing data modification anomalies.
Q65.Explain the types of relationships in database.
There are four relationships in database.
- One to One: One entity is associated with another entity. For Ex: Each employee is associated with one department
- One to Many: One entity is associated with many other entities. For Ex: A company is associated with all working employees in one branch/office/country.
- Many to One: Many entities are associated with only one entity. For Ex: Many employees are associated with one project.
- Many to Many: Many entities are associated with many other entities. For Ex: In a company many employees are associated with multiple projects(completed/existing), and at the same time, projects are associated with multiple employees
No comments:
Post a Comment