Sunday, 5 August 2012

Interview Questions in Microsoft



"Hashing" or "hash," is the method or algorithm used to derive a numeric value     from a piece of data. This could be something as simple as adding up all of the one bits in the data, or as complicated as doing a Fourier transformation of the  data. This is used to encrypt and decrypt the data.

  1. What is distributed query?
In Microsoft SQL Server 2000, distributed queries enable SQL Server users to access data outside a SQL Server-based server, either within other servers running SQL Server or other data sources that expose an OLE DB interface. OLE DB provides a way to uniformly access tabular data from heterogeneous data sources. A distributed query, for the purpose of this document, is any SELECT, INSERT, UPDATE, or DELETE statement that references tables and rowsets from one or more external OLE DB data source. A remote table is a table that is stored in an OLE DB data source and is external to the server running SQL Server executing the query. A distributed query accesses one or more remote tables.
Example:
You are a regional sales manager for a large insurance company that has subsidiaries in several countries. Each regional office selects the product that stores its sales data. The United Kingdom subsidiary stores its data in Oracle; the Australian subsidiary stores its data in Access; the Spanish subsidiary stores data in Microsoft Excel; and the United States subsidiary stores its data in SQL Server. You want a report that lists, on a quarterly basis for the last three years, the insurance policies, the subsidiaries, and the sales representatives with the highest quarterly sales figures. Each of these queries can be accomplished by using a single distributed query, running on SQL Server.
  1. What is linked servers?
Linked Servers are external OLE DB compliant data sources. It could be another SQL Server, Oracle, Access etc. Link Servers are used for Distributed queries. You can create or delete a linked server definition with stored procedures (sp_addlinkedserver) or through SQL Server Enterprise Manager.
  1. What are security options that you have for Web Services?
There are two key security principles, Authentication and Authorization. Authentication is the process of validating an identity based on credentials, such as a user name and password, against an authority. Once an identity has been authenticated, authorization determines whether the identity is authorized to access a resource.
Authentication options for Web Service are:
Windows – Basic, Windows –Basic over SSL, Windows – Digest, Windows – Integrated widows, Windows – Client Certificates, Forms, SOAP Headers – Custom.
Authorization:
The purpose of authorization is to determine whether an identity should be granted the requested type of access to a given resource. There are two fundamental ways to authorize access to a given resource: file authorization and URL authorization. File authorization can be used whenever Windows authentication is used, as the permissions are set in IIS on a per-file basis. URL authorization can be used with any of the built in authentication mechanisms supported by ASP.NET. With URL authorization, configuration is done through a configuration file, where users can be selectively granted or denied access to any files associated with ASP.NET, including .asmx files.

1.      ADO by default has connected recordset while ADO .NET has disconnected data. ADO .NET uses XML. In ADO Data is organized in form or recordset, record and fields. ADO .Net organizes data in Dataset, Tables, Rows and Columns. ADO used MoveNext(), MovePrevious etc. methods to navigate thru the records. One can access any row and column using Table.rows[].Column[].
2.      Inheritance provides reusability, extensibility and hide complexity. In heritance is used for parent child relation ship. For example Car is a parent for Premium Car and Budgeted car classes. Inheritance is hierarchical. Childe class is derived from more than one parent class in multiple inheritances.  C++ support multiple inheritances.
3.      Polymorphism is the ability for classes to provide different implementations of methods that are called by the same name. Polymorphism allows a method of a class to be called without regard to what specific implementation it provides. For example, you might have a class named Road which calls the Drive method of an additional class. This Car class may be SportsCar, or SmallCar, but both would provide the Drive method. Though the implementation of the Drive method would be different between the classes, the Road class would still be able to call it, and it would provide results that would be usable and interpretable by the Road class. Polymorphism in a component can be implemented using Interface, Inheritance and through Abstract Classes.
4.      Create a function in SQL server. Define a parameter to the function that accepts the highest level. Declare a cursor using following select statement:
[Select Top n SalaryAmount from SalaryTable  Order by SalaryAmount DESC]
Fetch the fist row from the above cursor  and return the amount.
5.      Option Explicit is used to force declaration of variables befor they are used in a file(Class, Module, Form).
6.      You can use array for multi-dimensional data. Collection are easy to use for adding and removing items.  Collection provide easy way to reference an item either using Key or index. You cannot store different data types in array.
7.      Locks are used if you want to alter data. Use No Locks on such select statements where you are sure that you just want to read the data. By default SQL Server places shared lock on select close when it is running in implicit mode.
8.      Create Index on the view. You have to follow certain rules to create the index on the view. Like Schemabinding, Use of base bases in a view etc.
9.      TRUNCATE TABLE is functionally identical to DELETE statement with no WHERE clause: both remove all rows in the table. But TRUNCATE TABLE is faster and uses fewer system and transaction log resources than DELETE. The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row. TRUNCATE TABLE removes the data by deallocating the data pages used to store the table's data, and only the page deallocations are recorded in the transaction log. TRUNCATE TABLE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column. If you want to retain the identity counter, use DELETE instead. If you want to remove table definition and its data, use the DROP TABLE statement. You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint; instead, use DELETE statement without a WHERE clause. Because TRUNCATE TABLE is not logged, it cannot activate a trigger. TRUNCATE TABLE may not be used on tables participating in an indexed view.
10.  Transaction is logical unit of data that has to be written to the database. It may contain single Insert, Update or delete or multiple statements or combination. If Truncate table statement is used inside the transaction then data is recovered on Rollback.
11.  CLS is heart of .NET Framework. It executes your code that is targeted to .NET framework. It provides services like Object Layout, Resource management, Garbage collection.
12.  A proxy is a local object that is an image of a remote object. Proxies enable clients to access objects across remoting boundaries.
13.  Choose the maximum value from identity column. Apply following formula:
Select cast (MaxValue * Rand() as int)
Above expression will return a number. Use this statement in a loop that will run for require number of times. Every time you generate a number search that number in the table.
There are chances that you get the same number.   So keep track of the numbers that you have generated.

No comments:

Post a Comment

Write your openion about my blog spot..To get automatic facebook updates like my Pagehttps://www.facebook.com/shivashankar4u ..It takes only 1 min to write the comment and to like the page.. Thanks.