Some of the Frequently asked questions for Dot net developers
What is .NetFrameWork ?
.Net Frame work for building and developing the application by using .net
it contains to major parts
1. Common Language Runtime
2.Class Libraries
.Net Frame work for building and developing the application by using .net
it contains to major parts
1. Common Language Runtime
2.Class Libraries
OOPS Concepts
Ans: Object Oriented Programming (OOP) All Programming Language will support this OOP there are Three main concepts in OOP
a)Abstraction
b)Encapsulation
c)Inheritance
d)Polymorphism
Abstraction :
Reducing the Complexity and generalization
Encapsulation :
Encapsulation is the process of Keeping the data and method together into ObjectsOR
Simple Putting Together into one simple class Like.
OR
Means that a group of related properties, methods, and other members are treated as a single unit or object.
___________________________________________________________________________________
Class My Class
{
public MyClass()
{
}
int a;
int b;
Public void GetAdd()
{
int C=a+b;
}
}
___________________________________________________________________________________
Inheritance:
Inheritance Enables you to Create Class that ReusesOR
Acquiring the Properties of Base Class(Parent Class)
OR
Means Provide Further Implementation ,Reusing of Base Class
__________________________________________________________
Public Class MyClass
{
Public MyClass()
{
}
int a;
int b;
Public void GetMyMethod()
{
int c=a+b;
}
}
Public Class MyChildClass : MyClass
{
Public MyChildClass()
{}
}
C# Doesn't Support Multiple Inheritance By Using Interfaces We Can
_______________________________________________
Polymorphism
Polymorphism means same operation may Behave Differently in Different ClassesExample of Compile Time Polymorphism: Method Overloading
Example of Run Time Polymorphism: Method Overriding
Method Overloading- Method with same name but with different arguments is called method overloading.
- Method Overloading forms compile-time polymorphism.
- Example of Method Overloading:
class MyClass
{
Public string hello()
{
return "Hello";
}
public string hello(string s)
{
return "Hello"+S.Tostring();
}
}
Method Overriding- Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one of its superclass.
- Method overriding forms Run-time polymorphism.
-Virtual Key word is required for Overriding
- Example of Method Overriding:
Public Class MyClass
{
virtual void hello()
{
Console.WriteLine(“Hello from MyClass”);
}
}
Public Class MyChildchild : MyClass
{
override void hello()
{
Console.WriteLine(“Hello from Child”); }
}
}__________________________________________________________________
3.Differences between Interface and Abstract Class?
Interfaces :
--An interface is not a class.--It is an entity that is defined by the word Interface.
--An interface has no implementation;
--it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class
____________________________________
Public Interface ImyInterface
{
String Method1();
int Method2();
}
Public Class myClass :ImyInterface
{
string Method1()
{
//Code
}
int Method2()
{
//Code
}
}
____________________________________________________________________________
---Requires more time to find the actual method in the corresponding classes. (Slow )
The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn't support multiple inheritance, interfaces are used to implement multiple inheritance
Abstract Class:
These Classes Cannot be instantiated, ---These are used if additional functionality is needed in derived classes,
---These Implemented partially or No Implementation
--Fast In Operation
____________________________________________________________
abstract class MyAbstractClass
{
public MyAbstractClass()
{
// Code to initialize the class goes here.
}
abstract public void Method1();
abstract public void Method2(int A);
abstract public long Method3(int B);
}
class MyClass : MyAbstractClass
{
public MyClass ()
{
// Initialization code goes here.
}
override public void Method1()
{
// code goes here.
}
override public void Method2(int A)
{
// code goes here.
}
override public long Method3(int B)
{
//code goes here.
}
}____________________________________________________________
Override and Overloading
Override and Overloading Comes under Polymorphism --The Run time Polymorphism Override
--The Compile time polymorphism is Overloading Check it out in Above Polymorphism
Virtual Key
--If U use virtual key before method it means we can able to Override method check the PolymorphismAccess modifiers in C #
--Access Modifiers Specify the Accessibility of type or Member when u declare before the Class
--Five Access Modifiers in C#
Private :The Type or Member Can be accessed by the in the Same Class
--like With In Class
Public : The Type or Member Can be accessed by any other code with in same assembly or any
other assembly which reference it
-- Like any where in the class and assembly,
Protect: The type or member can be accessed only by code in the same class or struct, or in a class
that is derived from that class.
--Like Private But also Derived Class
Internal: The type or member can be accessed by any code in the same assembly, but not from
another assembly
Protected Internal:
The type or member can be accessed by any code in the assembly in which it is declared, or from within a derived class in another assembly. Access from another assembly must take place within a class declaration that derives from the class in which the protected internal element is declared, and it musttake place through an instance of the derived class type.
Constructors
---Constructors are Class Methods that are executed when a object of a given type is created--- Constructors are have the same name as the Class
---Initialize the data members of the new Object
public class Myclass()
{
public bool mybool;
public Myclass()
{
mybool=true;
}
}
--With parameters also we can create constructors
Static Constructors :
A static Constructor is used to initialize any static data or perform a particular action that needs to be performed once only
______________________
public class Myclass
{
static string time;
static myclass()
{
time=DateTime.Now.Tostring();
}
}
______________________
--A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced.
Delegates :
Delegates holds method signature.
it passes the method as argument to another method
Generics
Generic Classes and Methods combine re-usability
10.New Features In C #
11.Sealed Class
Restrict the class to inheritance
12.Asp.Net Life Cycle
Page Request
Start
Page Initializing
Load
Validation
PostBack Event handling
Rendering
Unloading
Directives in Asp.Net
Session Management
View state
Hidden fields
ControlState
QueryString
Cookies
Application State
Session State
Profile Properties
15.Get and Post Method
16.Session Management in IIS
17.Authentication and Autherization
18.MasterPages
19.Cookies,Caching and View State
Caching :
It is a way to store the frequently used data into the server memory which can be retrieved very quickly. And so provides both scalability and performance. For example if user is required to fetch the same data from database frequently then the resultant data can be stored into the server memory and later retrieved in very less time (better performance). And the same time the application can serve more page request in the same time scalability.
- Output caching - The rendered html page is stored into the cache before sending it to the client. Now, if the same page is requested by some other client the already rendered htm page is retrieved from the server memory and sent to the client, which saves the time requires rendering and processing the complete page.
- Data Caching - The important pieces of information, that are time consuming and frequently requested, are stored into the cache. For example a data set retrieved from the database. It is very similar to application state but it is more server friendly as the data gets removed once the cache is filled.
- Fragment caching - Instead of caching the complete page, some portion of the rendered html page is cached. E.g.: User Control used into the page is cached and so it doesn’t get loaded every time the page is rendered.
- Data Source Caching - It is caching built into the data source controls (eg. XmlDataSource, sqlDataSource etc). It is very similar to data caching but here the caching is not handled explicitly but the data source control manages it as per the settings made on the data controls.
<@ OutputCache Duration="20" VaryByParam="None">
Cookies :
A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. The cookie contains information the Web application can read whenever the user visits the site.
---Most browsers support cookies of up to 4096 bytes.
----Also, number of cookies is limited to 20 per website. If we create more than this it browser will delete ole Cookie
20.Gridview Events
--DataBinding
--DataBound
--Dispose
--init
--Load
--PageIndexChanged
--PageIndexChanging
--PreRender
--RowCancelEditing
--RowCommand
--RowCreated
---RowDataBound
--RowDeleting
---RowDeleted
---RowEditing
---RowUpdated
--RowUpdating
--SelectIndexChanged
--SelectIndexChanging
--Sorting
--Sorted
-- unload
21.Ajax Controls and About Ajax
22.Validation Controls
23.JavaScript
24.Html/DHtml/CSS
25.Server.Transfer and Response.Redirect
26.Webservices,WindowServices,RemotingWCF,WPF
27.XML
28.SilverLight,
29.SharePoint
31.Extension Methods
32.HTTP Handlers/HTTP Modules
33.Sql Profiler
34.Union and Union All
35.Event and Delegates
36.How to Display Duplicate Values In SqlServer
37.IIS Life Cycle
38.Enterprise Library –Microsoft
Microsoft Enterprise Library is a collection of reusable application blocks designed to assist software developers with common enterprise development challenges
This release includes:
--Caching Application Block
--Cryptography Application Block
--Data Access Application Block
--Exception Handling Application Block
--Logging Application Block
--Application Block
--Validation Application Block
--Unity Application Block
39.What is the difference between ScriptManager and ScriptManagerProxy ?
Ans :