Thursday, March 7, 2013

SQL Questions and Answers


SQL Questions and Answers


What is WCF Data services?

WCF Data services technology is used to create a service by using Open Data Protocol (oData). This service is used to exposes and consumes data over the web or intranet by using the semantics of representational state transfer (REST).

what are differences between linq to sql and entity framework



Linq to Sql
--------------------
1) Its only works with Sql server.
2) Used for rapid application development.
3) It does not support for complex type.
4) It can't generate db from model.
5) Mapping type ( class to single table)
6) We can query data using DataContext.

Entity framework
--------------------
1) Its works with variety of db products.
2) Can not used for rapid application development.
3) It provides support for complex type.
4) It can generate db from model.
5) Mapping type ( class to multiple tables)
6) We can query data using esql,object services,entity client and linq to entities.

What is the caspol.exe tool used for ?



The caspol tool is used to grant and modify the permissions to code groups at the user policy, machine policy, and enterprise policy levels

What is Ilasm.exe used for ?



Ilasm.exe is a tool that generates PE(portable executable) files containing the MSIL code as a parameter and creates a text file that contains managed code.
You can run the resulting executable to determine whether the MSIL code performs as expected.
                                          
What is the ResGen.exe tool used for ?



ResGen.exe is a tool which is used to convert the resource files in the form of .txt or .resx files to common language runtime binary .resources files.
These files can be compiled into satellite assemblies

What is metadata?



Metadata is the binary information that describe your program and it is stored in PE (Portable Executable) file or in memory.
Metadata stores:

1) Description of assembly
2) Description of types
3) Attributes


What is CTS?



CTS stands for common type system. It is the subset of CLR. It provides common types for all dot net languages so that one language can understand other language. It has some conventions to convert objects from one language to other language.

Example:

in VB numeric values are identified by Integer data type whereas in C# it identified by int data type but CTS providessystem.int32 for all dot net compatible languages.

What is a Web Service?

Web services are application components that communicates using open protocols.
web services can be discovered using UDDI (Universal Description Discovery and Integration). Webservice is used to communicate between two same or different applications.

The basic web service plateform is xml and http. XML is the language which is used between different platform and programming languages.

HTTP (Hypertext Transfer Protocol) is the used by most of the browsers.

What is Global Asssembly Cache (GAC)?



GAC global assembly cache is the place where your shared assemblies are stored. When you create a assembly and make it to share with all oter applications, you need to install that assembly in GAC by using following command:

gacutil -i "assembly name with path"

What is Machine.config?



It is a configuration file that contains setting for entire computer. It also contains the settings for machine wide assembly binding, built in remoring channels and ASP.net. It can be found in
.net framework install directory\framework\\config

Example:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG

What is an application domain ?



Application domain is nothing but a boundary within which an application runs. A process can contain multiple application domains. Application domains provide an isolated environment to applications that is similar to the isolation provided by processes. An application running inside one application domain cannot directly access the code running inside another application domain. To access the code running in another application domain, an application needs to use a proxy.
How does an AppDomain get created ?

AppDomains are usually created by hosts (Windows Shell, ASP.NET and IE).
When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application. AppDomains can also be explicitly created by .NET applications.

What is a dynamic assembly ?



An assembly which is created dynamically at run time, when an application requires the types within these assemblies is nothing but a dynamic assembly.
What is the difference between imperative code and interrogative code ?



The major difference between both the codes is that,
Imperative code does not return value whereas,
Interrogative code return value.
What is an Application Manifest ?



Application Manifest is used to give the information to the operating system.
It is an XML file that describes and identifies the shared and private side-by-side assemblies that an application should bind to at run time. These should be the same assembly versions that were used to test the application.
They may also be used to describe the metadata for files that are private to the application.

What is a Strong Name ?



A strong name is an assembly which includes the following :

1) Name of the assembly
2) Version Number
3) Culture Identity
4) A public Key Token.
Why to dynamically link library instead of statically linking the library ?



Using Dynamic Link Library offers several advantages :

1) DLL's save memory
2) Reduces Swapping
3) Saves disk space
4) Upgrades easier.

Explain few capitalization techniques ?

Some of the capitalization techniques are explained as below.

Pascal Casing: This convention capitalizes the first character of each word.
Example: MyWord.

Camel Casing: This convention capitalizes the first character of each word except the first word.
Example: myWord.

Upper Casing: This convention is used to capitalize identifiers, which contains an abbrevation of one or two characters.Identifiers which are of three or more characters use pascal casing instead.
Example: PI

How DLL's save space in RAM ?



The dll does not get loaded into RAM memory together with the main program, so space is saved in RAM.When a dll file is called, then it is loaded.

What are immutable objects ?



Immutable objects are the objects whose state cannot be changed or modified once it is created.
Ex: String objects are immutable.

What is the Prototype Design Pattern ?

A prototype design pattern relies on creation of clones rather than objects.
Here, we avoid using the keyword 'new' to prevent overheads.

What are the two different ways by which you can make an object serializable ?



The two different ways by which we can make an object serializable are :-

(1) By using Serializable attribute
(2) By using ISerializable interface


What is SQL Azure ?



It is the relational database service on the Windows Azure platform.

Microsoft SQL Database extends SQL Server capabilities to the cloud.

Using SQL Database, you can easily provision and deploy relational database solutions.

Advantage : Manageability, High availability, Scalability, a familiar development model, and a relational data model.


What is MEF?How MEF Works?



MEF definition:
Managed Extensibility Framework is a new framework being incorporated inside the dotnet framework 4.0 whose purpose is to
plug-in components to an already running application. It comes under the System.ComponentModel.Composition.dll namespace.

Working of MEF:

MEF works upon the principle of demand/need and supply of parts.Initially we create a container and load all the possible sources of parts (export) into it and then Compose it. Whenever there is a requirement of some parts to be plugged into the application, MEF will perform a dynamic discovery of those parts from some location (which we call as Catalog). The composition engine resolves all the dependencies and throws an exception if it fails to do so.
During composition phase,all the suppliable parts gets instantiated.The suppliable parts must be discovered and both the need and the suppliable parts must agree to the contract..

How CLR works ?

As we know .Net framework supports code written in different-different languges. In .Net framework all code written in different-different languges is convert into common code after compilation, called IL code.Now clr takes place and looks for an application and system resources .This resources is necessary for our programe code, CLR find them then it turns on JIT compiler and convert IL code into native code and give this code to OS. Finally operating system execute this IL code.


what is IL code in .Net?



.Net architecture supports many languages, we are free to write code in many languges. The beauty of .Net is , it converts all code written in different-different languages into a single common code after compilation,that common code is known as IL code or we can say it MSIL(microsoft intermidate language)code.

What is Part is MEF?



MEF is a framework for creating extensible applications that allows developers to discover and use extensions with no configuration required.In MEF terminology, Part is an object (e.g. a class, a method or a property) that can be imported or exported to the application.The parts are discovered at runtime implicitly via composition.When a part is created, the MEF composition engine satisfies its imports with what is available from other parts.

What is Catalog in MEF?

MEF is a framework for creating extensible applications that allows developers to discover and use extensions with no configuration required.Part is an object (e.g. a class, a method or a property) that can be imported or exported to the application.The parts are discovered dynamically via catalogs .Catalogs allow applications to easily consume exports that have self-registered themselves via the Export attribute.In MEF, Catalog's responsibility is to look for the compose-able parts (import and export definitions).
There are various kinds of catalogs as Assembly Catalog,Directory Catalog,TypeCatalog,Aggregate Catalog etc.


What is Import Attribute?

MEF is a framework for creating extensible applications that allows developers to discover and use extensions with no configuration required.Part is an object (e.g. a class, a method or a property) that can be imported or exported to the application.In MEF parlance, Import attribute defines the need that a part.

What are the advantages of MEF?



MEF is a framework for creating extensible applications that allows developers to discover and use extensions with no configuration required.That means at runtime, this framework has got the capability to discover extensibile components.
There are some benefits of using this some of them are enumerated as under -

a.MEF breaks the tightly coupled dependencies across the application but respects the type checking of the loosely coupled parts.

b.Applications can be extended.

c.Components can be added at runtime.

d.Dynamic discovery of the components.

e.Great piece of reusability.

No comments:

Post a Comment