Tuesday, 1 February 2011

Basic Interview Questions for ASP.Net

Que1. What is delegate and its features?
Ans: Delegate in C# is similar to a function pointer in C or C++. A delegate is simply a type that references a method inside a delegate object .Once we assigned delegate to a method its behaves same as the method. We can use used this method like any other method with parameters and a return value. The delegate object can then be passed to code which can call the referenced method without having to know at compile time which method will be invoked. With the help of delegate we can programmatically change method calls, and also plug new code into existing classes. There are some features of delegate
(1) Delegates allow methods to be passed as parameters.
(2) Delegates can be used to define callback methods.
(3) Delegates are similar to C plus function pointers, but are type safe.
(4) Multiple methods can be called on a single event.
(5) Methods do not need to match the delegate signature exactly.

Que2. What are the four main new features in asp.net 3.5?
Ans:    Windows Presentation Foundation (WPF)
Windows Communication Foundation (WCF)
Windows Workflow Foundation (WF)
CardSpace

Que3. How many types of Navigation controls are there in asp.net?
Ans: There are 4 types Navigation controls in asp.net
1.Pointer
2.SiteMapPath
3.Menu
4.TreeView

Que4. Why to use caching in asp.net?
Ans: When we use Caching for frequent used data it will increases the scalability. When we use caching for objects it will get lot faster.

Que5. How to delete zip files from a folder?
Ans:    DirectoryInfo dir = new DirectoryInfo(@"z:\foldernam");
FileInfo[] zipfiles = dir.GetFiles("*.zip");
foreach( FileInfo f in zipfiles)
{
f.Delete();
}

Que6. What is cross page posting in ASP.NET2.0?
Ans: When we have to post data from one page to another in application we used server.transfer method but in this the URL remains the same but in cross page posting there is little different there is normal post back is done but in target page we can access values of server control in the source page. This is quite simple we have to only set the PostBackUrl property of Button, LinkButton or imagebutton which specifies the target page. In target page we can access the PreviousPage property. And we have to use the @PreviousPageType directive. We can access control of PreviousPage by using the findcontrol method. When we set the PostBackURL property ASP.NET framework bind the HTML and Javascript function automatically.

Que7. What is the purpose of IIS?
Ans: We can call IIS (Internet Information Services) a powerful Web server that helps us creating highly reliable, scalable and manageable infrastructure for Web application which runs on Windows Server 2003. IIS helps development center and increase Web site and application availability while lowering system administration costs. It also runs on Windows NT/2000 platforms and also for above versions. With IIS, Microsoft includes a set of programs for building and administering Web sites, a search engine, and support for writing Web-based applications that access database. IIS also called http server since it process the http request and gets http response.

Que8. What is late binding?
Ans: When code interacts with an object dynamically at runtime .because our code literally does not care what type of object it is interacting and with the methods thats are supported by object and with the methods thats are supported by object .The type of object is not known by the IDE or compiler, no Intellisense nor compile-time syntax checking is possible but we get unprecedented flexibility in exchange. if we enable strict type checking by using option strict on at the top of our code modules ,then IDE and compiler will enforce early binding behaviour. By default Late binding is done.

Que9. What is event Bubbling ? (Bubbled event)
Ans: - Server controls like Datagrid, Datalist, and Repeater can have other child controls inside them. These child control do not raise their events by themselves, rather they pass the event to the container parent (which can be a datagrid, datalist, repeater) which passed to the page as “Item_Command” event. As the child control send their events to parent this is termed as event bubbling.

Que10. What is an Assembly?
Ans: - An assembly consists of one or more files (dll’s, exe’s, html files etc.) and represents a group of resources type definitions and implementations of these types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest.
The manifest is part of the assembly this making the assembly self describing. An assembly contains metadata information which is used by the CLR for everything from type checking and security to actually invoking the components methods. As all information is in the assembly itself it is independent of registry. This is the basic advantage as compared to COM where the version was stored in registry.
Multiple versions can be deployed side by side in different folder. Two types of assemblies –
1. Private Assembly – A private assembly is normally used by a single application and is stored in the application’s directory or a sub-directory beneath.
2. Shared Assembly (Public Assembly) – A shared assembly is normally stored in the Global Assembly Cache (GAC), which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful e.g. crystal report classes.

4 comments:

  1. That's the right way, good for asp.net developers.

    ReplyDelete
  2. Great Blog, I think you will help me to select as a asp.net developer, I am reading your blogs & getting something everyday......

    ReplyDelete
  3. I am a Asp.net developer. Its very useful for me. It improve my knowledge and solved my query.



    Regard
    Software Designing Ajmer

    ReplyDelete