Saturday, December 11, 2010

Asp.net,SqlServer Mixed Code

1 comments

1) What you thing about the WebPortal ?
Answer: Web portal is nothing but a page that allows a user to customize his/her homepage. We can use Widgets to create that portal we have only to drag and drop widgets on the page. The user can set his Widgets on any where on the page where he has to get them. Widgets are nothing but a page area that helps particular function to response. Widgets example are address books, contact lists, RSS feeds, clocks, calendars, play lists, stock tickers, weather reports, traffic reports, dictionaries, games and another such beautiful things that we can not imagine. We can also say Web Parts in Share Point Portal. These are one of Ajax-Powered.

2) How to start Outlook,NotePad file in AsP.NET with code ?
Answer: Here is the syntax to open outlook or notepad file in ASP.NET VB.NET Process.Start("Notepad.exe") Process.Start("msimn.exe"); C#.NET System.Diagnostics.Process.Start("msimn.exe"); System.Diagnostics.Process.Start("Notepad.exe");


3) What is the purpose of IIS ?
Answer: 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.


4) What is main difference between GridLayout and FormLayout ?
Answer: GridLayout helps in providing absolute positioning of every control placed on the page.It is easier to devlop page with absolute positioning because control can be placed any where according to our requirement.But FormLayout is little different only experience Web Devloper used this one reason is it is helpful for wider range browser.If there is absolute positioning we can notice that there are number of DIV tags.But in FormLayout whole work are done through the tables.

5) How Visual SourceSafe helps Us ?
Answer: One of the powerful tool provided by Microsoft to keep up-to-date of files system its keeps records of file history once we add files to source safe it can be add to database and the changes ade by diffrenet user to this files are maintained in database from that we can get the older version of files to.This also helps in sharing,merging of files.


6) What is Partial Classes in Asp.Net 2.0?
partial classes mean that your class definition can be split into multiple physical files. Logically, partial classes do not make any difference to the compiler. During compile time, it simply groups all the various partial classes and treats them as a single entity.
Benefits of Partial Classes
One of the greatest benefits of partial classes is that they allow a clean separation of business logic and the user interface (in particular, the code that is generated by the Visual Studio Designer). Using partial classes, the UI code can be hidden from the developer, who usually has no need to access it anyway. Partial classes also make debugging easier, as the code is partitioned into separate files. This feature also helps members of large development teams work on their pieces of a project in separate physical files


7) What is an HTTP handler in ASP.NET? Can we use it to upload files? What is HttpModule?
The HttpHandler and HttpModule are used by ASP.NET to handle requests. Whenever the IIS Server recieves a request, it looks for an ISAPI filter that is capable of handling web requests. In ASP.NET, this is done by aspnet_isapi.dll. Same kind of process happens when an ASP.NET page is trigerred. It looks for HttpHandler in the web.config files for any request setting. As in machine.config default setting, the .aspx files are mapped to PageHandlerFactory, and the .asmx files are mapped to the WebServiceHandlerFactory. There are many requests processed by ASP.NET in this cycle, like BeginRequest, AuthenticateRequest, AuthorizeRequest, AcquireRequestState, ResolveRequestCache, Page Constructor, PreRequestHandlerExecute, Page.Init, Page.Load, PostRequestHandlerExecute, ReleaseRequestState, UpdateRequestCache, EndRequest, PreSendRequestHeaders, PreSendRequestContent.

Yes, the HttpHandler may be used to upload files.

HttpModules are components of .NET that implement the System.Web.IHttpModule interface. These components register for some events and are then invoked during the request processing. It implements the Init and the Dispose methods. HttpModules has events like AcquireRequestState, AuthenticateRequest, AuthorizeRequest, BeginRequest, Disposed , EndRequest, Error, PostRequestHandlerExecute, PreRequestHandlerExecute, PreSendRequestHeaders, ReleaseRequestState, ResolveRequestCache, UpdateRequestCache

8) How the find the N the maximum salary of an employee?

Ans.
SELECT MIN (SALARY )
FROM UEXAMPLE1
WHERE SALARY IN (SELECT DISTINCT TOP 4 SALARY FROM UEXAMPLE1 ORDER BY SALARY DESC)

9) What is @@connection?

The Query Designer supports the use of certain SQL Server constants, variables, and reserved column names in the Grid or SQL panes. Generally, you can enter these values by typing them in, but the Grid pane will not display them in drop-down lists. Examples of supported names include:
· IDENTITYCOL If you enter this name in the Grid or SQL pane, the SQL Server will recognize it as a reference to an auto-incrementing column.
· Predefined global values You can enter values such as @@CONNECTIONS and @@CURSOR_ROW into the Grid and SQL panes.
· Constants (niladic functions) You can enter constant values such as CURRENT_TIMESTAMP and CURRENT_USER in either pane.
· NULL If you enter NULL in the Grid or SQL panes, it is treated as a literal value, not a constant.


10) How to copy one total column data to another column?
Ans.
Update Set COLUMN2 = COLUMN1

Here copy column1 to column2

11) What is Global.asax?
Ans.
Global.asax is a file used to declare application-level events and objects. Global.asax is the ASP.NET extension of the ASP Global.asa file. ...
the ASP.NET page framework assumes that you have not defined any applicationa/Session events in the application.


12) What is boxing and UnBoxing?
Ans:
Boxing
Lets now jump to Boxing. Sometimes we need to convert ValueTypes to Reference Types also known as boxing. Lets see a small example below. You see in the example I wrote "implicit boxing" which means you don't need to tell the compiler that you are boxing Int32 to object because it takes care of this itself although you can always make explicit boxing as seen below right after implicit boxing.

Int32 x = 10; object o = x ; // Implicit boxing Console.WriteLine("The Object o = {0}",o); // prints out 10 //----------------------------------------------------------- Int32 x = 10; object o = (object) x; // Explicit Boxing Console.WriteLine("The object o = {0}",o); // prints out 10

Unboxing
Lets now see UnBoxing an object type back to value type. Here is a simple code that unbox an object back to Int32 variable. First we need to box it so that we can unbox.
Int32 x = 5; object o = x; // Implicit Boxing x = o; // Implicit UnBoxing
So, you see how easy it is to box and how easy it is to unbox. The above example first boxs Int32 variable to an object type and than simply unbox it to x again. All the conversions are taking place implicitly. Everything seems right in this example there is just one small problem which is that the above code is will not compile. You cannot Implicitly convert a reference type to a value type. You must explicitly specify that you are unboxing as shown in the code below.
Int32 x = 5; object o = x; // Implicit Boxing x = (Int32)o; // Explicit UnBoxing
Lets see another small example of unboxing.
Int32 x = 5; // declaring Int32 Int64 y = 0; // declaring Int64 double object o = x; // Implicit Boxing y = (Int64)o; // Explicit boxing to double Console.WriteLine("y={0}",y);
This example will not work. It will compile successfully but at runtime It will generate an exception of System.InvalidCastException. The reason is variable x is boxed as Int32 variable so it must be unboxed to Int32 variable. So, the type the variable uses to box will remain the same when unboxing the same variable. Of course you can cast it to Int64 after unboxing it as Int32 as follows:
Int32 x = 5; // declaring Int32 Int64 y = 0; // declaring Int64 double object o = x; // Implicit Boxing y = (Int64)(Int32)o; // Unboxing and than casting to double Console.WriteLine("y={0}",y);


13) What is WPF? WCF?
Windows Presentation Foundation, it is to develop the applications which contains Rich Graphics. Example Google Earth.
Windows Communication Foundation is the framework to develop the SOA (Service Oriented Architecture) based applications. Which applications can be communicated with any applications that are developed using any other technologies?

14) what is web service?

Web services are frequently just Web APIs that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services
The W3C Web service definition encompasses many different systems, but in common usage the term refers to clients and servers that communicate over the HTTP protocol used on the Web. Such services tend to fall into one of two camps: Big Web Services and RESTful Web Services.
"Big Web Services" use XML messages that follow the SOAP standard and have been popular with traditional enterprise. In such systems, there is often machine-readable description of the operations offered by the service written in the Web Services Description Language (WSDL). The latter is not a requirement of a SOAP endpoint, but it is a prerequisite for automated client-side code generation in many Java and .NET SOAP frameworks (frameworks such as Spring, Apache Axis2 and Apache CXF being notable exceptions). Some industry organizations, such as the WS-I, mandate both SOAP and WSDL in their definition of a Web service.

15) How to know whether the Table ‘xyz’ exists or not?
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Country_Master]') AND type in (N'U'))

16) Difference between an Interface and Abstract class?
Ans.
(1) An abstract class may contain complete or
incomplete methods. Interfaces can contain only the
signature of a method but no body. Thus an abstract class
can implement methods but an interface can not implement
methods.
(2) An abstract class can contain fields,
constructors, or destructors and implement properties. An
interface can not contain fields, constructors, or
destructors and it has only the property's signature but no
implementation.
(3) An abstract class cannot support multiple
inheritance, but an interface can support multiple
inheritance. Thus a class may inherit several interfaces
but only one abstract class.
(4) A class implementing an interface has to
implement all the methods of the interface, but the same is
not required in the case of an abstract Class.
(5) Various access modifiers such as abstract,
protected, internal, public, virtual, etc. are useful in
abstract Classes but not in interfaces.
(6) Abstract classes are faster than interfaces.

17) What is IL?
Ans.
A language that is generated from programming source code, but that cannot be directly executed by the CPU. Also called "bytecode," "p-code," "pseudo code" or "pseudo language," the intermediate language (IL) is platform independent. It can be run in any computer environment that has a runtime engine for the language.

In order to execute the intermediate language program, it must be interpreted a line at a time into machine language or compiled into machine language and run.

18) What is difference between VBScript and JavaScript?
Ans.
Vbscript will be run on IE
JavaScript runs on any browser
Vbscript is developed by ms
Java script by Sunmicrosystems
Vb not case sensitive
Java is case sensitive


19) What is ObjRef object in remoting?

ObjRef is a searializable object returned by Marshal() that knows about location of the remote object, host name, port number, and object name.


20) How can we create custom controls in ASP.NET?

Custom controls are user defined controls. They can be created by grouping existing controls, by deriving the control from System.Web.UI.WebControls.WebControl or by enhancing the functionality of any other custom control. Custom controls are complied into DLL’s and thus can be referenced by as any other web server control.

Basic steps to create a Custom control:

1. Create Control Library
2. Write the appropriate code
3. Compile the control library
4. Copy to the DLL of the control library to the project where this control needs to be used
5. The custom control can then be registered on the webpage as any user control through the @Register tag.

21) 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.

It is a process where things that can be handled before compilation are prepared in order to reduce the deployment time, response time, increase safety. It’s main aim to boost performance.

It also helps in informing about the compilation failures.

During development, it allows you to make changes to the web pages and reuse it using the same web browser to validate the changes without compiling the entire website.

During deployment, it generates the entire website folder structure in the destination. All the static files are copied to the folder and bin directory would later on contain the compiled dll.


* App_GlobalResources: stores all the resources at global level E.g. resx files, etc
* App_LocalResources: stores all the resources at local/Page level

22) What is the purpose of Server.MapPath method in Asp.Net?

In Asp.Net Server.MapPath method maps the specified relative or virtual path to the corresponding physical path on the server. Server.MapPath takes a path as a parameter and returns the physical location on the hard drive. Syntax

Suppose your Text files are located at D:\project\MyProject\Files\TextFiles

If the root project directory is MyProject and the aspx file is located at root then to get the same path use code

//Physical path of TextFiles
string TextFilePath=Server.MapPath("Files/TextFiles");

Friday, December 3, 2010

C# interview questions and answers

0 comments

C# interview questions and answers

1. What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.

2. Can you store multiple data types in System.Array?
No.
3. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.
4. How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.
5. What’s the .NET datatype that allows the retrieval of data by a unique key? HashTable.
6. What’s class SortedList underneath?
A sorted HashTable.
7. Will finally block get executed if the exception had not occurred?
Yes.
8. What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.
9. Can multiple catch blocks be executed?
No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.
10. Why is it a bad idea to throw your own exceptions?
Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.
11. What’s a delegate? A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.
12. What’s a multicast delegate? It’s a delegate that points to and eventually fires off several methods.
13. How’s the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.
14. What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command.
15. What’s a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
16. What namespaces are necessary to create a localized application? System.Globalization, System.Resources.
17. What’s the difference between // comments, /* */ comments and /// comments? Single-line, multi-line and XML documentation comments.
18. How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with a /doc switch.
19. What’s the difference between c and code XML documentation tag?
Single line code example and multiple-line code example.
20. Is XML case-sensitive?
Yes, so and are different elements.
21. What debugging tools come with the .NET SDK? CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.
22. What does the This window show in the debugger? It points to the object that’s pointed to by this reference. Object’s instance data is shown.
23. What does assert() do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
24. What’s the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
25. Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.
26. Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor.
27. How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger.
28. What are three test cases you should go through in unit testing? Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).
29. Can you change the value of a variable while debugging a C# application? Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.
30. Explain the three services model (three-tier application). Presentation (UI), business (logic and underlying code) and data (from storage or other sources).
31. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.
32. What’s the role of the DataReader class in ADO.NET connections? It returns a read-only dataset from the data source when the command is executed.
33. What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.
34. Explain ACID rule of thumb for transactions. Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).
35. What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).
36. Which one is trusted and which one is untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.
37. Why would you use untrusted verificaion? Web Services might use it, as well as non-Windows applications.
38. What does the parameter Initial Catalog define inside Connection String? The database name to connect to.
39. What’s the data provider name to connect to Access database? Microsoft.Access.
40. What does Dispose method do with the connection object? Deletes it from the memory.
41. What is a pre-requisite for connection pooling? Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.

42. Collection vs Hashtable
A Hashtable object consists of buckets that contain the elements of the collection. A bucket is a virtual subgroup of elements within the Hashtable, which makes searching and retrieving easier and faster than in most collections. Each bucket is associated with a hash code, generated using a hash function and based on the key of the element.
The Dictionary class has the same functionality as the Hashtable class. A Dictionary of a specific type (other than Object) has better performance than a Hashtable for value types because the elements of Hashtable are of type Object and, therefore, boxing and unboxing typically occur if storing or retrieving a value type.
43.What is DLL Hell and how it is solved in .NET?
Windows Registry cannot support the multiple versions of same com component this is called the dll hell problem.
.net solved using dll with different versions
Dll hell problem is solved by dotnet it allows the application to specify not only the library it needs to

run but also the version of the assembly
44. What are Generic Classes?
Generic classes are classes that can hold objects of any class. Containers such as Lists, Arrays, Bags and Sets are examples of generic classes.
Generic classes have type parameters. Several separate classes in a C# program, each with a different field type in them, can be replaced with a single generic class. The generic class introduces a type parameter. This becomes part of the class definition itself.
45. Why we use abstract class?
If some classes are having common behavior, instead of writing every time the same thing in each class, write that in one class and ask the other classes to use it[by making the classes as subclasses to the abstract class].

this is nothing but inheritance. Abstract classes allow you to provide default functionality for the subclasses.

46. Database table to collection.

List list = dt.AsEnumerable().ToList();

or

IEnumerable sequence = dt.AsEnumerable();

or

List rows = table.Rows.Cast().ToList();

or

List list = new List(dt.select());

47. What is the difference between a deep copy and a shallow copy?

Shallow copies duplicate as little as possible. A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individual elements.

Deep copies duplicate everything. A deep copy of a collection is two collections with all of the elements in the original collection duplicated.

48. What is the difference between const and static readonly?

The difference is that the value of a static readonly field is set at run time, and can thus be modified by the containing class, whereas the value of a const field is set to a compile time constant.

In the static readonly case, the containing class is allowed to modify it only

in the variable declaration (through a variable initializer)

in the static constructor (instance constructors, if it's not static)

static readonly is typically used if the type of the field is not allowed in a const declaration, or when the value is not known at compile time.

Instance readonly fields are also allowed.

Remember that for reference types, in both cases (static and instance) the readonly modifier only prevents you from assigning a new reference to the field. It specifically does not make immutable the object pointed to by the reference.

class Program {

public static readonly Test test = new Test();

static void Main(string[] args) {

test.Name = "Program";

test = new Test(); // Error: A static readonly field cannot be assigned to (except in a static constructor or a variable initializer)

}

}

class Test {

public string Name;

}

On the other hand, if Test were a value type, then assignment to test. Name would be an error.

49. Why use SP?

a. It works/executes fast as it is in precompiled mode.
b. As it is in the database so if the BL gets leaked there is no chance of leaking the database… so security.

50. What are the differences between stored procedure and functions in SQL Server 2000?

1) functions are used for computations whereas procedures can be used for performing business logic

2) functions MUST return a value, procedures need not be.

3) you can have DML(insert, update, delete) statements in a function. But, you cannot call such a function in a SQL

query..eg: suppose, if u have a function that is updating a table.. you can't call that function in any sql query.-

select myFunction(field) from sometable; will throw error.

4) function parameters are always IN, no OUT is possible

5) EXEC command can't be used inside a Function where it can be used inside an sproc

51What do you understand by Application Lifecycle Management (ALM)?
Abbreviated as ALM, Application Lifecycle Management refers to the capability to integrate, coordinate and manage the different phases of the software delivery process. From development to deployment, ALM is a set of pre-defined process and tools that include definition, design, development, testing, deployment and management. Throughout the ALM process, each of these steps are closely monitored and controlled.
52. Diff b/w data dictionary and hash table?

Basically Collections & Generics are useful in handling group of Objects.In .net,all the collections objects comes under the interface IEnumerable Which inturn has ArrayList(Index -Value)) & HashTable(Key- Value).After .net framework 2.0,ArrayList & HashTable were replaced with List & Dictionary .Now the Arraylist & HashTable are no more used in now a days projects.

Coming to difference between HashTable & Dictionary,Dictionary is generic whereas Hastable is not Generic.We can add any type of object to HashTable ,but while reteriving we need to Cast it to the required Type.So it is not type safe.But to dictionary,while declaring itself we can specify the type of Key & Value ,so no need to cast while retreiving.Let me explain it with an Example.

//HashTable Program:
class HashTableProgram
{
static void Main(string[] args)
{
Hashtable ht = new Hashtable();
ht.Add(1, "One");
ht.Add(2, "Two");
ht.Add(3, "Three");
foreach (DictionaryEntry de in ht)
{
int Key = (int)de.Key; //Casting
string value = de.Value.ToString(); //Casting
Console.WriteLine(Key + " " + value);
}

}
}
//Dictionary Example
class DictionaryProgram
{
static void Main(string[] args)
{
Dictionary<int, string> dt = new Dictionary<int, string>();
dt.Add(1, "One");
dt.Add(2, "Two");
dt.Add(3, "Three");
foreach (KeyValuePair<int, String> kv in dt)
{
Console.WriteLine(kv.Key + " " + kv.Value);
}
}
}
//In Short

Simply, Dictionary is a generic type, allowing:

static typing (and compile-time verification)
use without boxing

If you are .NET 2.0 or above, you should prefer Dictionary (and the other generic collections)

A subtle but important difference is that Hashtable supports multiple reader threads with a single writer thread, while Dictionary offers no thread safety. If you need thread safety with a generic dictionary, you must implement your own synchronization or (in .NET 4.0) use ConcurrentDictionary.
53. In which event are the controls fully loaded?
Page load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that view state is not fully loaded during this event
54. What is difference between Trace and Debug?
  • Use Debug class to debug builds

  • Use Trace class for both debug and release builds.

55. How can you manage client-side state?
  • Through Cookies

  • Through Hiddent field

  • Through ViewState

  • Through QueryString

56. Difference between DataSet and DataReader?

DataReader

DataReader is like a forward only recordset. It fetches one row at a time so very less network cost compare to DataSet(Fethces all the rows at a time). DataReader is readonly so we can't do any transaction on them. DataReader will be the best choice where we need to show the data to the user which requires no transaction. As DataReader is forward only so we can't fetch data randomly. .NET Data Providers optimizes the datareader to handle huge amount of data.

DataSet

DataSet is an in memory representation of a collection of Database objects including tables of a relational database schemas.

DataSet is always a bulky object that requires a lot of memory space compare to DataReader. We can say that the DataSet is a small database because it stores the schema and data in the application memory area. DataSet fetches all data from the datasource at a time to its memory area. So we can traverse through the object to get the required data like querying database.

Sql Server All Question Ans

0 comments

1) what is ssrs in sql server 2005?
Reporting Services (SSRS) provides a full range of ready-to-use tools and services to help you create, deploy, and manage reports.

2 )what are the basic differences between clustered & non-clustered indexes?
A clustered index is a speical type of index that orders the records in the way they are stored physically on the disk. A table can have only one clustered index. The leaf nodes of clustered index contain data pages.

A non-clustered index is a specail type of index in which logical order of records don't match with physical order of records. A table can have multiple non-clustered indexes. The leaf nodes contain index rows.

3) What is a linked server in SQL Server?

It enables SQL server to address diverse data sources like OLE DB similarly. It allows Remote server access and has the ability to issue distributed queries, updates, commands and transactions.
A linked server allows remote access. Using this, we can issue distributed queries, update, commands, and transactions across different data sources.

A linked server has an OLE DB provider and data source.

4) What is SQL service broker?

A service broker allows you to exchange messages between applications using SQL server as the transport mechanism. Message is a piece of information that needs to be shared. A service broker can also reject unexpected messages in disorganized format. It also ensures the messages come only once in order. It provides enhanced security as messages are handled internally by the database.

SQL service broker provides asynchronous queuing functionality to SQL server. Once message is sent to the SQL server, the client can continue with some other task instead of waiting for any notification from the server.

5) What is SQL Server English Query?

English query allows accessing the relational databases through English Query applications. Such applications permit the users to ask the database to fetch data based on simple English instead of using SQL statements.

English query allows the developer to question the database using English rather than SQL queries. The English query tool has enhanced features like support for oracle, a graphical user interface to query the database etc.

6) Explain the phases a transaction has to undergo.

The several phases a transaction has to go through are listed here. Database is in a consistent state when the transaction is about to start.

1. The transaction starts processing explicitly with the BEGIN TRANSACTION statement.
2. Record is written to the log when the transaction generates the first log record for data modification.
3. Modification starts one table at time. Here database is in inconsistent state.
4. When all of the modifications have completed successfully and the database is once again consistent, the application commits the transaction.
5. If some error it undoes (or rolls back) all of the data modifications. This process returns the database to the point of consistency it was at before the transaction started.

* Active state: This phase is divided into two states:
Initial phase: This phase is achieved when the transaction starts.
Partially Committed phase: This is achieved when the transactions final statement has been executed. Even though the final statement is finished execution, the transaction may abort due to some failure.
* Failed state: This state is reached when the normal execution fails.
Aborted state: A transaction is aborted when the system feels it needs to be failed. This state should not have any effect on the system and thus all changes done until it were aborted; are rolled back.
* Committed: After the transaction is successfully executed, it enters the committed state. In this state all changes are committed. These committed changes cannot be undone or aborting.

7) What is Log Shipping?

Log shipping defines the process for automatically taking backup of the database and transaction files on a SQL Server and then restoring them on a standby/backup server. This keeps the two SQL Server instances in sync with each other. In case production server fails, users simply need to be pointed to the standby/backup server. Log shipping primarily consists of 3 operations:

Backup transaction logs of the Production server.
Copy these logs on the standby/backup server.
Restore the log on standby/backup server.

Log shipping enables high availability of database. It the process of shipping the transaction log to another server. It copies the replica of the database. Both the databases are in synch. In case of failure of primary server or database, the secondary server can be used. In this process, another server called as monitor that tracks the history and status of backup and restore operations.


8) What are the Authentication Modes in SQL Server?

a. Windows Authentication Mode (Windows Authentication): uses user’s Windows account

b. Mixed Mode (Windows Authentication and SQL Server Authentication): uses either windows or SQL server

Authentication modes in SQL Server:

Windows: Allows user to authenticate based on the MS Windows account credentials.

Mixed Mode: Allows users to connect either through Windows authentication or an SQL Server authentication mode. Administrator might maintain user accounts in SQL Server.


9) Describe in brief system database.

Master Database

Master database is system database. It contains information about server’s configuration. It is a very important database and important to backup Master database. Without Master database, server can't be started.
MSDB Database

It stores information related to database backups, DTS packages, Replication, SQL Agent information, SQL Server jobs.

TEMPDB Database

It stores temporary objects like temporary tables and temporary stored procedure.
Model Database

It is a template database used in the creation of new database.

The system database contains information/metadata for all database present on an SQL Server instance. The system database stores information regarding logins, configuration settings, connected servers etc. It also holds various extended stored procedures to access external processes and applications.

Major system databases :

*
Master: Core system database to mange Sql Server instance.
*
Resource: Responsible for physically storing all system objects.
*
TempDB: This is a temporary database used to store temporary, tables, cursors, indexes, variables etc.
*
Model: This acts as a template database for all user created databases.
*
MSDB: Database to manage SQL Server agent configurations.
*
Distribution: Database primarily used for SQL Server replication.
*
ReportServer: Main database for reporting services to store metadata and other object definitions.
*
ReportServerTempDB: Acts as a temporary storage for reporting services.

10) What are the events recorded in a transaction log?

The start and end of each transaction
Every data modification
Every extent allocation or deallocation
The creation or dropping of a table or index

Events recorded in a transaction log:

*
Broker event category includes events produced by Service Broker.
*
Cursors event category includes cursor operations events.
*
CLR event category includes events fired by .Net CLR objects.
*
Database event category includes events of data.log files shrinking or growing on their own.
*
Errors and Warning event category includes SQL Server warnings and errors.
*
Full text event category include events occurred when text searches are started, interrupted, or stopped.
*
Locks event category includes events caused when a lock is acquired, released, or cancelled.
*
Object event category includes events of database objects being created, updated or deleted.
*
OLEDB event category includes events caused by OLEDB calls.
*
Performance event category includes events caused by DML operators.
*
Progress report event category includes Online index operation events.
*
Scans event category includes events notifying table/index scanning.
*
Security audit event category includes audit server activities.
*
Server event category includes server events.
*
Sessions event category includes connecting and disconnecting events of clients to SQL Server.
*
Stored procedures event category includes events of execution of Stored procedures.
*
Transactions event category includes events related to transactions.
*
TSQL event category includes events generated while executing TSQL statements.
*
User configurable event category includes user defined events.

11) What is RAID (Redundant Array of Inexpensive disks)? Explain its level.

RAID is a mechanism of storing the same data in different locations. Since the same data is stored, it is termed as redundant. The data is stored on multiple disks which improves performance. The drive’s storage is divided into units ranging from a sector (512 bytes) up to several megabytes. This is termed as disk stripping.

There are NINE types of RAID plus an additional non-redundant array (RAID-0). However, RAID levels 0, 1, and 5 are the most commonly found.

* RAID 0: This level does involve stripping but no redundancy of data. Offers the best performance at the cost of NO fault tolerance.
* RAID 1: This level is termed as data mirroring consisting of at least two drives that duplicate the storage of data. No stripping involved. Often used for multi user system for best performance and fault tolerance.
* RAID 2: It involves stripping with some disks storing error checking and correcting (ECC) information.
* RAID 5: Consists of 3 or more disks in a way that protects data against loss of any one disk.
* RAID 6: Has stripped disks with dual parity.
* RAID 10: uses both striping and mirroring.
* RAID 53: Merges the features of RAID level 0 and RAID level 3
------
RAID controller is used when one drive fails and the other is still running well. The controller will automatically rebuild the data from the other devices and restores the same to the crashed system. Hence the RAID controller technology, depending on the importance of the data, is used to restore the data automatically from the other systems.


12) What are the lock types?

SQL server supports following locks

Shared lock
Update lock
Exclusive lock
Shared lock

Shared Lock allows simultaneous access of record by multiple Select statements.
Shared Lock blocks record from updating and will remain in queue waiting while record is accessed for reading.
If update process is going on then read command will have to wait until updating process finishes.
Update locks

This lock is used with the resources to be updated.
Exclusive locks

This kind of lock is used with data modification operations like update, insert or delete.
--------

Main lock types:

*
Shared: Applied to read only operations where the data is not modified. E.g.: Select statements.
*
Update: Applied to resources which can be updated. It resolves dead locks in case of multiple sessions are reading, locking or updating resources later.
*
Exclusive: Used for operations involving data modification. E.g.: Insert, Update, and Delete. This ensures that multiple updates are not made to the same data at the same time.
*
Intent: Establishes a lock hierarchy. E.g.: Intent shared Intent exclusive and Shared with intentexclusive.
*
Schema: Used when schema dependent operations are being executed. E.g.: Schema modification and Schema stability.
*
Bulk update: Used while bulk copying of data and Tablock is specified.

13) Explain the use of NOLOCK query optimizer hint.

NOLOCK table hint used using WITH clause, is similar to read uncommitted. This option allows dirty reads are allowed. Using this option, shared locks cannot be issues to other transactions. This prevents existing transactions to not read incorrect data.
------------

NOLOCK is used to improve concurrency in a system. Using NOLOCK hint, no locks are acquired when data is being read. It is used in select statement. This results in dirty read - another process could be updating the data at the exact time data is being read. This may result in users seeing the records twice.
------------

NOLOCK would be deprecated in the future releases. It has been replaced by READUNCOMMITTED.
READUNCOMMITTED and NOLOCK cannot be specified for tables modified by insert, update, or delete operations.

They are ignored by the SQL query optimizer in the FROM clause that apply to the target table of an UPDATE or DELETE statement.

They specify that dirty reads are allowed. Transactions can modify data while it is being read by a transaction. Shared locks are not issued to prevent it.

Exclusive locks set by other transactions do not block the current transaction from reading the locked data.

Allowing dirty reads provide higher concurrency but it may generate errors for a transaction and present users with data that was never committed or may have the records displayed twice.

14) What is blocking?

When one connection from an application holds a lock and a second connection requires a conflicting lock type

15) What is database replicaion?

The process of copying/moving data between databases on the same or different servers.

Snapshot replication,

Transactional replication,

Merge replication

16) Define COLLATION.

Collation is the order that SQL Server uses for sorting or comparing textual data. There are three types of sort order Dictionary case sensitive, Dictonary - case insensitive and Binary

17) List out the difference between CUBE operator and ROLLUP operator.

Difference between CUBE operator and ROLLUP operator

CUBE operator is used in the GROUP BY clause of a SELECT statement to return a result set of multidimensional (multiple columns) nature.

Example:

A table product has the following records:-

Apparel Brand Quantity
Shirt Gucci 124
Jeans Lee 223
Shirt Gucci 101
Jeans Lee 210

CUBE can be used to return a result set that contains the Quantity subtotal for all possible combinations of Apparel and Brand:

SELECT Apparel, Brand, SUM(Quantity) AS QtySum
FROM product
GROUP BY Apparel, Brand WITH CUBE

The query above will return:

Apparel Brand Quantity
Shirt Gucci 101.00
Shirt Lee 210.00
Shirt (null) 311.00
Jeans Gucci 124.00
Jeans Lee 223.00
Jeans (null) 347.00
(null) (null) 658.00
(null) Gucci 225.00
(null) Lee 433.00

ROLLUP:- Calculates multiple levels of subtotals of a group of columns.

Example:

SELECT Apparel,Brand,sum(Quantity) FROM Product GROUP BY ROLLUP (Apparel,Brand);

The query above will return a sum of all quantities of the different brands.

---------

CUBE generates a result set that represents aggregates for all combinations of values in the selected columns.

ROLLUP generates a result set that represents aggregates for a hierarchy of values in the selected columns.

---------

CUBE ROLLUP
It’s an additional switch to GROUP BY clause. It can be applied to all aggregation functions to return cross tabular result sets. It’s an extension to GROUP BY clause. It’s used to extract statistical and summarized information from result sets. It creates groupings and then applies aggregation functions on them.
Produces all possible combinations of subtotals specified in GROUP BY clause and a Grand Total. Produces only some possible subtotal combinations.

18) Define @@Error and raiseerror.

Raiseerror is used to produce an error which is user defined or used to invoke an existing error present in sys.messages. They are most commonly used in procedures when any condition fails to meet.

Example:

SELECT COUNT(*) INTO :rows FROM student
WHERE studentid = : studentid;

IF :rows <> 0 THEN
RAISE ERROR 1 MESSAGE 'Student id exists in the "Student" table.';
ENDIF;

@@error is used to hold the number of an error. When a T-SQL statement is executed, @@error value is set to 0 by the SQL server. If an error occurs, the number of that error is assigned as a value.

Example: the value of @@error can be checked for “0” value to be safe.
------

@@Error

* It is system variable that returns error code of the SQL statement.
* If no error, it returns zero.
* @@Error is reset after each SQL statement.

Raiseerror

Raiseerror command reports error to client application.

---------
SQL Server provides @@Error variable that depicts the status of the last completed statement in a given set of statements. If the statement was executed successfully the variable holds 0 value else it holds the number of the error message that occurred. Raiseerror is used to send messages to applications using the same format as a system error or warning generated by SQL Server engine. It can also return a user defined message. RAISEERROR is often used to help in troubleshooting, check values of data, returns variable value based messages, cause an execution to jump to a CATCH from TRY.

19) When do we use the UPDATE_STATISTICS command?

UPDATE_STATISTICS updates the indexes on the tables when there is large processing of data. If we do a large amount of deletions any modification or Bulk Copy into the tables, we need to basically update the indexes to take these changes into account

20) Define Local temporary table and global temporary table.

Local temporary table is created by prefixing name with pound sign like (#table_name). Global temporary table is created by prefixing name with Double pound sign like (##table_name).
Local temporary table is dropped when the stored procedure completes. Global temporary tables are dropped when session that created the table ends

Wednesday, December 1, 2010

Asp.Net Frequently Asked Question

0 comments

1. What’s the difference between Response.Write() andResponse.Output.Write()?

Response.Output.Write() allows you to write formatted output.
2. What methods are fired during the page load?

Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.
3. When during the page processing cycle is ViewState available?

After the Init() and before the Page_Load(), or OnLoad() for a control.
4. What namespace does the Web page belong in the .NET Framework class hierarchy?

System.Web.UI.Page
5. Where do you store the information about the user’s locale?

CodeBehind is relevant to Visual Studio.NET only.
6. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?

CodeBehind is relevant to Visual Studio.NET only.
7. What is the Global.asax used for?

The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
8. What are the Application_Start and Session_Start subroutines used for?

This is where you can set the specific variables for the Application and Session objects.
9. Whats an assembly?

Assemblies are the building blocks of the .NET framework;
10. Whats MSIL, and why should my developers need an appreciation of it if at all?

MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.
11. Which method do you invoke on the DataAdapter control to load your generated dataset with data?

The Fill() method.
12. Can you edit data in the Repeater control?

No, it just reads the information from its data source.
13. Which template must you provide, in order to display data in a Repeater control?

ItemTemplate.
14. Name two properties common in every validation control?

ControlToValidate property and Text property.
15. What base class do all Web Forms inherit from?

The Page class.
16. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?

Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address
17. What is ViewState?

ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.
18. What is the lifespan for items stored in ViewState?

Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).
19. What does the "EnableViewState" property do? Why would I want it on or off?

It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.
20. What are the different types of Session state management options available with ASP.NET?

ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

Monday, November 29, 2010

Asp.Net Framework Question Ans

0 comments

1) what is .NET ?

.Net is a framework where we can develop different applications in a single environment using different type of languages


2)What is .NET Framework?


The .NET Framework has two main components: the common language runtime and

the .NET Framework class library.

You can think of the runtime as an agent that manages code at execution time,

providing core services such as memory management, thread management, and

remoting, while also enforcing strict type safety and other forms of code accuracy that

ensure security and robustness.

The class library, is a comprehensive, object-oriented collection of reusable types that

you can use to develop applications ranging from traditional command-line or

graphical user interface (GUI) applications to applications based on the latest

innovations provided by ASP.NET, such as Web Forms and XML Web services.


3) What is CLR?

The CLS is simply a specification that defines the rules to support language integration

in such a way that programs written in any language, yet can interoperate with one

another, taking full advantage of inheritance, polymorphism, exceptions, and other

features.

4) What are Generics in .Net framework 2.0?

Generics are related to the idea of Templates in C++. They permit classes, structs, interfaces, delegates, and methods to be parameterized by the types of data they store and manipulate. Without generics, general purpose methods or data structures (like Lists, Stacks, etc.) typically use the built-in Object type to store data of any type. While the use of the built-in Object type makes the implementation very flexible, it has drawbacks with regards to Performance and Type Safety.


5) What does the "EnableViewState" property do? Why would I want it on or off?

EnableViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not.

6)What are the different modes for the sessionstates in the web.config file?

Off: Indicates that session state is not enabled.

Inproc: Indicates that session state is stored locally.

StateServer: Indicates that session state is stored on a remote server.

SQLServer: Indicates that session state is stored on the SQL Server.

7) Conditional Boating?
Bloating is an activity of performance improvement which is basically introduced in AJAX controls. The property UpdateMode is responsible for bloating for example the control updatepanel if you set UpdateMode Conditional then that clears your query.

8) What is the difference between Dataset.clone() and Dataset.copy()?
Using Dataset.clone() creates new instance of the same object.
Using Dataset.copy() copies content of data to another object wihtout creating new instance.

9) What is the difference between EVENTS and FUNCTIONS?
Event represents an action that is done to an object whereas Function represents an action that the object itself is doing.

10) what is the difference between application state and caching?
Application variable is the global variable specific to application but a
caching variable is specifc to page and time out.
Application variables exist as long as the application is alive. Whereas the cache has the Property of timeout which allows us to control the duration of the Objects so cached.
Another usefulness in caching is that we can define the way we cache our output since caching can be done in 3 ways -
a) Full Page - defined in page directrive
b) Partial Page - Eg - .ascx control
c) Data / Programatic caching. using the Properties of Cache object such as Cache.Insert .

NOTE:
Caching variable is specifc to page and time out
Application variable is the global variable specific to application

11) What is a Webcontrol?

Serves as the base class that defines the methods properties and events common to all controls in the System.Web.UI.WebControls namespace
A control is an object that can be drawn on to the Web Form to enable or enhance user interaction with the application. Examples of these controls include the TextBoxes Buttons Labels Radio Buttons etc. All these Web server controls are based on the System.Web.UI.Control class


12) Where do the Cookie State and Session State information be stored?

While executing the dynamic web page at the end of execution the value of session variables is calculated compressed and transmitted to the client via a Cookie. At this stage the state resides entirely and only on the client file system (or RAM).

Cookie Information will be stored in a txt file on client system under a
folder named Cookies. Search for it in your system you will find it.

Coming to Session State

As we know for every process some default space will be allocated by OS.

In case of InProc Session Info will be stored inside the process where our
application is running.

In case of StateServer Session Info will be stored using ASP.NET State Service.

In case of SQLServer Session info will be stored inside Database. Default DB
which will be created after running InstallSQLState Script is ASPState.

13) what is difference between key word &key filter?

The KeyFilter property is a new property that was added to control. Handling the KeyDown /KeyUp / KeyPress generates a callback on every key down which can be a great overhead if all you want is to handle a specific key down. That is way the new KeyFilter property was added. Basically it allows to define a filter which helps VWG generate callbacks only when you really need it. In the following sample code we have demonstrated the implementation of adding arrow behaviors to a set of text boxes which allows navigating between the fields.

Keyword is the reserved default words used by the language.


14) What is the difference between mechine.config and web.config?
Every asp.net application has web.cofig file. the settings given in this file is implied to that particular application only.But the settings given in machine.config file is implied to whole system.
Basically Machine.config file content the configuration setting for a particullar machine and Web.config file is used to store configure a particular web application. On any system there will be only one Machine.config file but Web.config file can number of time as per web application

15) What is the difference between Response.Redirect and Server.Transfer?

Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performs a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

Response.Redriect means it can redirect the page which is located inside the application directory.server.transfer means it goes to another directory of the file.

Server.Transfer() send the request to server
Response.Redirect() sends the request to Browser
So If the Request is made for the location outside the Server it fails. so you need to use Respons.Redirect().

16) What is use of DataAdapater? and is it possible to add data from data reader directly to a dataset or a datatable?

DataAdapters purpose is to perform database queries and create dataTables containing the query results. Its also capable of writing changes made to the datataTables back to the database.

DataAdapter acts as a go-between providing a layer of abstraction between DataSet and the Physical Data sorce.


17) how many kinds of web services are there?

1) .Net web services

2) Java web services

3) brand X web services (built on SOAP)


18) what is name space for xml in asp.net

NameSpace : System.XML
Filde: System.Xml.dll


19) difference between remoting and web service in .net?explain with an example

in web service when the function which resides in the server is called by client side the message protocol used is soap and transfer protocol used is http.so all the message is first converted to xml format and serializes and use http transfer protocol for transfer to the server and again in server it gets deserialized and from the xml file it gets information about which fun ction is called by the client and what r the parameter.and agai return the value in xml format.As the message is passed in xml format it is platform independent

Remoting lets us enjoy the same power of web services when the platform is same.we can connect to the server directly over TCP and send binary data without having to do lots of conversion.


20) Explain the life cycle of an ASP .NET page.

Events in ASP.Net 1.1 & 2.0 :-



Application: BeginRequest
Application: PreAuthenticateRequest
Application: AuthenticateRequest
Application: PostAuthenticateRequest
Application: PreAuthorizeRequest
Application: AuthorizeRequest
Application: PostAuthorizeRequest
Application: PreResolveRequestCache
Application: ResolveRequestCache
Application: PostResolveRequestCache
Application: PreMapRequestHandler
Page: Construct
Application: PostMapRequestHandler
Application: PreAcquireRequestState
Application: AcquireRequestState
Application: PostAcquireRequestState
Application: PreRequestHandlerExecute
Page: AddParsedSubObject
Page: CreateControlCollection
Page: AddedControl
Page: AddParsedSubObject
Page: AddedControl
Page: ResolveAdapter
Page: DeterminePostBackMode
Page: PreInit
Control: ResolveAdapter
Control: Init
Control: TrackViewState
Page: Init
Page: TrackViewState
Page: InitComplete
Page: LoadPageStateFromPersistenceMedium
Control: LoadViewState
Page: EnsureChildControls
Page: CreateChildControls
Page: PreLoad
Page: Load
Control: DataBind
Control: Load
Page: EnsureChildControls
Page: LoadComplete
Page: EnsureChildControls
Page: PreRender
Control: EnsureChildControls
Control: PreRender
Page: PreRenderComplete
Page: SaveViewState
Control: SaveViewState
Page: SaveViewState
Control: SaveViewState
Page: SavePageStateToPersistenceMedium
Page: SaveStateComplete
Page: CreateHtmlTextWriter
Page: RenderControl
Page: Render
Page: RenderChildren
Control: RenderControl
Page: VerifyRenderingInServerForm
Page: CreateHtmlTextWriter
Control: Unload
Control: Dispose
Page: Unload
Page: Dispose
Application: PostRequestHandlerExecute
Application: PreReleaseRequestState
Application: ReleaseRequestState
Application: PostReleaseRequestState
Application: PreUpdateRequestCache
Application: UpdateRequestCache
Application: PostUpdateRequestCache
Application: EndRequest
Application: PreSendRequestHeaders
Application: PreSendRequestContent


------------

Page_Init -- Page Initialization

LoadViewState -- View State Loading

LoadPostData -- Postback data processing

Page_Load -- Page Loading

RaisePostDataChangedEvent -- PostBack Change Notification

RaisePostBackEvent -- PostBack Event Handling

Page_PreRender -- Page Pre Rendering Phase

SaveViewState -- View State Saving

Page_Render -- Page Rendering

Page_UnLoad -- Page Unloading


21) How to debug javascript or vbscript in .Net?
For debugging the client side script enable the debugging in IE.a. Open Microsoft Internet Explorer.b. On the Tools menu click Internet Options.c. On the Advanced tab locate the Browsing section clear the Disable script debugging check box and then click OK.d. Close Internet Explorer.

22) How to validate xmlschema in xml document?
One can validate the XML document againest a given schema using the .Net class under the package System.Xml.Schema; like using XMLSchemaValidator and XmlSchema.

23) What is the maximum number of cookies that can be allowed to a web site

- A maximum of 300 cookies can be stored on the user's system.
- No cookie can be larger than 4 kilobytes.
- No server or domain can place more than 20 cookies on a user's system. (One website can't hog all 300 cookies.)
- If you go beyond the maximum the browser will just discard old cookies to make room for the new ones.

24) What do you mean by authentication and authorization?
Authentication is the process of validating a user on the credentials (username and password) and authorization performs after authentication. After Authentication a user will be verified for performing the various tasks, It access is limited it is known as authorization.

25) What you thing about the WebPortal ?

Answer: Web portal is nothing but a page that allows a user to customize his/her homepage. We can use Widgets to create that portal we have only to drag and drop widgets on the page. The user can set his Widgets on any where on the page where he has to get them. Widgets are nothing but a page area that helps particular function to response. Widgets example are address books, contact lists, RSS feeds, clocks, calendars, play lists, stock tickers, weather reports, traffic reports, dictionaries, games and another such beautiful things that we can not imagine. We can also say Web Parts in Share Point Portal. These are one of Ajax-Powered.

26) How to start Outlook,NotePad file in AsP.NET with code ?
Answer: Here is the syntax to open outlook or notepad file in ASP.NET VB.NET Process.Start("Notepad.exe") Process.Start("msimn.exe"); C#.NET System.Diagnostics.Process.Start("msimn.exe"); System.Diagnostics.Process.Start("Notepad.exe");

27) What is the purpose of IIS ?
Answer: 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.

28) What is the difference between Trace and Debug?
Trace and Debug - There are two main classes that deal with tracing - Debug and Trace. They both work in a similar way - the difference is that tracing from the Debug class only works in builds that have the DEBUG symbol defined, whereas tracing from the Trace class only works in builds that have the TRACE symbol defined. Typically this means that you should use System.Diagnostics.Trace.WriteLine for tracing that you want to work in debug and release builds, and System.Diagnostics.Debug.WriteLine for tracing that you want to work only in debug builds.

29) What is @@connection?

The Query Designer supports the use of certain SQL Server constants, variables, and reserved column names in the Grid or SQL panes. Generally, you can enter these values by typing them in, but the Grid pane will not display them in drop-down lists. Examples of supported names include:
· IDENTITYCOL If you enter this name in the Grid or SQL pane, the SQL Server will recognize it as a reference to an auto-incrementing column.
· Predefined global values You can enter values such as @@CONNECTIONS and @@CURSOR_ROW into the Grid and SQL panes.
· Constants (niladic functions) You can enter constant values such as CURRENT_TIMESTAMP and CURRENT_USER in either pane.
· NULL If you enter NULL in the Grid or SQL panes, it is treated as a literal value, not a constant.

30) what is diff between varcher and nvarchar?

VARCHAR is an abbreviation for variable-length character string. It's a string of text characters that can be as large as the page size for the database table holding the column in question. The size for a table page is 8,196 bytes, and no one row in a table can be more than 8,060 characters. This in turn limits the maximum size of a VARCHAR to 8,000 bytes.
The "N" in NVARCHAR means uNicode. Essentially, NVARCHAR is nothing more than a VARCHAR that supports two-byte characters. The most common use for this sort of thing is to store character data that is a mixture of English and non-English symbols — in m UTF-8). That said, NVARCHAR strings have the same length restrictions as their VARCHAR cousins — 8,000 bytes. However, since NVARCHARs use two bytes for each character, that means a given NVARCHAR can only hold 4,000 characters (not bytes) maximum. So, the amount of storage needed for NVARCHAR entities is going to be twice whatever you'd allocate for a plain old VARCHAR.
Because of this, some people may not want to use NVARCHAR universally, and may want to fall back on VARCHAR — which takes up less space per row — whenever possible.
may case, English and Japanese.

31)What is the maximum size of the file that I can upload using file upload control?
Ans. 4MB

32) What class all aspx pages inherits?

Ans.
System.Web.UI.Page

33) What is NewID?
Yes, newid() is unique. newid() returns a globally unique identifier. newid() will be unique for each call of newid().
Thus, newid() can be used as the value of a primary key of a sql server table. Values returned by newid() can be inserted into a primary key column of type "uniqueidentifier". Here is an example of a "uniqueidentifier" primary key column, with newid() used as the default value:
CREATE TABLE [tblUsers] (
[UserId] [uniqueidentifier] NOT NULL DEFAULT (newid()),
[UserName] [varchar](256) NOT NULL,
PRIMARY KEY ([UserId])

34) What is the use of AutoWireup in asp.net?

AutoEventWireup attribute is used to set whether the events needs to be automatically generated or not.
In the case where AutoEventWireup attribute is set to false (by default) event handlers are automatically required for Page_Load or Page_Init. However when we set the value of the AutoEventWireup attribute to true the ASP.NET runtime does not require events to specify event handlers like Page_Load or Page_Init.

35) how do you differentiate managed code and unmanaged code?

Managed code :Code that is executed by the CLR. Managed code provides information (i.e., metadata) to allow the CLR to locate methods encoded in assembly modules, store and retrieve security information, handle exceptions, and walk the program stack. Managed code can access both managed data and unmanaged data. Managed data—Memory that is allocated and released by the CLR using Garbage Collection. Managed data can only be accessed by managed code

Unmanaged Code:Unmanaged code is what you use to make before Visual Studio .NET 2002 was released. Visual Basic 6, Visual C++ , It is compiled directly to machine code that ran on the machine where you compiled it—and on other machines as long as they had the same chip, or nearly the same. It didn't get services such as security or memory management from an invisible runtime; it got them from the operating system. And importantly, it got them from the operating system explicitly, by asking for them, usually by calling an API provided in the Windows SDK. More recent unmanaged applications got operating system services through COM calls.



Managed Code is what Visual Basic .NET and C# compilers create. It compiles to Intermediate Language (IL) not to machine code that could run directly on your computer.Managed code runs in the Common Language Runtime.

Unmanaged code is what you use to make before Visual Studio .NET 2002 was released.It compiled directly to machine code that ran on the machine where you compiled it—and on other machines as long as they had the same chip or nearly the same.

-------

The code which is under control of CLR (Common Language Runtime) is called managed code.

The code which takes Operating System help while execution is called unmanaged code.