1- Difference == and .Equals()
== compare valus of variables
.Equals() compare Objects of variable
int x=10, double y=10
if(x==y)--true
if(x.equals(y)) false
-------------------------------------------------
2:- 3 tier Architecture
1-Presentation layer
Through which data is presented to the user or input is taken from the user e.g Form
2-Business logic layer
Contains busines logic,validations or calculations realted with the data.
3-Data acsess Layer
Contains methods that helps business layer to connect to the data and perform required action,
might be returing data or manipulating data (insert,update,delete)
http://www.dotnetfunda.com/articles/article18.aspx
http://pateldeepp.wordpress.com/2010/04/02/3-layer-architecture-and-enterprise-library-4-1/
-------------------------------------------------
3:-Advantage of 3 tier
1-Independent modoficatio of one layer will not effect other layer.
2-Reuseablity ,As the layer are separated it can exits as a module that can be reused by other application
by referencing it.
--------------------------------------------------
4:-Namespace
A keyword in .net is used to avoid namecollisions
--------------------------------------------------
5:-Assembly
It is a grouping of files
An Assembly is a logical unit of code
Each time you create a Microsoft Windows® Application, Windows Service, Class Library, or other application with Visual Basic .NET, you're building a single assembly. Each assembly is stored as an .exe or .dll file.
Assembly physically exist as DLLs or EXEs
One assembly can contain one or more files
The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
When you compile your source code by default the exe/dll generated is actually an assembly
Every assembly file contains information about itself. This information is called as Assembly Manifest.
--------------------------------------------------X
6-Manifest
It stores information about an assembly.This information is stored within the assembly file(DLL/EXE) itself.
The information includes version information, list of constituent files etc.
In .NET, every assembly starts with something called a manifest that takes the place of the information that was formerly placed in the registry. The manifest contains metadata (data about data) telling the CLR what it needs to know to execute the assembly instructions.
One of the things the CLR needs to know is the version number of components used by the assembly.
'''''''''
Manifest describes the assembly itself. Assembly name, version number, culture information. strong name, list of all files, type reference and reference assembly.
The assembly manifest contains the assembly's metadata
--------------------------------------------------X
7-Private Assembly:-
Private Assembly are private to the calling application.
--------------------------------------------------
8-.Shared Assembly:-
Shared Assembly are shared amoung all application
--------------------------------------------------
9:-Satellite Assembly:-
--------------------------------------------------X
10: Stack and Heap differnce .How thay are mannaged in .Net
Value Types:
In C#, all the "things" declared with the following list of type declarations are Value types (because they are from System.ValueType):
bool
byte
char
decimal
double
enum
float
int
long
sbyte
short
struct
uint
ulong
ushort
Reference Types:
All the "things" declared with the types in this list are Reference types (and inherit from System.Object... except, of course, for object which is the System.Object object):
class
interface
delegate
object
string
--------------------------------------------------X
11.
--------------------------------------------------
12:-Protected Internal
--------------------------------------------------X
13:-Difference String and StringBuilder
String :-Immutable-New instance is created every time when value is changed
e.g
String a="Praveen"
a="Abc"--->new
--------------------------------------------------
14-Array.CopyTo and Array.Clone() Difference
--------------------------------------------------X
15:- Difference Array and ArrayList
--------------------------------------------------X
16:-How to Filter DataSet
--------------------------------------------------X
17:-How to update dataset if value is changed
--------------------------------------------------X
18:-How many design patterns are there and what are they?
http://www.dotnetuncle.com/Design-Patterns/dot-net-design-pattern-interview-questions.aspx
http://www.c-sharpcorner.com/UploadFile/questpond/DP109212008014904AM/DP1.aspx
1. Creational
2. Structural
3. Behavioral
Creational Design Pattern
Abstract Factory - Creates an instance of several families of classes
Builder - Separates object construction from its representation
Factory Method - Creates an instance of several derived classes
Prototype - A fully initialized instance to be copied or cloned
Singleton - A class of which only a single instance can exist
Structural Design Pattern
Adapter - Match interfaces of different classes
Bridge - Separates an object’s interface from its implementation
Composite - A tree structure of simple and composite objects
Decorator - Add responsibilities to objects dynamically
Facade - A single class that represents an entire subsystem
Flyweight - A fine-grained instance used for efficient sharing
Proxy - An object representing another object
Behavioral Design Pattern
Chain of Resp. - A way of passing a request between a chain of objects
Command - Encapsulate a command request as an object
Interpreter - A way to include language elements in a program
Iterator - Sequentially access the elements of a collection
Mediator - Defines simplified communication between classes
Memento - Capture and restore an object's internal state
Observer - A way of notifying change to a number of classes
State - Alter an object's behavior when its state changes
Strategy - Encapsulates an algorithm inside a class
Template Method - Defer the exact steps of an algorithm to a subclass
Visitor - Defines a new operation to a class without change
--------------------------------------------------X
19.Value Type and Reference Type and thier Stucture
http://www.codeproject.com/KB/dotnet/6importentStepsDotNet.aspx
Value types are types which hold both data and the memory on the same location.
While a reference type has a pointer which points to the memory location.
--------------------------------------------------
20.Boxing and Unboxing
http://www.codeproject.com/KB/dotnet/6importentStepsDotNet.aspx
When the data moves from value types to reference types its termed as ‘Boxing’ and the vice versa is termed as ‘UnBoxing’.
This movement of data from the heap to stack and vice-versa creates a performance hit.
--------------------------------------------------
21.Overloading
Creating multipel methods with same name but with different parameters
--------------------------------------------------
22.Properties
http://www.devarticles.com/c/a/C-Sharp/Understanding-Properties-in-C-Sharp/
Characteristic of an object is represented in a class through Properties
e.g- A Student class can have commen properties like Name,Age,Height etc.
Syntex
{
get
{
}
set
{
}
}
Static Properties------------------------->>>>
C# also supports static properties, which belongs to the class rather than to the objects of the class. All the rules applicable to a static member are applicable to static properties also.
The following program shows a class with a static property.
//C# : static Property
//Author: rajeshvs@msn.com
using System;
class MyClass
{
private static int x;
public static int X
{
get
{
return x;
}
set
{
x = value;
}
}
}
class MyClient
{
public static void Main()
{
MyClass.X = 10;
int xVal = MyClass.X;
Console.WriteLine(xVal);//Displays 10
}
}
Properties & Polymorphism ---------------------->>>>>
A Base class property can be polymorphicaly overridden in a Derived class. But remember that the modifiers like virtual, override etc are using at property level, not at accessor level.
//C# : Property : Polymorphism
//Author: rajeshvs@msn.com
using System;
class Base
{
public virtual int X
{
get
{
Console.Write("Base GET");
return 10;
}
set
{
Console.Write("Base SET");
}
}
}
class Derived : Base
{
public override int X
{
get
{
Console.Write("Derived GET");
return 10;
}
set
{
Console.Write("Derived SET");
}
}
}
class MyClient
{
public static void Main()
{
Base b1 = new Derived();
b1.X = 10;
Console.WriteLine(b1.X);//Displays 'Derived SET Derived GET 10'
}
}
Abstract Properties ------------------------->>>>
A property inside a class can be declared as abstract by using the keyword abstract. Remember that an abstract property in a class carries no code at all. The get/set accessors are simply represented with a semicolon. In the derived class we must implement both set and get assessors.
If the abstract class contains only set accessor, we can implement only set in the derived class.
The following program shows an abstract property in action.
//C# : Property : Abstract
//Author: rajeshvs@msn.com
using System;
abstract class Abstract
{
public abstract int X
{
get;
set;
}
}
class Concrete : Abstract
{
public override int X
{
get
{
Console.Write(" GET");
return 10;
}
set
{
Console.Write(" SET");
}
}
}
class MyClient
{
public static void Main()
{
Concrete c1 = new Concrete();
c1.X = 10;
Console.WriteLine(c1.X);//Displays 'SET GET 10'
}
}
Auto-Implemented Properties------------------>>>>>>>>>
The patterns you see here, where a property encapsulates a property with get and set accessors, without any other logic is common. It is more code than we should have to write for such a common scenario. That's why C# 3.0 introduced a new syntax for a property, called an auto-implemented property, which allows you to create properties without get and set accessor implementations. Listing 10-5 shows how to add auto-implemented properties to a class.
Listing 10-5. Auto-Impemented Properties
using System;
public class Customer
{
public int ID { get; set; }
public string Name { get; set; }
}
public class AutoImplementedCustomerManager
{
static void Main()
{
Customer cust = new Customer();
cust.ID = 1;
cust.Name = "Amelio Rosales";
Console.WriteLine(
"ID: {0}, Name: {1}",
cust.ID,
cust.Name);
Console.ReadKey();
}
}
Notice how the get and set accessors in Listing 10-5 do not have implementations. In an auto-implemented property, the C# compiler creates the backing store field behind the scenes, giving the same logic that exists with traditional properties, but saving you from having to use all of the syntax of the traditional property. As you can see in the Main method, the usage of an auto-implemented property is exactly the same as traditional properties, which you learned about in previous sections.
--------------------------------------------------
23.Class
It is a mould or template of a n object.
It contains Properties(or Fields),methods,Constructors,Destructors
---By Shiv
Class are templates,Prototypes or Blue print
--------------------------------------------------
24.Early Binding vs. Late Binding
http://www.c-sharpcorner.com/UploadFile/babu_2082/3428/
Early Binding
The name itself describes that compiler knows about what kind of object it is, what are all the methods and properties it contains. As soon as you declared the object, .NET Intellisense will populate its methods and properties on click of the dot button.
Common Examples:
ComboBox cboItems;
ListBox lstItems;
In the above examples, if we type the cboItem and place a dot followed by, it will automatically populate all the methods, events and properties of a combo box, because compiler already know it's an combobox.
Late Binding
The name itself describes that compiler does not know what kind of object it is, what are all the methods and properties it contains. You have to declare it as an object, later you need get the type of the object, methods that are stored in it. Everything will be known at the run time.
Common Examples:
Object objItems;
objItems = CreateObject("DLL or Assembly name");
Here during the compile time, type of objItems is not determined. We are creating an object of a dll and assigning it to the objItems, so everything is determined at the run time.
Early Binding vs. Late Binding
Now coming into the picture…
Application will run faster in Early binding, since no boxing or unboxing are done here.
Easier to write the code in Early binding, since the intellisense will be automatically populated
Minimal Errors in Early binding, since the syntax is checked during the compile time itself.
Late binding would support in all kind of versions, since everything is decided at the run time.
Minimal Impact of code in future enhancements, if Late Binding is used.
Performance will be code in early binding.
Both have merits and demerits, it's the developer decision to choose the appropriate binding based on the scenario.
--------------------------------------------------
25.What is an assembly?
An Assembly is a logical unit of code
Each time you create a Microsoft Windows® Application, Windows Service, Class Library, or other application with Visual Basic .NET, you're building a single assembly. Each assembly is stored as an .exe or .dll file.
Assembly physically exist as DLLs or EXEs
One assembly can contain one or more files
The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
When you compile your source code by default the exe/dll generated is actually an assembly
Every assembly file contains information about itself. This information is called as Assembly Manifest.
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
26.There are two kind of assemblies in .NET;
private
shared
The assembly which is used only by a single application is called as private assembly. Suppose you created a DLL which encapsulates your business logic. This DLL will be used by your client application only and not by any other application. In order to run the application properly your DLL must reside in the same folder in which the client application is installed. Thus the assembly is private to your application.
Suppose that you are creating a general purpose DLL which provides functionality which will be used by variety of applications. Now, instead of each client application having its own copy of DLL you can place the DLL in 'global assembly cache'. Such assemblies are called as shared assemblies.
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
27.What is assembly manifest?
Assembly manifest is a data structure which stores information about an assembly
This information is stored within the assembly file(DLL/EXE) itself
The information includes version information, list of constituent files etc.
In .NET, every assembly starts with something called a manifest that takes the place of the information that was formerly placed in the registry. The manifest contains metadata (data about data) telling the CLR what it needs to know to execute the assembly instructions.
One of the things the CLR needs to know is the version number of components used by the assembly.
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
28.What is Global Assembly Cache?
Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept. It is located under :\WinNT\Assembly folder.
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
29.How assemblies avoid DLL Hell?
As stated earlier most of the assemblies are private. Hence each client application refers assemblies from its own installation folder. So, even though there are multiple versions of same assembly they will not conflict with each other. Consider following example :
You created assembly Assembly1
You also created a client application which uses Assembly1 say Client1
You installed the client in C:\MyApp1 and also placed Assembly1 in this folder
After some days you changed Assembly1
You now created another application Client2 which uses this changed Assembly1
You installed Client2 in C:\MyApp2 and also placed changed Assembly1 in this folder
Since both the clients are referring to their own versions of Assembly1 everything goes on smoothly
Now consider the case when you develop assembly that is shared one. In this case it is important to know how assemblies are versioned. All assemblies has a version number in the form:
major.minor.build.revision
If you change the original assembly the changed version will be considered compatible with existing one if the major and minor versions of both the assemblies match.
When the client application requests assembly the requested version number is matched against available versions and the version matching major and minor version numbers and having most latest build and revision number are supplied.
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
30.How do I create shared assemblies?
Following steps are involved in creating shared assemblies :
Create your DLL/EXE source code
Generate unique assembly name using SN utility
Sign your DLL/EXE with the private key by modifying AssemblyInfo file-->([assembly:AssemblyKeyFile("Mykey.snk")])
Compile your DLL/EXE
Place the resultant DLL/EXE in global assembly cache using AL utility
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
31.How do I create unique assembly name?
Microsoft now uses a public-private key pair to uniquely identify an assembly. These keys are generated using a utility called SN.exe (SN stands for shared name). The most common syntax of is :
sn -k mykeyfile.key
Where k represents that we want to generate a key and the file name followed is the file in which the keys will be stored.
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
32.How do I sign my DLL/EXE?
Before placing the assembly into shared cache you need to sign it using the keys we just generated. You mention the signing information in a special file called AssemblyInfo. Open the file from VS.NET solution explorer and change it to include following lines :
[assembly:AssemblyKeyFile("file_path")]
Now recompile the project and the assembly will be signed for you.
Note : You can also supply the key file information during command line compilation via /a.keyfile switch.
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
33.How do I place the assembly in shared cache?
Microsoft has provided a utility called AL.exe to actually place your assembly in shared cache.
AL /i:my_dll.dll
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
34.What are the basic components of .NET platform?
The basic components of .NET platform (framework) are:
----------------------------------------------------
.Net Applications
(Win Forms,Web Applications,Web Services)
Data(ADO.Net) and XML Library
----------------------------------------------------
FrameWork Class Library(FCL)
(IO,Streams,Sockets,Security,Reflection,UI)
----------------------------------------------------
Common Language Runtime(CLR)
(Debugger,Type Checker,JITer,GC)
----------------------------------------------------
Operating System
(Windows,Linux,UNIX,Macintosh,etc.,)
----------------------------------------------------
Common Language Runtime (CLR):
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
The most important part of the .NET Framework is the .Net Common Language Runtime (CLR) also called .Net Runtime in short. It is a framework layer that resides above the Operating System and handles/manages the execution of the .NET applications. Our .Net programs don't directly communicate with the Operating System but through CLR.
MSIL (Microsoft Intermediate Language) Code:
When we compile our .Net Program using any .Net compliant language like (C#, VB.NET, C++.NET) it does not get converted into the executable binary code but to an intermediate code, called MSIL or IL in short, understandable by CLR. MSIL is an OS and H/w independent code. When the program needs to be executed, this MSIL or intermediate code is converted to binary executable code, called native code. The presence of IL makes it possible the Cross Language Relationship as all the .Net compliant languages produce the similar standard IL code.
http://www.codeguruindia.com/tutorials/post/CLR-Common-Language-Runtime-Features-and-Benefits.aspx
Automatic memory management:
Standard Type System:
Language interoperability:
Platform Independence:
Security Management:
Here i will list out some basic features of CLR
provides runtime enviornment
*
Memory Management
*
Process and Thread management
*
Cross Language Integrity
*
Exception Handling
*
Garbage Collection
*
Code Verification
*
Code Access Secuirity
---------------------------------------------------------------------------------------------------------------
Just In Time Compilers (JITers):
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
When our IL compiled code needs to be executed, CLR invokes JIT compilers which compile the IL code to native executable code (.exe or .dll) for the specific machine and OS. JITers in many ways are different from traditional compilers as they, as their name suggests, compile the IL to native code only when desired e.g., when a function is called, IL of function's body is converted to native code; just in time of need. So, the part of code that is not used by particular run is not converted to native code. If some IL code is converted to native code then the next time when its needed to be used, the CLR uses the same copy without re-compiling. So, if a program runs for sometime, then it won't have any just in time performance penalty. As JITers are aware of processor and OS exactly at runtime, they can optimize the code extremely efficiently resulting in very robust applications. Also, since JITer knows the exact current state of executable code, they can also optimize the code by in-lining small function calls (like replacing body of small function when its called in a loop, saving the function call time). Although, Microsoft stated that C# and .Net are not competing with languages like C++ in efficiency, speed of execution, JITers can make your code even faster than C++ code in some cases when program is run over extended period of time (like web-servers).
---------------------------------------------------------------------------------------------------------------
Framework Class Library (FCL):
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
.NET Framework provides huge set of Framework (or Base) Class Library (FCL) for common, usual tasks. FCL contains thousands of classes to provide the access to Windows API and common functions like String Manipulation, Common Data Structures, IO, Streams, Threads, Security, Network Programming, Windows Programming, Web Programming, Data Access, etc. It is simply the largest standard library ever shipped with any development environment or programming language. The best part of this library is they follow extremely efficient OO design (design patterns) making their access and use very simple and predictable. You can use the classes in FCL in your program just as you use any other class and can even apply inheritance and polymorphism on these.
---------------------------------------------------------------------------------------------------------------
Common Language Specification (CLS):
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Earlier we used the term '.NET Compliant Language' and stated that all the .NET compliant languages can make use of CLR and FCL. But what makes a language '.NET compliant language'? The answer is Common Language Specification (CLS). Microsoft has released a small set of specification that each language should meet to qualify as a .NET Compliant Language. As IL is a very rich language, it is not necessary for a language to implement all the IL functionality, rather it meets the small subset of it, CLS, to qualify as a .NET compliant language, which is the reason why so many languages (procedural and OO) are now running under .Net umbrella. CLS basically addresses to language design issues and lays certain standards like there should be no global function declaration, no pointers, no multiple inheritance and things like that. The important point to note here is that if you keep your code within CLS boundary, your code is guaranteed to be usable in any other .Net language.
---------------------------------------------------------------------------------------------------------------
Common Type System (CTS):
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
.NET also defines a Common Type System (CTS). Like CLS, CTS is also a set of standards. CTS defines the basic data types that IL understands. Each .NET compliant language should map its data types to these standard data types. This makes it possible for the 2 languages to communicate with each other by passing/receiving parameters to/from each other. For example, CTS defines a type Int32, an integral data type of 32 bits (4 bytes) which is mapped by C# through int and VB.Net through its Integer data type.
---------------------------------------------------------------------------------------------------------------
Garbage Collector (GC):
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
CLR also contains Garbage Collector (GC) which runs in a low-priority thread and checks for un-referenced dynamically allocated memory space. If it finds some data that is no more referenced by any variable/reference, it re-claims it and returns the occupied memory back to the Operating System; so that it can be used by other programs as necessary. The presence of standard Garbage Collector frees the programmer from keeping track of dangling data.
-----------------------------------------------------
35.Difference between Module amd Assembly
http://stackoverflow.com/questions/645728/what-is-a-module-in-net
-----------------------------------------------------X
36.Static Member
Static member of class are not associateed with any particular object other than the class itself
This means that there will be only one instance of this method/field no matter how mant object of the
class exists.
-----------------------------------------------------
37.Non Static Member
Required obect instance
-----------------------------------------------------X
38. Root Class of all the object in .net framework:- System.object
-----------------------------------------------------
39.DatasetObject
Disconnected mode,Read Write access,Slower access to data,
Forward and back scaning of data .
DataReader
Connected mode.Read only access to result set.Fater than dataset
Can't go backwards in DataReader
-----------------------------------------------------
40.Why DataReader is Forward Only?
Because it inherit DbDataReader Abstract Class and
DbDataReader Abstract Inherit the IEnumerable and its give
GetEnumerator(Returns an enumerator that iterates through a
collection.)its Type IEnumerator and IEnumerator gives
MoveNext() Method so Datareader is Forward only.
-----------------------------------------------------
41.Partial class
----------------------------------------------------X
42-Abstract Class
Is a class that can not be instantiated.
Is a Class that must be inherited and the methos overriden
----------------------------------------------------X
43.
Pure abstract class ----Interface
Access modifier with in the interface always public
44.Virtual keyword
Virtual keyword means that method can be overriden
----------------------------------------------------X
45.What is Overriding
When overriding a method we can change the behaviour of a method for the derived Class
----------------------------------------------------X
46.What is Overloading
Overloading involves having another method with the same name with in the class. but with differnt parameters
----------------------------------------------------X
47.Difference between Array and Arraylist
http://www.dotnetspark.com/kb/90-difference-between-array-and-arraylist.aspx
ARRAY
1.Char[] vowel=new Char[];
2.Array is in the System namespace
3.The capacity of an Array is fixed
4.An Array is a collection of similar items
5.An Array can have multiple dimensions
ARRAYLIST
1.ArrayList a_list=new ArrayList();
2.ArrayList is in the System.Collections namespace.
3.ArrayList can increase and decrease size dynamically
4.ArrayList can hold item of different types
5.ArrayList always has exactly one dimension
----------------------------------------------------
48. Array Types
Single Dimention
int[] number =new int[10]
Muti Dimention
int[] number =new int[5,4]
Jagged
int[][] number =new int[10][5]
----------------------------------------------------
49.Delegates
http://dotnetslackers.com/articles/net/Delegates-in-NET.aspx
http://www.akadia.com/services/dotnet_delegates_and_events.html
http://www.programmersheaven.com/user/spickersgill/blog/956-Delegates-Explained-in-Plain-English/
http://www.c-sharpcorner.com/UploadFile/Ashush/Delegates02152008155757PM/Delegates.aspx
http://www.codeproject.com/KB/cs/6ImportDelegatesAndEvents.aspx ----By Shiv
http://msdn.microsoft.com/en-us/library/aa288459%28VS.71%29.aspx
A delegate is a type-safe object that can point to another method (or possibly multiple methods) in the application, which can be invoked at later time.
----------------------------------------------------X
50.Static Class
Static class must contain only staic member and methods.
Stactic member can be called with the help of classname.
It's Sealed by default.
----------------------------------------------------
51.Type Safey in .NET
http://www.exforsys.com/tutorials/csharp/.-net-type-safety.html
----------------------------------------------------X
52.How to an updation in a dataset be refelected in Backend if it is Disconneted architecture.
By useing dataadapter update.dataset and datatable.
----------------------------------------------------X
53.Out and Ref Parameter.
----------------------------------------------------X
54.Content of a assembly
Four Elements
1.Assembly manifest,Contains assembly metadata
2.Type metadata
3.MSIL code implement ....
4.A set of resourses
* Versioning only on shared assembly
----------------------------------------------------X
55.Refletion
All .net Compliers produce metadata about the type defined in the modules they produce.This
metadata is packed aong with the modules and can be accessed by a mechanison called Refelection.
----------------------------------------------------
56.Methods provided by Command Object
1.Executenonquery--
Executs the command defined in the command text property.
This method return an integer indicating the number of rows affected by a query.
2Execute Reader---
Executs the command defined in the command text property.
returns a reader object that is connected to the resulting rowset within the database,allowing
the rows to be retrived.
3.Execute Scalar.--
Returns a single value.(First row first column) if not specified one value
Adapter
Fill Data in Dataset, and pushes dataset values into Datastore(Database)
----------------------------------------------------
57.Garbage Collection
Release the object from memory that is of no use.
----------------------------------------------------
58.What are design patterns ?
----------------------------------------------------X
59.Overview of the Object Class
http://www.csharp-station.com/Articles/ObjectClass.aspx
Why an Object Class?
The Equals Method
The ReferenceEquals Method
The ToString Method
The GetType Method
The GetHashCode Method
The MemberwiseClone Method
The Finalize Method
----------------------------------------------------X
60.Const, static and readonly
What is the difference between const and static readonly
See
http://en.csharp-online.net/const,_static_and_readonly
http://en.csharp-online.net/CSharp_FAQ:_What_is_the_difference_between_const_and_static_readonly
http://devlicio.us/blogs/joe_niland/archive/2006/09/27/C_2300_-static-readonly-vs-constant-variables_3A00_-when-to-ues-each.aspx
----------------------------------------------------X
61.Objects
By Shiv-Objects are instances of classes
----------------------------------------------------X
62.Using SQL Profiler
This is used to increase performance of SP,Query,Table etc.Using Trace File
----------------------------------------------------X
63.Differnece between Clustered Index and Non Clustered Index
Basicly they complement each other.
In Clustered index the Key actully points to the actual Data.And Data is sorted as per clustered index.
In Non Custered Index the data actually points to the pointer and that pointer actually points to the data.And it is posible the physical arrangement of data does not match with
logical way in which the non culstered index are arranged.So we can have n number of non clustered index and only one in case of Clustered index.
----------------------------------------------------X
64.What is Table Scan.and Index Scan
Table scan is row by row scan. Good for less no. of record table.
Index scan search by index .Good for table with lots of recordes.
----------------------------------------------------X
65.Advantage of using Storeprocedure.
It is precomplied.So it increses performance.
Precomplied means the plan is precomplied.
----------------------------------------------------X
66.What is LINK?
We can say it is a common language to access the data sources.It has a query language by which you can
access any kind of data source such as excel, sql db etc.
It can be termed as a overmapper
----------------------------------------------------X
67.Differnce Between Abstraction and Encapsulation
Abtraction is a process of thinking that what you want to atually show to the external world.
Encapsulation is basically how we can achive abraction.
So Abtraction is all about What to show and Encapsulation about How to achive.
----------------------------------------------------X
68.What is UML
Unified Modeling Language, a standered way to design a system in an object oriented manner.
It has nothing to do with programing languages like c#,vb etc.
Model--means a final representation of a product.e.g Building a house with a design.
design here is model..
----------------------------------------------------
69.Self JOin
http://www.sqltutorial.org/sqlselfjoin.aspx
SQL self-join simply is a normal join which is used to join a table to itself. The SQL self-join can be done by using SQL table aliases to treat one table like a different table and then join them together. SQL self-join can be any form of join such as SQL inner join, SQL outer join… so you can apply any join to the SQL self-join.
eg.
SELECT column_list FROM table_A AS A
INNER JOIN table_A AS B
ON A.column_name1 = B.column_name2, ...
WHERE row_conditions
----------------------------------------------------
70.Cross JOin
http://weblogs.sqlteam.com/jeffs/archive/2005/09/12/7755.aspx
Cross Joins produce results that consist of every combination of rows from two or more tables. That means if table A has 3 rows and table B has 2 rows, a CROSS JOIN will result in 6 rows. There is no relationship established between the two tables – you literally just produce every possible combination.
The solution? Well, hopefully in your database you have a table of Stores and a table of Products. A cross join of the two results will return 1 row per combination of Store and Product:
SELECT S.Store, P.Product
FROM Stores S
CROSS JOIN Products P
That result is the perfect starting point for the results we wish to return -- now we just need to return the sales for each combination. We already have written that in our first attempt, so now we just need to combine the two:
SELECT S.Store, P.Product, ISNULL(C.TotalSales,0) as TotalSales
FROM Stores S
CROSS JOIN Products P
LEFT OUTER JOIN
(SELECT Store, Product, SUM(Sales) as TotalSales
FROM Sales
GROUP BY Store, Product) C
ON
S.Store = C.Store AND
P.Product = C.Product
----------------------------------------------------
71.Copy a Table from One to another without initially creating the table
Select * into TempNewTableName from AnyTableName
-->TempNewTableName -->New Table to be created.
-->AnyTableName--->From which the new table is created
It Does not transfer the index,foreign key,statistics etc.
To transfer schema and data use Micro..Sql sever Database Publishing wizared
----------------------------------------------------
72.More than 1 primary key possible?
You can only have one primary key, but you can have multiple columns in your primary key.
You can have a Composite Primary Key which is a primary key made from two or more columns. For example:
CREATE TABLE userdata (
userid integer,
userdataid integer,
info char(200)
primary key (userid, userdataid)
);
----------------------------------------------------
73.What is the difference between UNION and UNION ALL ?
With UNION-->only distinct values are selected.
E.g
SQL Statement 1
UNION
SQL Statement 2
Employees_Norway:
E_ID E_Name
01 Hansen, Ola
02 Svendson, Tove
03 Svendson, Stephen
04 Pettersen, Kari
Employees_USA:
E_ID E_Name
01 Turner, Sally
02 Kent, Clark
03 Svendson, Stephen
04 Scott, Stephen
...
SELECT E_Name FROM Employees_Norway
UNION
SELECT E_Name FROM Employees_USA
Result
E_Name
Hansen, Ola
Svendson, Tove
Svendson, Stephen
Pettersen, Kari
Turner, Sally
Kent, Clark
Scott, Stephen
=========
UNION ALL selects all values from Both tables
E.g
SELECT E_Name FROM Employees_Norway
UNION ALL
SELECT E_Name FROM Employees_USA
Result
E_Name
Hansen, Ola
Svendson, Tove
Svendson, Stephen
Pettersen, Kari
Turner, Sally
Kent, Clark
Svendson, Stephen
Scott, Stephen
----------------------------------------------------------
74.What is the difference between Join and Union?
UNION combines the results of two or more queries into a single result.
jOIN- Retrieve data from two or more tables based on logical relationships between the tables.
----------------------------------------------------------
75.Structs in C#
http://www.codeproject.com/KB/cs/structs_in_csharp.aspx
76.What's the difference between string and System.String?
http://blogs.msdn.com/b/csharpfaq/archive/2004/03/12/what-s-the-difference-between-code-string-code-and-code-system-string-code.aspx
C# defines a number of aliases for CLR types. They may be used interchangably, and even mixed together, e.g.
string x = new System.String(' ', 5);.
These are the aliases defined:
Alias CLR type
string System.String
sbyte System.SByte
byte System.Byte
short System.Int16
ushort System.UInt16
int System.Int32
uint System.UInt32
long System.Int64
ulong System.UInt64
char System.Char
float System.Single
double System.Double
bool System.Boolean
decimal System.Decimal
-------------------------------------------------------------
77.Define abstraction,encapsulation,inheritance:with example.
http://www.coolinterview.com/interview/12557/
Abstraction- In OOPS All the Internal detail of functionality is hided from the user this is known as Abstraction. i.e User don't have any knowledge of logic but he/she give the input and get output.
e.g.
A Car driver doesn't know what internally happen when he press accelerator what he know is the car speed is increase.
Encapsulation- Class variables and functions wrapped into a single entity, called class. this is called encapsulation.
e.g. A Car is Entity which have Accelerator, Stearing etc. as a variable and Acceleration is a function that encapsulated into a car.
inheritance: When we want to use the functionality of a class to be use in other class we use inheritance.
--------------------------------------------------------------
78.How do i sort a dataset.
use this method to sort
SqlConnection con=new SqlConnection("user id=sa;pwd=;database =master;server=server");
con.Open();
SqlDataAdapter data=new SqlDataAdapter("selectid,name,name1 from nm",con);
DataSet dt=new DataSet("data");
data.Fill(dt,"data");
DataView myDataView = dt.Tables["data"].DefaultView ;
myDataView.Sort = "id DESC";
DataGrid1.DataSource=myDataView;
DataGrid1.DataBind();
--------------------------------------------------------------
79.System.String and StringBuilder
http://blah.winsmarts.com/2006-7-Never_fail_an_interview_question_about_System.String_or_StringBuilder_again_.aspx
String are immutable object.Which means every time when we write
strin a="Praveen";
a=a+"P.R";
A brand new instance of string was declared in memory. The previous instance (the one that was passed in as a parameter), is left orphaned by myFunction. Note - that still won't be garbage collected because static void Main is still using it.
This is why, you should use StringBuilder - because that is not an immutable object. It has the ability to reuse the same memory.
-----------------------------------------------------------------
80.Crystall report
#region DespatchInformation Report
public void DespatchDetails(DataSet d1, string asondate)
{
ReportDocument rptDoc = new ReportDocument();
crviewer.DisplayGroupTree = false;
rptDoc.Load(@"Reports\crpDespatchDetails.rpt");
rptDoc.SetDataSource(d1);
ParameterField pfieldAsonDate = new ParameterField();
ParameterDiscreteValue disValAsonDate = new ParameterDiscreteValue();
disValAsonDate.Value = asondate;
pfieldAsonDate.Name = "AsOnDate";
pfieldAsonDate.CurrentValues.Add(disValAsonDate);
pfields.Add(pfieldAsonDate);
crviewer.ParameterFieldInfo = pfields;
crviewer.ReportSource = rptDoc;
}
-----------------------------------------------------------------
81.Adding one project to another existing project in .netroject.
http://www.eggheadcafe.com/community/aspnet/14/10158644/adding-a-project-to-another-projects-solution.aspx
For adding one project to another project solution u follows these steps
step 1--Frist open the project in which u want to add another project in your case open Module project
Step 2--Right click on solution in Solution Explorer and than choose Add-->Choose Existing project than Add Existing project dialog box open
step 3-- In Add Existing project dialog box, u can brawose path for another project which u want to add and choose the project file and click on Ok
Step 4-- Now both project are in your one solution than u will be right click on Class project and build it After that right click on Module Project and add referance of Class project to use in that project.
-----------------------------------------------------------------
82.NameSpace inside Namespace possibel?
yes..
-----------------------------------------------------------------
83.Two different namespace in a project possible ?
yes...e.g dll
-----------------------------------------------------------------
84.Explain serialization.
http://careerride.com/C-net-serialization.aspx
Serialization is a process of converting an object into a stream of bytes. .Net has 2 serializers namely XMLSerializer and SOAP/BINARY Serializer. Serialization is maily used in the concept of .Net Remoting.