ASP.NET Interview Questions and Answers - Page 1
Difference between static and dynamic library in windows
- Static libraries are linked at compile time whereas dynamic libraries are linked at run-time (dynamic linking at run-time)
- Performance consideration: Static library is faster than dynamic library
- The executable exe size will be larger when we build exe with static library compared to dynamic link library
What data structure would you use for a browser BACK and FORWARD ability?
Use two stacks. Every time you visit a site, push its address in stack1. When you press back, pop from stack1 and also push in stack2. When user presses forward, pop from stack2 and also push in stack1.
How to insert, delete and transverse a Sorted Linked List
struct llist *next;
typedef struct llist linked_list;
linked_list *start=NULL, *new;
printf("\n1.Insert new node");
printf("\n3.Transverse through list");
menu = getchar();
case '1': ll_insert();
case '2': ll_delete();
case '3': ll_transverse();
case '4': return;
new = createnode();
if(start == NULL)
start = new;
printf("\n Do you want to add one more record?\n");
ch = getchar();
}while(ch=='y' || ch == 'Y');
new = (linked_list *)malloc(sizeof(linked_list));
printf("Enter the number to be added:");
linked_list *ptr, *prev;
if(new->info < start->info)
new->next = start;
start = new;
if(new->info < ptr->info)
prev->next = new;
new->next = ptr;
if(ptr == NULL)
prev->next = new;
linked_list *ptr, *prev, *temp;
printf("Enter the number to be deleted:\n");
if(info == start->info)
temp = start;
start = start->next;
if(info == ptr->info)
temp = ptr;
prev = ptr->next;
printf("Deleted node successfully");
if(ptr == NULL)
printf("No such element found to be deleted\n");
if(start == NULL)
printf("List is empty");
for(ptr=start; ptr; ptr=ptr->next)
How many bits does it take to store a decimal?
What is the Pre-Compilation feature of ASP.NET 2.0?
Previously, in ASP.NET, the pages and the code used to be compiled dynamically and then cached so as to make the requests to access the page extremely efficient. In ASP.NET 2.0, the pre-compilation feature is used with which an entire site is precompiled before it is made available to users.
There is a pre-defined folder structure for enabling the pre-compilation feature:
* App_Code: stores classes
* App_Themes: stores CSS files, Images, etc.
* App_Data: stores XML files, Text Files, etc.
* App_GlobalResources: stores all the resources at global level E.g. resx files, etc
* App_LocalResources: stores all the resources at local/Page level
What is Fragment Caching in ASP.NET?
- Fragment caching refers to the caching of individual user controls within a Web Form.
- Each user control can have independent cache durations and implementations of how the caching behavior is to be applied.
- Fragment caching is useful when you need to cache only a subset of a page.
- Navigation bars, header, and footers are good candidates for fragment caching.
What is the difference between URL and URI?
A URL (Uniform Resource Locator) is the address of some resource on the Web. A resource is nothing but a page of a site. There are other type of resources than Web pages, but that''s the easiest conceptually.
A URI is a unique identifier to usually a namespace.
Though it looks like a URL but it doesn’t have to necessarily locate any resource on the web.
URI is a generic term. URL is a type of URI.
Difference between Cookies and Session in ASP.Net
- Both session and cookies are used to store user specific information.
- If your website has got huge volume users then using session is not recommeded as it eats your memory. In such cases cookies are the best choice which saves in client machine.
- In fact both session and cookie uses cookie but in the case of cookie all information will be stored in client space but for session only sessionid will be stored in user system.
- The main advantage of sesison is you can save datasets, arryas, objects etc in session because it is saved in server memory. Cookies are normally used when you have to save small and non-critical data.
What base class do all Web Forms inherit from?
What method do you use to explicitly kill a user’s session?
The Abandon method destroys all the objects stored in a Session object and releases their resources.
If you do not call the Abandon method explicitly, the server destroys these objects when the session times out.
How do you turn off cookies for one page in your site?
Use the Cookie.Discard Property which Gets or sets the discard flag set by the server. When true, this property instructs the client application not to save the Cookie on the user’s hard disk when a session ends.
Which two properties are on every validation control?
ControlToValidate & ErrorMessage properties
How do you create a permanent cookie?
Setting the Expires property to MinValue means that the Cookie never expires.
Which method do you use to redirect the user to another page without performing a round trip to the client?
Explain what a diffgram is, and a good use for one?
A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.
How to manage pagination in a page?
Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself.
What is smart navigation?
The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed.
What are different methods of session maintenance in ASP.NET?
Three types of session maintenance:
Session State Service.
Microsoft SQL Server.
What order global.asax events are triggered?
Global.asax events are triggered in the following order:
<<Code is executed>>
How can we format data inside Data Grid?
Using DataFormatString property.