Interview Questions for .NET Framework

This article is specially for the users those are in development or want to be a .net developer

  • To test a Web Service you must create a windows application or web application to consume this service? It is True/False?

    How many classes can a single.NET DLL contain?
    As many

    One or more

    What are good ADO.NET object(s) to replace the ADO Recordset object?
    The differences includes
    In ADO, the in-memory representation of data is the recordset.
    In, it is the dataset
    A recordset looks like a single table in ADO
    In contrast, a dataset is a collection of one or more tables in
    ADO is designed primarily for connected access the disconnected access to the database is used
    In ADO you communicate with the database by making calls to an OLE DB provider.
    In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source.
    In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database.

    On order to get assembly info which namespace we should import?
    System.Reflection Namespace

    How do you declare a static variable and what is its lifetime? Give an example.
    static int Myint–The life time is during the entire application.
    br> Answer2
    The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs.

    a. Static int var //in
    b. static void Time( ) //in

    How do you get records number from 5 to 15 in a dataset of 100 records? Write code.
    DataSet ds1=new DataSet(); String strCon=”data source=IBM-6BC8A0DACEF;initial catalog=pubs;integrated security=SSPI;persist” +” security info=False;user
    id=sa;workstation id=IBM-6BC8A0DACEF;packet size=4096?;
    String strCom1=”SELECT * FROM employee”;
    SqlDataAdapter sqlDa1=new SqlDataAdapter(strCom1,strCon);
    DataGrid dg1.DataSource=ds1.Tables[”employee”].DefaultView;

    OleDbDataAdapter1.Fill(DataSet21, 5, 15, “tab”)
    This will fill the dataset with the records starting at 5 to 15
    .NET Database interview questions

    How do you call and execute a Stored Procedure in.NET? Give an example.
    ds1=new DataSet();
    sqlCon1=new SqlConnection(connectionstring);
    String strCom1=”byroyalty”;
    sqlCom1=new SqlCommand(strCom1,sqlCon1);
    sqlDa1=new SqlDataAdapter(sqlCom1);
    SqlParameter myPar=new SqlParameter(”@percentage”,SqlDbType.Int);
    sqlCom1.Parameters.Add (myPar);

    Dim cn as new OleDbConnection ( “Provider=Microsoft.Jet.OLEDB.4.0;”+ _
    “Data Source=C:\Documents and Settings\User\My Documents\Visual Studio Projects\1209\db1.mdb”+ _
    “User ID=Admin;”+ _
    Dim cmd As New OleDbCommand(”Products”, cn)
    cmd.CommandType = CommandType.StoredProcedure
    Dim da As New OleDataAdapter(cmd)
    Dim ds As New DataSet()
    da.Fill(ds, “Products”)
    DataGrid1.DataSource = ds.Tables(”Products”)

    What is the maximum length of a varchar in SQL Server?
    Null-terminated Unicode character string of length n,
    with a maximum of 255 characters. If n is not supplied, then 1 is assumed.


    The business logic is the aspx.cs or the aspx.vb where the code is being written. The presentation logic is done with .aspx extention.

    How do you define an integer in SQL Server?
    We define integer in Sql server as
    var_name int

    How do you separate business logic while creating an ASP.NET application?
    There are two level of debugging
    1. Page level debugging
    For this we have to edit the page level debugging enable the trace to true in the line in the html format of the page.
    %@ Page Language=”vb” trace=”true”AutoEventWireup=”false” Codebehind=”WebForm1.aspx.vb” Inherits=”WebApplication2.WebForm1?>

    2. You can enable the debugging in the application level for this
    Edit the following trace value in web.config file
    Enable trace enabled=true.

    If there is a calendar control to be included in each page of your application, and and we do not intend to use the Microsoft-provided calendar control, how do you develop it? Do you copy and paste the code into each and every page of your application?

    Create the Calendar User Control
    The control we will create will contain a calendar control and a label which has the corresponding date and time written
    Steps are:-

    Creating a CalenderControl
    1) To begin, open Visual Studio .NET and begin a new C# Windows Control Library.
    2) You may name it whatever you like, for this sample the project name will be CalenderControl

    Using the Calender Control in a Windows Application
    It’s just like adding any other control like a button or a label.
    1) First, create a new Windows Application project named: CustomControl.
    2) Add a reference to the Calender Control DLL named: CalenderControl.dll.
    3) Now you a can customize the Toolbox:
    Right-Click the Toolbox> .NET Framework Components> Browse> select the CalenderControl.dll.
    4)The Calender Control is now added to the Toolbox and can be inserted in Windows Form as any other control. The control itself will take care of the date display

    How can you deploy an application ?
    You can deploy an ASP.NET Web application using any one of the following three deployment options.
    a) Deployment using VS.NET installer
    b) Using the Copy Project option in VS .NET
    c) XCOPY Deployment

    Explain similarities and differences between Java and.NET?
    Comparing Java and .NET is comparing apples and oranges. Either the question needs to be to compare Java and C# or J2EE and .NET.

    What are the XML files that are important in developing an ASP.NET application?
    The XML file necessary for the for developing an application is Web.config

    Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?
    Declare the variables in Global.aspx

    How many objects are there in ASP?
    8 objects, they are request,response, server,application,session,file, dictionary, textstream.

    There are 6 objects in
    a) Server
    b) Session
    c) Application
    d) ObjectContext
    e) Response
    f) Request

    Which DLL file is needed to be registered for ASP?
    The dll needed for the is SYSTEM.WEB.dll

    Is there any inbuilt paging (for example shoping cart, which will show next 10 records without refreshing) in ASP? How will you do pating?
    Use DataGrid control which has in-built paging features for the purpose.

    What does Server.MapPath do?
    srver.mappath() maps the path given in the argument to the server’s physical path.

    It returns the complete(absolute) path of the file used in parameter.

    It returns a string containing the physical path in the server’s file system that corresponds to the virtual or relative path specified by the Path argument.

    Name atleast three methods of response object other than Redirect.
    a) Response.Clear( )
    Clears the content of the current output stream.
    b) Response.Close( )
    Closes the network socket for the current response.
    c) Response.End( )
    Stops processing the current request and sends all buffered content to the client immediately.

    methods of Response is Redirect a. Transfer

    Name atleast two methods of response object other than Transfer.
    a) Response.ClearContent( )
    Clears the content of the current output stream.
    b) Response.ClearHeaders( )
    Clears the HTTP headers from the current output stream.

    What is State?
    It is the property of the web forms.
    ASP.NET provides four types of state:
    Application state
    Session state
    Cookie state
    View state.

    Explain differences between ADO and DAO.
    dao- can access only access database
    ado- can access any databases

    How many types of cookies are there?
    2 types, persistant and impersistant.

    How many types of cookies are there?
    Two type of cookeies.
    a) single valued eg request.cookies(”UserName”).value=”Mahesh”
    b)Multivalued cookies. These are used in the way collections are used.
    rember no value method in multivalued cooki

    There are two types of cookies:
    Session cookies
    Persistent cookies

    Tell few steps for optimizing (for speed and resource) ASP page/application.
    Avoid mixing html code with asp code

    Which command using Query Analyzer will give you the version of SQL Server and Operating System?
    Returns version, processor architecture, build date, and operating system for the current installation of SQL Server.

    How to find the SQL server version from Query Analyser
    To determine which version of Microsoft SQL Server 2005 is running, connect to SQL Server 2005 by using SQL Server Management Studio, and then run the following Transact-SQL statement:
    SELECT SERVERPROPERTY(’productversion’), SERVERPROPERTY (’productlevel’), SERVERPROPERTY (’edition’)
    The results are:
    • The product version (for example, “9.00.1399.06?)
    . • The product level (for example, “RTM”).
    • The edition (for example, “Enterprise Edition”).
    For example, the result looks similar to:
    9.00.1399.06 RTM Enterprise Edition

    How to determine which version of SQL Server 2000 is running
    To determine which version of SQL Server 2000 is running, connect to SQL Server 2000 by using Query Analyzer, and then run the following code:
    SELECT SERVERPROPERTY(’productversion’), SERVERPROPERTY (’productlevel’), SERVERPROPERTY (’edition’)
    The results are:
    • The product version (for example, 8.00.534).
    • The product level (for example, “RTM” or “SP2?).
    • The edition (for example, “Standard Edition”). For example, the result looks similar to
    8.00.534 RTM Standard Edition

    One can also use SELECT @@Version where the result would look like
    Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
    Oct 14 2005 00:33:37
    Copyright (c) 1988-2005 Microsoft Corporation
    Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

    Using query analyzer, name 3 ways you can get an accurate count of the number of records in a table.
    a. Select count(*) from table1
    b. SELECT object_name(id) ,rowcnt FROM sysindexes WHERE indid IN (1,0) AND OBJECTPROPERTY(id, ‘IsUserTable’) = 1
    c. exec sp_table_validation @table = ‘authors’

    SELECT count( * ) as totalrecords FROM employee
    This will display total records under the name totalrecords in the table employee
    use COUNT_BIG
    Returns the number of items in a group.
    Returns the number of rows affected by the last statement.
    Use this statement after an SQL select * statement, to retrieve the total number of rows in the table



01.                           When was .NET announced?

  • Ans : Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET.


  • 02. When was the first version of .NET released?
  • Ans : The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.


  • 03. What platforms does the .NET Framework run on?
  • Ans : The runtime supports Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms - for example, ASP.NET is only supported on Windows XP and Windows 2000. Windows 98/ME cannot be used for development. IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home. The Mono project is attempting to implement the .NET framework on Linux.


  • 04. What is the CLR?
  • Ans : CLR = Common Language Runtime. The CLR is a set of standard resources that (in theory) any .NET program can take advantage of, regardless of programming language. Robert Schmidt (Microsoft) lists the following CLR resources in his MSDN PDC# article:Object-oriented programming model (inheritance, polymorphism, exception handling, garbage collection)  Security model Type system All .NET base classes
     Many .NET framework classes Development, debugging, and profiling tools Execution and code management  IL-to-native translators and optimizers What this means is that in the .NET world, different programming languages will be more equal in capability than they have ever been before, although clearly not all languages will support all CLR services.


  • 05. What is the CTS?
  • Ans : CTS = Common Type System. This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS.


  • 06. What is the CLS?
  • Ans : CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language.
    In theory this allows very tight interop between different .NET languages - for example allowing a C# class to inherit from a VB class.


  • 07. What is IL?
  • Ans : IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.


  • 08. What does 'managed' mean in the .NET context?
  • Ans : The term 'managed' is the cause of much confusion. It is used in various places within .NET, meaning slightly different things.Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example
  • exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime.
  • Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).
    Managed data: This is data that is allocated and de-allocated by the .NET runtime's garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword.Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages - for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.


  • 09. What is reflection?
  • Ans : All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.
    Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes - e.g. determining data type sizes for marshaling data across context/process/machine boundaries.
    Reflection can also be used to dynamically invoke methods (see System.Type.InvokeMember ) ,  or even create types dynamically at run-time (see System.Reflection.Emit.TypeBuilder).


  • 10. What is the difference between Finalize and Dispose (Garbage collection) ?
  • Ans : Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize Method on an object (destructor syntax in C# and the Managed Extensions for C++). The garbage collector calls this method at some point after there are no longer any valid references to the object. In some cases, you might want to provide programmers using an object with the ability to explicitly release these external resources before the garbage collector frees the object. If an external resource is scarce or expensive, better performance can be achieved if the programmer explicitly releases resources when they are no longer being used. To provide explicit control, implement the Dispose method provided by the IDisposable Interface. The consumer of the object should call this method when it is done using the object.
  • Dispose can be called even if other references to the object are alive. Note that even when you provide explicit control by way of Dispose, you should provide implicit cleanup using the Finalize method. Finalize provides a backup to prevent resources from
  • permanently leaking if the programmer fails to call Dispose.


  • 11. What is Partial Assembly References?
  • Ans : Full Assembly reference: A full assembly reference includes the assembly's text name, version, culture, and public key token (if the assembly has a strong name). A full assembly reference is required if you reference any assembly that is part of the common language runtime or any assembly located in the global assembly cache.


  • 12. Partial Assembly reference: We can dynamically reference an assembly by providing only partial information, such as specifying only the assembly name. When you specify a partial assembly reference, the runtime looks for the assembly only in the application directory. We can make partial references to an assembly in your code one of the following ways:
    -> Use a method such as System.Reflection.Assembly.Load and specify only a partial reference. The runtime checks for the assembly in the application directory.
    -> Use the System.Reflection.Assembly.LoadWithPartialName method and specify only a partial reference. The runtime checks for the assembly in the application directory and in the global assembly cache


  • 13. Changes to which portion of version number indicates an incompatible change?
  • Ans : Major or minor. Changes to the major or minor portion of the version number indicate an incompatible change. Under this convention then, version would be considered incompatible with version Examples of an incompatible change would be a change to the types of some method parameters or the removal of a type or method altogether. Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases. Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a particular bug. You'll sometimes hear this referred to as the "emergency bug fix" number in that the revision is what is often changed when a fix to a specific bug is shipped to a customer.


  • 14. How to set the debug mode?
  • Debug Mode for ASP.NET applications - To set ASP.NET appplication in debugging mode, edit the application's web.config and assign the "debug" attribute in < compilation > section to "true" as show below:
    < configuration >
      < system.web >
        < compilation defaultLanguage="vb" debug="true" / >
    < / configuration >
  • This case-sensitive attribute 'debug tells ASP.NET to generate symbols for dynamically generated files and enables the
    debugger to attach to the ASP.NET application. ASP.NET will detect this change automatically, without the need to restart the server. Debug Mode for ASP.NET Webservices - Debugging an XML Web service created with ASP.NET is similar to the debugging an ASP.NET Web application.
  • 15. What is the property available to check if the page posted or not?
  • Ans : The Page_Load event handler in the page checks for IsPostBack property value, to ascertain whether the page is posted. The Page.IsPostBack gets a value indicating whether the page is being loaded in response to the client postback, or it is for the first time. The value of Page.IsPostBack is True, if the page is being loaded in response to the client postback; while its value is False, when the page is loaded for the first time. The Page.IsPostBack property facilitates execution of certain routine in Page_Load, only once (for e.g. in Page load, we need to set default value in controls, when page is loaded for the first time. On post back, we check for true value for IsPostback value and then invoke server-side code to update data).
  • 16. Which are the abstract classes available under system.xml namespace?
    Ans : The System.XML namespace provides XML related processing ability in .NET framework. XmlReader and XMLWriter are the two abstract classes at the core of .NET Framework XML classes:

1.                                                      XmlReader provides a fast, forward-only, read-only cursor for processing an XML document stream.

2.                                                      XmlWriter provides an interface for producing XML document streams that conform to the W3C's XML standards.

  • Both XmlReader and XmlWriter are abstract base classes, which define the functionality that all derived classes must support.


  • 17. Is it possible to use multipe inheritance in .net?
    Ans : Multiple Inheritance is an ability to inherit from more than one base class i.e.  ability of a class to have more than one superclass, by inheriting from different sources and thus combine separately-defined behaviors in a single class. There are two types of multiple inheritance: multiple type/interface inheritance and multiple implementation inheritance. C# & VB.NET supports only multiple type/interface inheritance, i.e. you can derive an class/interface from multiple interfaces. There is no support for multiple implementation inheritance in .NET. That means a class can only derived from one class.
  • 18. What are the derived classes from xmlReader and xmlWriter?
    Both XmlReader and XmlWriter are abstract base classes, which define the functionality that all derived classes must support.
    There are three concrete implementations of XmlReader:
    There are two concrete implementations of XmlWriter:
    XmlTextReader and XmlTextWriter support reading data to/from text-based stream, while XmlNodeReader and XmlNodeWriter are designed for working with in-memory DOM tree structure. The custom readers and writers can also be developed to extend the built-in functionality of XmlReader and XmlWriter.
  • 19. What is managed and unmanaged code?
  • Ans : The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. i.e., code executing under the control of the CLR is called managed code. For example, any code written in C# or Visual Basic .NET is managed code. Code that runs outside the CLR is referred to as "unmanaged code." COM components, ActiveX components, and Win32 API functions are examples of unmanaged code.
  • 20. How you deploy .NET assemblies?
    Ans : One way is simply use xcopy. others are use and the setup projects in .net. and one more way is use of nontuch deployment.


  • 21. What is Globalizationa and Localization ?
    Ans : Globalization is the process of creating an application that meets the needs of users from multiple cultures. It includes using the correct
    currency, date and time format, calendar, writing direction, sorting rules, and other issues. Accommodating these cultural differences in an application is called localization.Using classes of System.Globalization namespace, you can set application's current culture.
  • This can be achieved by using any of the following 3 approaches.
          1.      Detect and redirect
          2.      Run-time adjustment
          3.      Using Satellite assemblies.

  • 22. Whate are Resource Files ? How are they used in .NET?
    Ans : Resource files are the files containing data that is logically deployed with an application.These files can contain data in a number of formats including strings, images and persisted objects. It has the main advantage of If we store data in these files then we don't need to compile these if the data get changed. In .NET we basically require them storing culture specific informations by localizing application's resources. You can deploy your resources using satellite assemblies.
  • 23. Difference between Dispose and Finallize method?
  • Ans : Finalize method is used to free the memory used by some unmanaged resources like window handles (HWND). It's similar to the destructor syntax in C#. The GC calls this method when it founds no more references to the object. But, In some cases we may need release the memory used by the resources explicitely.To release the memory explicitly we need to implement the Dispose method of IDisposable interface.
  • 24. What is encapsulation ?
  • Ans : Encapsulation is the ability to hide the internal workings of an object's behavior and its data. For instance, let's say you have a object named Bike and this object has a method named start(). When you create an instance of a Bike object and call its start() method you are not worried about what happens to accomplish this, you just want to make sure the state of the bike is changed to 'running' afterwards. This kind of behavior hiding is encapsulation and it makes programming much easier.
  • 25. How can you prevent your class to be inherated further?
  • Ans : By setting Sealed - Key word
  • public sealed class Planet
                 //code goes here
  • class Moon:Planet
         //Not allowed as base class is sealed




1.                                                      What is GUID and why we need to use it and in what condition?

  • How this is created.
  • Ans : A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever  a unique identifier is required. Such an identifier has a very low probability of being duplicated. Visual Studio .NET IDE has a utility under the tools menu to generate GUIDs.
  • 27. Why do you need to serialize.?
  • We need to serialize the object,if you want to pass object from one  computer/application domain to another.Process of converting complex objects into stream of bytes that can be persisted or  transported.Namespace for serialization is System.Runtime.Serialization.The  ISerializable interface allows you to make any class Serializable..NET framework features 2 serializing method.
    1.Binary Serialization 2.XML Serialization
  • 28. What is inline schema, how does it works?
    Ans : Schemas can be included inside of XML file is called Inline Schemas.This is useful  when it is inconvenient to physically seprate the schema and the XML document.A  schema is an XML document that defines the structure, constraints, data types, and  relationships of the elements that constitute the data contained inside the XML  document or in another XML document.Schema can be an external file which uses the  XSD or XDR extension called external schema. Inline schema can take place even when validation is turned off.
  • 29. Describe the advantages of writing a managed code application instead of unmanaged one. What's involved in certain piece of code being managed?
  • "Advantage includes automatic garbage collection,memory management,security,type checking,versioning
  • Managed code is compiled for the .NET run-time environment. It runs in the Common Language Runtime (CLR), which is the heart of the .NET Framework. The CLR provides services such as security,
    memory management, and cross-language integration. Managed applications written to take advantage of the features of the CLR perform more efficiently and safely, and take better advantage of developers existing expertise in languages that support the .NET Framework.
  • Unmanaged code includes all code written before the .NET Framework was introduced—this includes code written to use COM, native Win32, and Visual Basic 6. Because it does not run inside the .NET environment, unmanaged code cannot make use of any .NET managed facilities."
  • 30. What are multicast delegates ? give me an example ?
    Ans : Delegate that can have more than one element in its invocation List.
  • using System;
    namespace SampleMultiCastDelegate
      class MultiCast
        public delegate string strMultiCast(string s);

  • MainClass defines the static methods having same signature as delegate.
    using System;
  • namespace SampleMultiCastDelegate
      public class MainClass
        public MainClass()
  • public static string Jump(string s)
          return String.Empty;
  • public static string Run(string s)
          return String.Empty;
  • public static string Walk(string s)
          return String.Empty;      

  • The Main class:
  • using System;
    using System.Threading;
    namespace SampleMultiCastDelegate
      public class MainMultiCastDelegate
        public static void Main()
          MultiCast.strMultiCast  Run,Walk,Jump;
  • MultiCast.strMultiCast    myDelegate;
  • ///here mydelegate used the Combine method of System.MulticastDelegate
          ///and the delegates combine 
  • 31. Can a nested object be used in Serialization ?
  • Ans : Yes. If a class that is to be serialized contains references to objects of other classes, and if those classes have been marked as serializable, then their objects are serialized too.
  • 32. Difference between int and int32 ?
  • Ans : Both are same. System.Int32 is a .NET class. Int is an alias name for System.Int32.
  • 33. Describe the difference between a Thread and a Process?
  • Ans : A Process is an instance of an running application. And a thread is the Execution stream of the Process. A process can have multiple Thread.
    When a process starts a specific memory area is allocated to it. When there is multiple thread in a process, each thread gets a memory for storing the variables in it and plus they can access to the global variables which is common for all the thread. Eg.A Microsoft Word is a Application. When you open a word file,an instance of the Word starts and a process is allocated to this instance which has one thread.
  • 34. What is the difference between an EXE and a DLL?
    Ans : You can create an objects of Dll but not of the EXE.
    Dll is an In-Process Component whereas EXE is an OUt-Process Component.Exe is for single use whereas you can use Dll for multiple use.
    Exe can be started as standalone where dll cannot be.
  • 35. What is strong-typing versus weak-typing? Which is preferred? Why? Ans : Strong typing implies that the types of variables involved in operations are associated to the variable, checked at compile-time, and require explicit conversion; weak typing implies that they are associated to the value, checked at run-time, and are implicitly converted as required. (Which is preferred is a disputable point, but I personally prefer strong typing because I like my errors to be found as soon as possible.)
  • 36. What is a PID? How is it useful when troubleshooting a system?
    PID is the process Id of the application in Windows. Whenever a process starts running in the Windows environment, it is associated with an individual process Id or PID.
  • 37. The PID (Process ID) a unique number for each item on the Process Tab, Image Name list. How do you get the PID to appear? Ans : In Task Manger, select the View menu, then select columns and check PID (Process Identifier).
  • In Linux, PID is used to debug a process explicitly. However we cannot do this in a windows environment.
  • Microsoft has launched a SDK called as Microsoft Operations Management (MOM). This uses the PID to find out which dll’s have been loaded by a process in the memory. This is essentially helpful in situations where the Process which has a memory leak is to be traced to a erring dll. Personally I have never used a PID, our Windows debugger does the things required to find out.
  • 38. What is the GAC? What problem does it solve?
    Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies that are to be shared by several applications on the computer. This area is typically the folder under windows or winnt in the machine.
  • All the assemblies that need to be shared across applications need to be done through the Global assembly Cache only. However it is not necessary to install assemblies into the global assembly cache to make them accessible to COM interop or unmanaged code.
  • There are several ways to deploy an assembly into the global assembly cache:
    · Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache.
    · Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.
    · Use Windows Explorer to drag assemblies into the cache.
  • GAC solves the problem of DLL Hell and DLL versioning. Unlike earlier situations, GAC can hold two assemblies of the same name but different version. This ensures that the applications which access a particular assembly continue to access the same assembly even if another version of that assembly is installed on that machine.
  • 39. Describe what an Interface is and how it’s different from a Class.
    An interface is a structure of code which is similar to a class. An interface is a prototype for a class and is useful from a logical design perspective. Interfaces provide a means to define the protocols for a class without worrying about the implementation details. The syntax for creating interfaces follows:
    interface Identifier {
  • Identifier is the name of the interface and InterfaceBody refers to the abstract methods and static final variables that make up the interface. Because it is assumed that all the methods in an interface are abstract, it isn't necessary to use the abstract keyword
  • An interface is a description of some of the members available from a class. In practice, the syntax typically looks similar to a class definition, except that there's no code defined for the methods — just their name, the arguments passed and the type of the value returned.
    So what good is it? None by itself. But you create an interface so that classes will implement it.
  • But what does it mean to implement an interface. The interface acts as a contract or promise. If a class implements an interface, then it must have the properties and methods of the interface defined in the class. This is enforced by the compiler.
  • Broadly the differentiators between classes and interfaces is as follows
    • Interface should not have any implementation.
    • Interface can not create any instance.
    • Interface should provide high level abstraction from the implementation.
    • Interface can have multiple inheritances.
    • Default access level of the interface is public.



  • 40. What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
  • ASP.NET Web services and .NET Remoting provide a full suite of design options for cross-process and cross-plaform communication in distributed applications. In general, ASP.NET Web services provide the highest levels of interoperability with full support for WSDL and SOAP over HTTP, while .NET Remoting is designed for common language runtime type-system fidelity and supports additional data format and communication channels. Hence if we looking cross-platform communication than web services is the choice coz for .NET remoting .Net framework is requried which may or may not present for the other platform. Serialization and Metadata
    ASP.NET Web services rely on the System.Xml.Serialization.XmlSerializer class to marshal data to and from SOAP messages at runtime. For metadata, they generate WSDL and XSD definitions that describe what their messages contain. The reliance on pure WSDL and XSD makes ASP.NET Web services metadata portable; it expresses data structures in a way that other Web service toolkits on different platforms and with different programming models can understand. In some cases, this imposes constraints on the types you can expose from a Web service—XmlSerializer will only marshal things that can be expressed in XSD. Specifically, XmlSerializer will not marshal object graphs and it has limited support for container types.
  • .NET Remoting relies on the pluggable implementations of the IFormatter interface used by the System.Runtime.Serialization engine to marshal data to and from messages. There are two standard formatters, System.Runtime.Serialization.Formatters.Binary.BinaryFormatter and System.Runtime.Serialization.Formatters.Soap.SoapFormatter. The BinaryFormatter and SoapFormatter, as the names suggest, marshal types in binary and SOAP format respectively. For metadata, .NET Remoting relies on the common language runtime assemblies, which contain all the relevant information about the data types they implement, and expose it via reflection. The reliance on the assemblies for metadata makes it easy to preserve the full runtime type-system fidelity. As a result, when the .NET Remoting plumbing marshals data, it includes all of a class's public and private members; handles object graphs correctly; and supports all container types (e.g., System.Collections.Hashtable). However, the reliance on runtime metadata also limits the reach of a .NET Remoting system—a client has to understand .NET constructs in order to communicate with a .NET Remoting endpoint. In addition to pluggable formatters, the .NET Remoting layer supports pluggable channels, which abstract away the details of how messages are sent. There are two standard channels, one for raw TCP and one for HTTP. Messages can be sent over either channel independent of format.
  • Distributed Application Design: ASP.NET Web Services vs. .NET Remoting
    ASP.NET Web services favor the XML Schema type system, and provide a simple programming model with broad cross-platform reach. .NET Remoting favors the runtime type system, and provides a more complex programming model with much more limited reach. This essential difference is the primary factor in determining which technology to use. However, there are a wide range of other design factors, including transport protocols, host processes, security, performance, state management, and support for transactions to consider as well.
  • Security
    Since ASP.NET Web services rely on HTTP, they integrate with the standard Internet security infrastructure. ASP.NET leverages the security features available with IIS to provide strong support for standard HTTP authentication schemes including Basic, Digest, digital certificates, and even Microsoft® .NET Passport. (You can also use Windows Integrated authentication, but only for clients in a trusted domain.) One advantage of using the available HTTP authentication schemes is that no code change is required in a Web service; IIS performs authentication before the ASP.NET Web services are called. ASP.NET also provides support for .NET Passport-based authentication and other custom authentication schemes. ASP.NET supports access control based on target URLs, and by integrating with the .NET code access security (CAS) infrastructure. SSL can be used to ensure private communication over the wire.
  • Although these standard transport-level techniques to secure Web services are quite effective, they only go so far. In complex scenarios involving multiple Web services in different trust domains, you have to build custom ad hoc solutions. Microsoft and others are working on a set of security specifications that build on the extensibility of SOAP messages to offer message-level security capabilities. One of these is the XML Web Services Security Language (WS-Security), which defines a framework for message-level credential transfer, message integrity, and message confidentiality.
  • As noted in the previous section, the .NET Remoting plumbing does not secure cross-process invocations in the general case. A .NET Remoting endpoint hosted in IIS with ASP.NET can leverage all the same security features available to ASP.NET Web services, including support for secure communication over the wire using SSL. If you are using the TCP channel or the HTTP channel hosted in processes other than aspnet_wp.exe, you have to implement authentication, authorization and privacy mechanisms yourself.
  • One additional security concern is the ability to execute code from a semi-trusted environment without having to change the default security policy. ASP.NET Web Services client proxies work in these environments, but .NET Remoting proxies do not. In order to use a .NET Remoting proxy from a semi-trusted environment, you need a special serialization permission that is not given to code loaded from your intranet or the Internet by default. If you want to use a .NET Remoting client from within a semi-trusted environment, you have to alter the default security policy for code loaded from those zones. In situations where you are connecting to systems from clients running in a sandbox—like a downloaded Windows Forms application, for instance—ASP.NET Web Services are a simpler choice because security policy changes are not required.
  • Conceptually, what is the difference between early-binding and late-binding?
    Early binding – Binding at Compile Time
    Late Binding – Binding at Run Time
  • Early binding implies that the class of the called object is known at compile-time; late-binding implies that the class is not known until run-time, such as a call through an interface or via Reflection.
  • Early binding is the preferred method. It is the best performer because your application binds directly to the address of the function being called and there is no extra overhead in doing a run-time lookup. In terms of overall execution speed, it is at least twice as fast as late binding.
  • Early binding also provides type safety. When you have a reference set to the component's type library, Visual Basic provides IntelliSense support to help you code each function correctly. Visual Basic also warns you if the data type of a parameter or return value is incorrect, saving a lot of time when writing and debugging code.
  • Late binding is still useful in situations where the exact interface of an object is not known at design-time. If your application seeks to talk with multiple unknown servers or needs to invoke functions by name (using the Visual Basic 6.0 CallByName function for example) then you need to use late binding. Late binding is also useful to work around compatibility problems between multiple versions of a component that has improperly modified or adapted its interface between versions.
  • 41. What is an Asssembly Qualified Name? Is it a filename? How is it different?
  • An assembly qualified name isn't the filename of the assembly; it's the internal name of the assembly combined with the assembly version, culture, and public key, thus making it unique.
  • e.g. (""System.Xml.XmlDocument, System.Xml, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"")
  • 42. How is a strongly-named assembly different from one that isn’t strongly-named?
  • Strong names are used to enable the stricter naming requirements associated with shared assemblies. These strong names are created by a .NET utility – sn.exe
  • Strong names have three goals:
    · Name uniqueness. Shared assemblies must have names that are globally unique.
    · Prevent name spoofing. Developers don't want someone else releasing a subsequent version of one of your assemblies and falsely claim it came from you, either by accident or intentionally.
    · Provide identity on reference. When resolving a reference to an assembly, strong names are used to guarantee the assembly that is loaded came from the expected publisher.
  • Strong names are implemented using standard public key cryptography. In general, the process works as follows: The author of an assembly generates a key pair (or uses an existing one), signs the file containing the manifest with the private key, and makes the public key available to callers. When references are made to the assembly, the caller records the public key corresponding to the private key used to generate the strong name.
  • Weak named assemblies are not suitable to be added in GAC and shared. It is essential for an assembly to be strong named.
  • Strong naming prevents tampering and enables assemblies to be placed in the GAC alongside other assemblies of the same name.
  • 43. How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?
    The hugely simplistic version is that every time it garbage-collects, it starts by assuming everything to be garbage, then goes through and builds a list of everything reachable. Those become not-garbage, everything else doesn't, and gets thrown away. What makes it generational is that every time an object goes through this process and survives, it is noted as being a member of an older generation (up to 2, right now). When the garbage-collector is trying to free memory, it starts with the lowest generation (0) and only works up to higher ones if it can't free up enough space, on the grounds that shorter-lived objects are more likely to have been freed than longer-lived ones.
  • Non-deterministic finalization implies that the destructor (if any) of an object will not necessarily be run (nor its memory cleaned up, but that's a relatively minor issue) immediately upon its going out of scope. Instead, it will wait until first the garbage collector gets around to finding it, and then the finalisation queue empties down to it; and if the process ends before this happens, it may not be finalised at all. (Although the operating system will usually clean up any process-external resources left open - note the usually there, especially as the exceptions tend to hurt a lot.)
  • 44. What is the difference between Finalize() and Dispose()?
    Dispose() is called by the user of an object to indicate that he is finished with it, enabling that object to release any unmanaged resources it holds. Finalize() is called by the run-time to allow an object which has not had Dispose() called on it to do the same. However, Dispose() operates determinalistically, whereas there is no guarantee that Finalize() will be called immediately when an object goes out of scope - or indeed at all, if the program ends before that object is GCed - and as such Dispose() is generally preferred.
  • 45. How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?
    The using() pattern is useful because it ensures that Dispose() will always be called when a disposable object (defined as one that implements IDisposable, and thus the Dispose() method) goes out of scope, even if it does so by an exception being thrown, and thus that resources are always released.
  • 46. What does this useful command line do? tasklist /m "mscor*"
    Lists all the applications and associated tasks/process currently  running on the system with a module whose name begins "mscor" loaded into them; which in nearly all cases means "all the .NET processes".
  • 47. What’s wrong with a line like this? DateTime.Parse(myString);
    Therez nothing wrong with this declaration.Converts the specified string representation of a date and time to its DateTime equivalent.But If the string is not a valid DateTime,It throws an exception.
  • 48. What are PDBs? Where must they be located for debugging to work?
    A program database (PDB) files holds debugging and project state information that allows incremental linking of debug configuration of your program.There are several different types of symbolic debugging information. The default type for Microsoft compiler is the so-called PDB file. The compiler setting for creating this file is /Zi, or /ZI for C/C++(which creates a PDB file with additional information that enables a feature called ""Edit and Continue"") or a Visual Basic/C#/JScript .NET program with /debug.
  • A PDB file is a separate file, placed by default in the Debug project subdirectory, that has the same name as the executable file with the extension .pdb. Note that the Visual C++ compiler by default creates an additional PDB file called VC60.pdb for VisulaC++6.0 and VC70.PDB file for VisulaC++7.0. The compiler creates this file during compilation of the source code, when the compiler isn't aware of the final name of the executable. The linker can merge this temporary PDB file into the main one if you tell it to, but it won't do it by default. The PDB file can be useful to display the detailed stack trace with source files and line numbers.
  • 49. What is FullTrust? Do GAC’ed assemblies have FullTrust?
    Before the .NET Framework existed, Windows had two levels of trust for downloaded code. This old model was a binary trust model. You only had two choices: Full Trust, and No Trust. The code could either do anything you could do, or it wouldn't run at all.
    The permission sets in .NET include FullTrust, SkipVerification, Execution, Nothing, LocalIntranet, Internet and Everything. Full Trust Grants unrestricted permissions to system resources. Fully trusted code run by a normal, nonprivileged user cannot do administrative tasks, but can access any resources the user can access, and do anything the user can do. From a security standpoint, you can think of fully trusted code as being similar to native, unmanaged code, like a traditional ActiveX control.
    GAC assemblies are granted FullTrust. In v1.0 and 1.1, the fact that assemblies in the GAC seem to always get a FullTrust grant is actually a side effect of the fact that the GAC lives on the local machine.  If anyone were to lock down the security policy by changing the grant set of the local machine to something less than FullTrust, and if your assembly did not get extra permission from some other code group, it would no longer have FullTrust even though it lives in the GAC.

  • 50. What does this do? gacutil /l | find /i "Corillian"
    The Global Assembly Cache tool allows you to view and manipulate the contents of the global assembly cache and download cache.The tool comes with various optional params to do that.
    ""/l"" option Lists the contents of the global assembly cache. If you specify the assemblyName parameter(/l [assemblyName]), the tool lists only the assemblies matching that name.
  • 51. What does this do .. sn -t foo.dll ?
  • Sn -t option displays the token for the public key stored in infile. The contents of infile must be previously generated using -p.
    Sn.exe computes the token using a hash function from the public key. To save space, the common language runtime stores public key tokens in the manifest as part of a reference to another assembly when it records a dependency to an assembly that has a strong name. The -tp option displays the public key in addition to the token.
  • 52. How do you generate a strong name?
  • .NET provides an utility called strong name tool. You can run this toolfrom the VS.NET command prompt to generate a strong name with an option "-k" and providing the strong key file name. i.e. sn- -k < file-name >
  • What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
    The Debug build is the program compiled with full symbolic debug information and no optimization. The Release build is the program compiled employing  optimization and contains no symbolic debug information. These settings can be changed as per need from Project Configuration properties. The release runs faster since it does not have any debug symbols and is optimized.
  • 53. Explain the use of virtual, sealed, override, and abstract.
    Abstract: The keyword can be applied for a class or method.
    1. Class: If we use abstract keyword for a class it makes the
    class an abstract class, which means it cant be instantiated. Though
    it is not nessacary to make all the method within the  abstract class to be virtual. ie, Abstract class can have concrete methods
    2. Method: If we make a method as abstract, we dont need to provide implementation of the method in the class but the derived class need to implement/override this method.
  • Sealed: It can be applied on a class and methods. It stops the type from further derivation i.e no one can derive class
    from a sealed class,ie A sealed class cannot be inherited.A sealed class cannot be a abstract class.A compile time error is thrown if you try to specify sealed class as a  base class.
    When an instance method declaration includes a sealed modifier, that method is said to be a sealed method. If an instance method declaration includes the sealed modifier, it must also include the override modifier. Use of the sealed modifier prevents a derived class from further overriding the method  For Egs: sealed override public void Sample() { Console.WriteLine("Sealed Method"); }

  • Virtual & Override: Virtual & Override keywords provides runtime polymorphism. A base class can make some of its methods
    as virtual which allows the derived class a chance to override the base class implementation by using override keyword.
    For e.g. class Shape
      int a
      public virtual void Display()
     class Rectangle:Shape
      public override void Display()
    54. Explain the importance and use of each, Version, Culture and PublicKeyToken for an assembly.
    This three alongwith name of the assembly provide a strong name or fully qualified name to the assembly. When a assebly is referenced with all three.
  • PublicKeyToken: Each assembly can have a public key embedded in its manifest that identifies the developer. This ensures that once the assembly ships, no one can modify the code or other resources contained in the assembly.
  • Culture: Specifies which culture the assembly supports
    Version: The version number of the assembly.It is of the following form
  • Explain the differences between public, protected, private and internal.
    These all are access modifier and they governs the access level. They can be applied to class, methods, fields.
  • Public: Allows class, methods, fields to be accessible from anywhere i.e. within and outside an assembly.
  • Private: When applied to field and method allows to be accessible within a class.
  • Protected: Similar to private but can be accessed by members of derived class also.
  • Internal: They are public within the assembly i.e. they can be accessed by anyone within an assembly but outside assembly they are not visible.
  • 55. What is the difference between typeof(foo) and myFoo.GetType()?
    Typeof is operator which applied to a object returns System.Type object. Typeof cannot be overloaded white GetType has lot of overloads.GetType is a method which also returns System.Type of an object. GetType is used to get the runtime type of the object.
  • Example from MSDN showing Gettype used to retrive type at untime:-
  • public class MyBaseClass: Object {
  • public class MyDerivedClass: MyBaseClass {
  • public class Test {
  • public static void Main() {
          MyBaseClass myBase = new MyBaseClass();
          MyDerivedClass myDerived = new MyDerivedClass();
          object o = myDerived;
          MyBaseClass b = myDerived;
  • Console.WriteLine("mybase: Type is {0}", myBase.GetType());
          Console.WriteLine("myDerived: Type is {0}", myDerived.GetType());
          Console.WriteLine("object o = myDerived: Type is {0}", o.GetType());
          Console.WriteLine("MyBaseClass b = myDerived: Type is {0}", b.GetType());

  • /*
  • This code produces the following output.
  • mybase: Type is MyBaseClass
    myDerived: Type is MyDerivedClass
    object o = myDerived: Type is MyDerivedClass
    MyBaseClass b = myDerived: Type is MyDerivedClass
  • */
  • 56. Can "this" be used within a static method?
    No 'This' cannot be used in a static method. As only static variables/methods can be used in a static method.
  • 57. What is the purpose of XML Namespaces? An XML Namespace is a collection of element types and attribute names. It consists of 2 parts
    1) The first part is the URI used to identify the namespace
    2) The second part is the element type or attribute name itself.
    Together they form a unique name. The various purpose of XML Namespace are

1.                                                      Combine fragments from different documents without any naming conflicts. (See example below.)
2. Write reusable code modules that can be invoked for specific elements and attributes. Universally unique names guarantee that
such modules are invoked only for the correct elements and attributes.
3. Define elements and attributes that can be reused in other schemas or instance documents without fear of name collisions. For
example, you might use XHTML elements in a parts catalog to provide part descriptions. Or you might use the nil attribute
defined in XML Schemas to indicate a missing value.

  • < Department >
         < Name >DVS1< /Name >
         < addr:Address xmlns:addr="" >
            < addr:Street >Wilhelminenstr. 7< /addr:Street >
            < addr:City >Darmstadt< /addr:City >
            < addr:State >Hessen< /addr:State >
            < addr:Country >Germany< /addr:Country >
            < addr:PostalCode >D-64285< /addr:PostalCode >
         < /addr:Address >
         < serv:Server xmlns:serv="" >
            < serv:Name >OurWebServer< /serv:Name >
            < serv:Address >< /serv:Address >
         < /serv:Server >
      < /Department >
  • 58. What is difference between MetaData and Manifest ?
    Metadata and Manifest forms an integral part of an assembly( dll / exe ) in .net framework . Out of which Metadata is a mandatory component , which as the name suggests gives the details about various components of IL code viz : Methods , properties , fields , class etc.
  • Essentially Metadata maintains details in form of tables like Methods Metadata tables , Properties Metadata tables , which maintains the list of given type and other details like access specifier , return type etc.
  • Now Manifest is a part of metadata only , fully called as “manifest metadata tables” , it contains the details of the references needed by the assembly of any other external assembly / type , it could be a custom assembly or standard System namespace .
  • Now for an assembly that can independently exists and used in the .Net world both the things ( Metadata with Manifest ) are mandatory , so that it can be fully described assembly and can be ported anywhere without any system dependency . Essentially .Net framework can read all assembly related information from assembly itself at runtime .
  • But for .Net modules , that can’t be used independently , until they are being packaged as a part of an assembly , they don’t contain Manifest but their complete structure is defined by their respective metadata .
  • Ultimately . .Net modules use Manifest Metadata tables of parent assembly which contain them .

  • 59. What is the use of Internal keyword? Internal keyword is one of the access specifier available in .Net framework , that makes a type visible in a  given assembly , for e.g : a single dll can contain multiple modules , essentially a multi file assembly , but it forms a single binary component , so any type with internal keyword will be visible throughout the assembly and can be used in any of the modules .

  • 60. What actually happes when you add a something to arraylistcollection ? Following things will happen :
  • Arraylist is a dynamic array class in c# in System.Collections namespace derived from interfaces – ICollection , IList , ICloneable , IConvertible  . It terms of in memory structure following is the implementation .

a.                                                                              Check up the total space if there’s any free space on the declared list .
b. If yes add the new item and increase count by 1 .
c. If No Copy the whole thing to a temporary Array of Last Max. Size .
d. Create new Array with size ( Last Array Size + Increase Value )
e. Copy back values from temp and reference this new array as original array .
f. Must doing Method updates too , need to check it up .

  • 61. What is Boxing and unboxing? Does it occure automaatically or u need to write code to box and unbox? Boxing – Process of converting a System.ValueType to Reference Type , Mostly base class System.Object type and allocating it memory on Heap .Reverse is unboxing , but can only be done with prior boxed variables.
  • Boxing is always implicit but Unboxing needs to be explicitly done via casting , thus ensuring the value type contained inside .
  • 62. How Boxing and unboxing occures in memory? Boxing converts value type to reference type , thus allocating memory on Heap . Unboxing converts already boxed reference types to value types through explicit casting , thus  allocating memory on stack .

  • 63. Why only boxed types can be unboxed? Unboxing is the process of converting a Reference type variable to Value type and thus allocating memory on the stack . It happens only to those Reference type variables that have been earlier created by Boxing of a Value Type , therefore internally they contain a value type , which can be obtained through explicit casting . For any other Reference type , they don’t internally contain a Value type to Unboxed via explicit casting . This is why only boxed types can be unboxed .
  • 64. What is side-by-side execution? Can two application one using private assembly and other using Shared assembly be stated as a side-by-side executables? Side-by-side execution is the ability to run multiple versions of an application or component on the same computer. You can have multiple versions of the common language runtime, and multiple versions of applications and components that use a version of the runtime, on the same computer at the same time. Since versioning is only applied to shared assemblies, and not to private assemblies, two application one using private assembly and one using shared assembly cannot be stated as side-by-side
  • executables.


  • 65. Why string are called Immutable data Type ? The memory representation of string is an Array of Characters, So on re-assigning the new array of Char is formed & the start address is changed . Thus keeping the Old string in Memory for Garbage Collector to be disposed.


  • 66. What does assert() method 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.


  • 67. 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.


  • 68. Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose.  For applications that are constantly running you run the risk of overloading the machine and the hard drive.  Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.


  • 69. Where is the output of TextWriterTraceListener redirected?
    To the Console or a text file depending on the parameter passed to the constructor.


  • 70. How do assemblies find each other? By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache.


  • 71. How does assembly versioning work? Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly.The version number has four numeric parts (e.g. Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline - it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file.


  • 72. What is garbage collection? Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time.


  • 73. Why doesn't the .NET runtime offer deterministic destruction?
    Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next sweep of the heap.
    Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep.


  • 74. Is the lack of deterministic destruction in .NET a problem?
    It's certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects - in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management mechanism is needed to handle distributed objects - unfortunately the runtime offers no help with this.


  • 75. What is serialization? Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization / Deserialization is mostly used to transport objects (e.g. during remoting), or to persist
  • objects (e.g. to a file or database).
  • 76. Does the .NET Framework have in-built support for serialization? There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.


  • 77. Can I customise the serialization process? Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement]
  • attribute, which can be used to specify the XML element name to be used for a particular property or field.
    Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer's [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized.


  • 78. Why is XmlSerializer so slow? There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize or deserialize an object of a given type in an application, there is a significant delay. This normally doesn't matter, but it may mean, for example, that XmlSerializer is a poor choice for loading configuration settings during startup of a GUI application.


  • 79. Why do I get errors when I try to serialize a Hashtable? XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.


  • 80. What are attributes? There are at least two types of .NET attribute. The first type I will refer to as a metadata attribute - it allows some data to be attached to a class or method. This data becomes part of the metadata for the class, and (like other class metadata) can be accessed via reflection. The other type of attribute is a context attribute. Context attributes use a similar syntax to metadata attributes but they are fundamentally different. Context attributes provide an interception mechanism whereby instance activation and method calls can be
  • pre- and/or post-processed.


  • 81. How does CAS work? The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set.
    For example, using the default security policy, a control downloaded from a web site belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.)


  • 82. Who defines the CAS code groups? Microsoft defines some default ones, but you can modify these and even create your own. To see the code groups defined on your system, run 'caspol -lg' from the command-line. On my system it looks like this:
    Level = Machine
  • Code Groups:
  • 1.  All code: Nothing
       1.1.  Zone - MyComputer: FullTrust
       1.1.1.  Honor SkipVerification requests: SkipVerification
       1.2.  Zone - Intranet: LocalIntranet
       1.3.  Zone - Internet: Internet
       1.4.  Zone - Untrusted: Nothing
       1.5.  Zone - Trusted: Internet
       1.6.  StrongName - 0024000004800000940000000602000000240000525341310004000003
  • Note the hierarchy of code groups - the top of the hierarchy is the most general ('All code'), which is then sub-divided into several
  • groups, each of which in turn can be sub-divided. Also note that (somewhat counter-intuitively) a sub-group can be associated with a more permissive permission set than its parent.


  • 83. How do I define my own code group? Use caspol. For example, suppose you trust code from and you want it have full access to your system, but you want to keep the default restrictions for all other internet sites. To achieve this, you would add a new code group as a sub-group of the 
  • 'Zone - Internet' group, like this:
    caspol -ag 1.3 -site FullTrust
    Now if you run caspol -lg you will see that the new group has been added as group 1.3.1:



  • Note that the numeric label (1.3.1) is just a caspol invention to make the code groups easy to manipulate from the command-line. The underlying runtime never sees it.


  • 84. How do I change the permission set for a code group? Use caspol. If you are the machine administrator, you can operate at the 'machine' level - which means not only that the changes you make become the default for the machine, but also that users cannot change the permissions to be more permissive. If you are a normal (non-admin) user you can still modify the permissions, but only to make them more restrictive. For example, to allow intranet code to do what it likes you might do this: caspol -cg 1.2 FullTrust
    Note that because this is more permissive than the default policy (on a standard system), you should only do this at the machine level - doing it at the user level will have no effect.


  • 85. I can't be bothered with all this CAS stuff. Can I turn it off?
    Yes, as long as you are an administrator. Just run: caspol -s off


  • 86. Can I look at the IL for an assembly? Yes. MS supply a tool called Ildasm which can be used to view the metadata and IL for an assembly.


  • 87. Can source code be reverse-engineered from IL? Yes, it is often relatively straightforward to regenerate high-level source (e.g. C#) from IL.


  • 88. How can I stop my code being reverse-engineered from IL?
    There is currently no simple way to stop code being reverse-engineered from IL. In future it is likely that IL obfuscation tools will become available, either from MS or from third parties. These tools work by 'optimising' the IL in such a way that reverse-engineering becomes much more difficult. Of course if you are writing web services then reverse-engineering is not a problem as clients do not have access to your IL.


  • 89. Is there built-in support for tracing/logging? Yes, in the System.Diagnostics namespace. 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.


  • 90. Can I redirect tracing to a file? Yes. The Debug and Trace classes both have a Listeners property, which is a collection of sinks that receive the tracing that you send via Debug.WriteLine and Trace.WriteLine respectively. By default the Listeners collection contains a single sink, which is an instance of the DefaultTraceListener class. This sends output to the Win32 OutputDebugString() function and also the System.Diagnostics.Debugger.Log() method. This is useful when debugging, but if you're trying to trace a problem at a customer site, redirecting the output to a file is more appropriate. Fortunately, the TextWriterTraceListener class is provided for this purpose.


  • 91. What are the contents of assembly? In general, a static assembly can consist of four elements:
     The assembly manifest, which contains assembly metadata.
     Type metadata.
     Microsoft intermediate language (MSIL) code that implements the types.
     A set of resources.


  • 92. What is GC (Garbage Collection) and how it works One of the good features of the CLR is Garbage Collection, which runs in the background collecting unused object references, freeing us from having to ensure we always destroy them. In reality the time difference between you releasing the object instance and it being garbage collected is likely to be very small, since the GC is always running.
  • [The process of transitively tracing through all pointers to actively used objects in order to locate all objects that can be referenced, and then arranging to reuse any heap memory that was not found during this trace. The common language runtime garbage collector also compacts the memory that is in use to reduce the working space needed for the heap.]


  • Heap:
  • A portion of memory reserved for a program to use for the temporary storage of data structures whose existence or size cannot be determined until the program is running.


  • 93. Differnce between Managed code and unmanaged code ? Managed Code: Code that runs under a "contract of cooperation" with the common language runtime. Managed code must supply the metadata necessary for the runtime to provide services such as memory management, cross-language integration, code access security, and automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.


  • Un-Managed Code:
  • Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging, and so on).


  • 94. What is MSIL, IL, CTS and, CLR ?
  • MSIL: (Microsoft intermediate language) When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be executed, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and executed on any supported architecture. When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of
  • each type, the signatures of each type's members, the members that our code references, and other data that the runtime uses at execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and Common Object File Format (COFF) used historically for executable content. This file format, which accommodates


  • MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during execution.

  • IL: (Intermediate Language)A language used as the output of a number of compilers and as the input to a just-in-time (JIT) compiler. The common language runtime includes a JIT compiler for converting MSIL to native code.


  • CTS: (Common Type System) The specification that determines how the common language runtime defines, uses, and manages types


  • CLR: (Common Language Runtime) The engine at the core of managed code execution. The runtime supplies managed code with services such as cross-language integration, code access security, object lifetime management, and debugging and profiling support.


  • 95. What is Reference type and value type ?
    Reference Type: Reference types are allocated on the managed CLR heap, just like object types. A data type that is stored as a reference to the value's location. The value of a reference type is the location of the sequence of bits that represent the type's data. Reference types can be self-describing types, pointer types, or interface types


  • Value Type: Value types are allocated on the stack just like primitive types in VBScript, VB6 and C/C++. Value types are not instantiated using new go out of scope when the function they are defined within returns.
    Value types in the CLR are defined as types that derive from system.valueType.


  • A data type that fully describes a value by specifying the sequence of bits that constitutes the value's representation. Type information for a value type instance is not stored with the instance at run time, but it is available in metadata. Value type instances can be treated as objects using boxing.


  • 96. What is Boxing and unboxing ? Boxing: The conversion of a value type instance to an object, which implies that the instance will carry full type information at run time and will be allocated in the heap. The Microsoft intermediate language (MSIL) instruction set's box instruction converts a value type to an object by making a copy of the value type and embedding it in a newly allocated object.
  • Un-Boxing:
    The conversion of an object instance to a value type.


  • 97. What is JIT and how is works ? An acronym for "just-in-time," a phrase that describes an action that is taken only when it becomes necessary, such as just-in-time compilation or just-in-time object activation


  • 98. What is portable executable (PE) ? The file format used for executable programs and for files to be linked together to form executable programs


  • 99. What is strong name? A name that consists of an assembly's identity—its simple text name, version number, and culture information (if provided)—strengthened by a public key and a digital signature generated over the assembly. Because the assembly manifest contains file hashes for all the files that constitute the assembly implementation, it is sufficient to generate the digital signature over just the one file in the assembly that contains the assembly manifest. Assemblies with the same strong name are expected to be identical


  • 100. What is global assembly cache? A machine-wide code cache that stores assemblies specifically installed to be shared by many applications on the computer. Applications deployed in the global assembly cache must have a strong name.
  • 101. What is difference between constants, readonly and, static ?
    Constants: The value can’t be changed
  • Read-only: The value will be initialized only once from the constructor of the class.
  • Static: Value can be initialized once.


  • 102. What is difference between shared and public? An assembly that can be referenced by more than one application. An assembly must be explicitly built to be shared by giving it a cryptographically strong name.


  • 103. What is namespace used for loading assemblies at run time and name the methods? System.Reflection


  • 104. What are the types of authentication in .net? We have three types of  authentication:

1.                                                      Form authentication

2.                                                      Windows authentication

3.                                                      Passport This has to be declared in web.config file.


  • 105. What is the difference between a Struct and a Class ? The struct type is suitable for representing lightweight objects such as Point, Rectangle, and Color. Although it is possible to represent a point as a class, a struct is more efficient in some scenarios. For example, if you declare an array of 1000 Point objects, you will allocate additional memory for referencing each object. In this case, the struct is less expensive. When you create a struct object using the new operator, it gets created and the appropriate constructor is called. Unlike classes, structs can be instantiated without using the new operator. If you do not use new, the fields will remain unassigned and the object cannot be used until all of the fields are initialized. It is an error to declare a default (parameterless) constructor for a struct. A default constructor is always provided to initialize the struct members to their default values.
    It is an error to initialize an instance field in a struct.
    There is no inheritance for structs as there is for classes. A struct cannot inherit from another struct or class, and it cannot be the base of a class. Structs, however, inherit from the base class Object. A struct can implement interfaces, and it does that exactly as classes do.
    A struct is a value type, while a class is a reference type.


  • 106. How big is the datatype int in .NET?
    32 bits.


  • 107. How big is the char?
    16 bits (Unicode).


  • 108. How do you initiate a string without escaping each backslash? Put an @ sign in front of the double-quoted string.


  • 109. What's the access level of the visibility type internal?
  • Current application.


  • 110. Explain encapsulation ? The implementation is hidden, the interface is exposed.


  • 111. What data type should you use if you want an 8-bit value that's signed?


  • 112. Speaking of Boolean data types, what's different between C# and C/C++? There's no conversion between 0 and false, as well as any other number and true, like in C/C++.


  • 113. Where are the value-type variables allocated in the computer RAM?
  • Stack.


  • 114. Where do the reference-type variables go in the RAM?
    The references go on the stack, while the objects themselves go on the heap.


  • 115. What is the difference between the value-type variables and reference-type variables in terms of garbage collection?
    The value-type variables are not garbage-collected, they just fall off the stack when they fall out of scope, the reference-type objects
  • are picked up by GC when their references go null.


  • 116. How do you convert a string into an integer in .NET?


  • 117. How do you box a primitive data type variable?
    Assign it to the object, pass an object.


  • 118. Why do you need to box a primitive variable?
    To pass it by reference.


  • 119. What's the difference between Java and .NET garbage collectors?
    Sun left the implementation of a specific garbage collector up to the JRE developer, so their performance varies widely, depending on whose JRE you're using. Microsoft standardized on their garbage collection.


  • 120. How do you enforce garbage collection in .NET?


  • 121. What's different about namespace declaration when comparing that to package declaration in Java?
  • No semicolon.


  • 122. What's the difference between const and readonly?
    You can initialize readonly variables to some runtime values. Let's say your program uses current date and time as one of the values that won't change. This way you declare public readonly string DateT = new DateTime().ToString().


  • 123. What happens when you encounter a continue statement inside the for loop? The code for the rest of the loop is ignored, the control is transferred back to the beginning of the loop.


  • 124. 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.


  • 125. Can you store multiple data types in System.Array?
  • 150. When you inherit a protected class-level variable, who is it available to?
    Derived Classes.


  • 151. What's the top .NET class that everything is derived from?


  • 152. How's method overriding different from overloading?
    When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the  same name within the class.


  • 153. What does the keyword virtual mean in the method definition?
    The method can be over-ridden.


  • 154. Can you declare the override method static while the original method is non-static? No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword  override.


  • 155. Can you override private virtual methods? No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.


  • 156. Can you prevent your class from being inherited and becoming a base class for some other classes?
    Yes, that's what keyword sealed in the class definition is for. The developer trying to derive from your class will get a  message: cannot inherit from Sealed class WhateverBaseClassName. It's the same concept as final class in Java.


  • 157. Can you allow class to be inherited, but prevent the method from being over-ridden?
    Yes, just leave the class public and make the method sealed.


  • 158. Why can't you specify the accessibility modifier for methods inside the interface? They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.


  • 159. Can you inherit multiple interfaces?
    Yes, why not.


  • 160. And if they have conflicting method names?
    It's up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you're okay.


  • 161. What's the difference between an interface and abstract class?
    In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.


  • 162. How can you overload a method?
    Different parameter data types, different number of parameters, different order of parameters.


  • 163. If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.


  • 164. What's the difference between System.String and System.StringBuilder classes? System.String is immutable, System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.


  • 165. Does C# support multiple-inheritance?
    No, use interfaces instead.


  • 166. When you inherit a protected class-level variable, who is it available to?
    The derived class.


  • 167. Are private class-level variables inherited?
    Yes, but they are not accessible.  Although they are not visible or accessible via the class interface, they are inherited.


  • 168. Describe the accessibility modifier "protected internal".
    It is available to derived classes and classes within the same Assembly (and naturally from the base class it's declared in).


  • 169. What's the top .NET class that everything is derived from?


  • 170. What's the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in cases where there is a large amount of string manipulation.  Strings are immutable, so each time it's being operated on, a new instance is created.


  • 171. Can you store multiple data types in System.Array?


  • 172. What's the .NET class that allows the retrieval of a data element using a unique key?


  • 173. Will the finally block get executed if an exception has not occurred?


  • 174. What's an abstract class? A class that cannot be instantiated.  An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.

  • 175. When do you absolutely have to declare a class as abstract?
     1.       When at least one of the methods in the class is abstract.
     2.       When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden
  • 176. What's an interface?
    It's an abstract class with public abstract methods all of which must be implemented in the inherited classes.


  • 177. Why can't you specify the accessibility modifier for methods inside the interface? They all must be public.  Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it's public by default.


  • 178. What's the difference between an interface and abstract class?
    In an interface class, all methods must be abstract.  In an abstract class some methods can be concrete.  In an interface class, no accessibility modifiers are allowed, which is ok in an abstract class.


  • 179. How is method overriding different from method overloading?
    When overriding a method, you change the behavior of the method for the derived class.  Overloading a method simply  involves having another method with the same name within the class.


  • 180. Can you declare an override method to be static if the original method is non-static? No. The signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.


  • 181. Can you override private virtual methods?
    No.  Private methods are not accessible outside the class.


  • 182. Can you write a class without specifying namespace? Which namespace does it belong to by default? 
  • Yes, you can, then the class belongs to global namespace which has no name. For commercial products, naturally, you  wouldn't want global namespace.


  • 183. What is a formatter?  A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing  and decoding messages into data on the other end.
  • 184. Different b/w .NET & J2EE ?
    Differences between J2EE and the .NET Platform
  • Vendor Neutrality
  • The .NET platform is not vendor neutral, it is tied to the Microsoft operating systems. But neither are any of the J2EE implementations
    Many companies buy into J2EE believing that it will give them vendor neutrality. And, in fact, this is a stated goal of Sun's vision:
    A wide variety of J2EE product configurations and implementations, all of which meet the requirements of this specification, are possible. A portable J2EE application will function correctly when successfully deployed in any of these products. (ref : Java 2 Platform Enterprise Edition Specification, v1.3, page 2-7 available at
  • Overall Maturity
  • Given that the .NET platform has a three year lead over J2EE, it should be no surprise to learn that the .NET platform is far more mature than the J2EE platform. Whereas we have high volume highly reliable web sites using .NET technologies (NASDAQ and Dell being among many examples)
  • Interoperability and Web Services
  • The .NET platform eCollaboration model is, as I have discussed at length, based on the UDDI and SOAP standards. These standards are widely supported by more than 100 companies. Microsoft, along with IBM and Ariba, are the leaders in this area. Sun is a member of the UDDI consortium and recognizes the importance of the UDDI standards. In a recent press release, Sun's George Paolini, Vice President for the Java Community Development,  says:
  • "Sun has always worked to help establish and support open, standards-based technologies that facilitate the growth of network-based applications, and we see UDDI as an important project to establish a registry framework for business-to-business e-commerce
  • But while Sun publicly says it believes in the UDDI standards, in reality, Sun has done nothing whatsoever to incorporate any of the UDDI standards into J2EE.
  • Scalability
  • Typical Comparision w.r.t Systems and their costs
  • J2EE
  • Company System   Total Sys.  Cost
    Bull         Escala T610 c/s          16,785  $1,980,179    
    IBM         RS/6000 Enterprise Server F80  16,785  $2,026,681    
    Bull          Escala EPC810 c/s                     33,375  $3,037,499    
    IBM          RS/6000 Enterprise Server M80 33,375  $3,097,055    
    Bull          Escala EPC2450                        110,403 $9,563,263    
    IBM          IBM eServer pSeries 680 Model 7017-S85   110,403 $9,560,594    

  • .NET platform systems
  • Company System    Total Sys.                                           Cost
    Dell                        PowerEdge 4400  16,263  $273,487      
    Compaq                  ProLiant ML-570-6/700-3P 20,207  $201,717      
    Dell                        PowerEdge 6400                30,231  $334,626      
    IBM                        Netfinity 7600 c/s              32,377  $443,463      
    Compaq                  ProLiant 8500-X550-64P    161,720 $3,534,272    
    Compaq                  ProLiant 8500-X700-64P    179,658 $3,546,582    
    Compaq                  ProLiant 8500-X550-96P    229,914 $5,305,571    
    Compaq                  ProLiant 8500-X700-96P    262,244 $5,305,571    
    Compaq                  ProLiant 8500-700-192P    505,303 $10,003,826   


  • Framework Support
  • The .NET platform includes such an eCommerce framework called Commerce Server. At this point, there is no equivalent vendor-neutral framework in the J2EE space. With J2EE, you should assume that you will be building your new eCommerce solution from scratch
  • Moreover, no matter what [J2EE] vendor you choose, if you expect a component framework that will allow you to quickly field complete e-business applications, you are in for a frustrating experience
  • Language
  • In the language arena, the choice is about as simple as it gets. J2EE supports Java, and only Java. It will not support any other language in the foreseeable future. The .NET platform supports every language except Java (although it does support a language that is syntactically and functionally equivalent to Java, C#). In fact, given the importance of the .NET platform as a language independent vehicle, it is likely that any language that comes out in the near future will include support for the .NET platform.
  • Some companies are under the impression that J2EE supports other languages. Although both IBM's WebSphere and BEA's WebLogic support other languages, neither does it through their J2EE technology. There are only two official ways in the J2EE platform to access other languages, one through the Java Native Interface and the other through CORBA interoperability. Sun recommends the later approach. As Sun's Distinguished Scientist and Java Architect Rick Cattell said in a recent interview.
  • Portability
  • The reason that operating system portability is a possibility with J2EE is not so much because of any inherent portability of J2EE, as it is that most of the J2EE vendors support multiple operating systems. Therefore as long as one sticks with a given J2EE vendor and a given database vendor, moving from one operating system to another should be possible. This is probably the single most important benefit in favor of J2EE over the .NET platform, which is limited to the Windows operating system. It is worth noting, however, that Microsoft has submitted the specifications for C# and a subset of the .NET Framework (called the common language infrastructure) to ECMA, the group that standardizes JavaScript.
  • J2EE offers an acceptable solution to ISVs when the product must be marketed to non-Windows customers, particularly when the J2EE platform itself can be bundled with the ISV's product as an integrated offering.
  • If the primary customer base for the ISV is Windows customers, then  the .NET platform should be chosen.  It will provide much better performance at a much lower cost.


  • Client device independence
  • The major difference being that with Java, it is the presentation tier programmer that determines the ultimate HTML that will be delivered to the client, and with .NET, it is a Visual Studio.NET control.
  • This Java approach has three problems. First, it requires a lot of code on the presentation tier, since every possible thin client system requires a different code path. Second, it is very difficult to test the code with every possible thin client system. Third, it is very difficult to add new thin clients to an existing application, since to do so involves searching through, and modifying a tremendous amount of presentation tier logic.
  • The .NET Framework approach is to write device independent code that interacts with visual controls. It is the control, not the programmer, that is responsible for determining what HTML to deliver, based on the capabilities of the client device.. In the .NET Framework model, one can forget that such a thing as HTML even exists!
  • Conclusion
  • Sun's J2EE vision is based on a family of specifications that can be implemented by many vendors. It is open in the sense that any company can license and implement the technology, but closed in the sense that it is controlled by a single vendor, and a self contained architectural island with very limited ability to interact outside of itself. One of J2EE's major disadvantages is that the choice of the platform dictates the use of a single programming language, and a programming language that is not well suited for most businesses. One of J2EE's major advantages is that most of the J2EE vendors do offer operating system portability.
  • Microsoft's .NET platform vision is a family of products rather than specifications, with specifications used primarily to define points of interoperability. The major disadvantage of this approach is that if is limited to the Windows platform, so applications written for the .NET platform can only be run on .NET platforms. Their are several important advantages to the .NET platform:
  • The cost of developing applications is much lower, since standard business languages can be used and device independent presentation tier logic can be written.
  • The cost of running applications is much lower, since commodity hardware platforms (at 1/5 the cost of their Unix counterparts) can be used.
  • The ability to scale up is much greater, with the proved ability to support at least ten times the number of clients any J2EE platform has shown itself able to support.
  • Interoperability is much stronger, with industry standard eCollaboration built into the platform.
  • 185. What are the Main Features of .NET platform?
  • Features of .NET Platform are :-
  • Common Language Runtime Explains the features and benefits of the common language runtime, a run-time environment that manages the execution of code and provides services that simplify the development process.
  • Assemblies
    Defines the concept of assemblies, which are collections of types and resources that form logical units of functionality. Assemblies are the fundamental units of deployment, version control, reuse, activation scoping, and security permissions.
  • Application Domains
    Explains how to use application domains to provide isolation between applications.
  • Runtime Hosts
    Describes the runtime hosts supported by the .NET Framework, including ASP.NET, Internet Explorer, and shell executables.
  • Common Type System
    Identifies the types supported by the common language runtime.
  • Metadata and Self-Describing Components
    Explains how the .NET Framework simplifies component interoperation by allowing compilers to emit additional declarative information, or metadata, into all modules and assemblies.
  • Cross-Language Interoperability
    Explains how managed objects created in different programming languages can interact with one another.
  • .NET Framework Security
    Describes mechanisms for protecting resources and code from unauthorized code and unauthorized users.
  • .NET Framework Class Library
    Introduces the library of types provided by the .NET Framework, which expedites and optimizes the development process and gives you access to system functionality.
  • 186. What is the use of JIT ? JIT (Just - In - Time) is a compiler which converts MSIL code to Native Code (ie.. CPU-specific code that runs on the same computer architecture).
  • Because the common language runtime supplies a JIT compiler for each supported CPU architecture, developers can write a set of MSIL that can be JIT-compiled and run on computers with different architectures. However, your managed code will run only on a specific operating system if it calls platform-specific native APIs, or a platform-specific class library.
  • JIT compilation takes into account the fact that some code might never get called during execution. Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as needed during execution and stores the resulting native code so that it is accessible for subsequent calls. The loader creates and attaches a stub to each of a type's methods when the type is loaded. On the initial call to the method, the stub passes control to the JIT compiler, which converts the MSIL for that method into native code and modifies the stub to direct execution to the location of the native code. Subsequent calls of the JIT-compiled method proceed directly to the native code that was previously generated, reducing the time it takes to JIT-compile and run the code.
  • 187. What meant of assembly & global assembly cache (gac) & Meta data. Assembly :-- An assembly is the primary building block of a .NET based application. It is a collection of functionality that is built, versioned, and deployed as a single implementation unit (as one or more files). All managed types and resources are marked either as accessible only within their implementation unit, or as accessible by code outside that unit. It overcomes the problem of 'dll Hell'.The .NET Framework uses assemblies as the fundamental unit for several purposes: 
  • Security 
  • Type Identity 
  • Reference Scope 
  • Versioning 
  • Deployment
  • Global Assembly Cache :-- Assemblies can be shared among multiple applications on the machine by registering them in global Assembly cache(GAC). GAC is a machine wide a local cache of assemblies maintained by the .NET Framework. We can register the assembly to global assembly cache by using gacutil command.
    We can Navigate to the GAC directory, C:\winnt\Assembly in explore. In the tools menu select the cache properties; in the windows displayed you can set the memory limit in MB used by the GAC
    MetaData :--Assemblies have Manifests. This Manifest contains Metadata information of the Module/Assembly as well as it contains detailed Metadata of other assemblies/modules references (exported). It's the Assembly Manifest which differentiates between an Assembly and a Module.
  • 188. What are the mobile devices supported by .net platform
    The Microsoft .NET Compact Framework is designed to run on mobile devices such as mobile phones, Personal Digital Assistants (PDAs), and embedded devices. The easiest way to develop and test a Smart Device Application is to use an emulator.
  • These devices are divided into two main divisions:
    1) Those that are directly supported by .NET (Pocket PCs, i-Mode phones, and WAP devices)
    2) Those that are not (Palm OS and J2ME-powered devices).
  • 189. What is GUID , why we use it and where?
    GUID :-- GUID is Short form of Globally Unique Identifier, a unique 128-bit number that is produced by the Windows OS or by some Windows applications to identify a particular component, application, file, database entry, and/or user. For instance, a Web site may generate a GUID and assign it to a user's browser to record and track the session. A GUID is also used in a Windows registry to identify COM DLLs. Knowing where to look in the registry and having the correct GUID yields a lot information about a COM object (i.e., information in the type library, its physical location, etc.). Windows also identifies user accounts by a username (computer/domain and username) and assigns it a GUID. Some database administrators even will use GUIDs as primary key values in databases.
  • GUIDs can be created in a number of ways, but usually they are a combination of a few unique settings based on specific point in time (e.g., an IP address, network MAC address, clock date/time, etc.).
  • 190. Describe the difference between inline and code behind - which is best in a loosely coupled solution ASP.NET supports two modes of page development: Page logic code that is written inside runat="server"> blocks within an .aspx file and dynamically compiled the first time the page is requested on the server. Page logic code that is written within an external class that is compiled prior to deployment on a server and linked ""behind"" the .aspx file at run time.
  • 191. Whats MSIL, and why should my developers need an appreciation of it if at all? When compiling the source code to managed code, the compiler translates the source into Microsoft intermediate language (MSIL). This is a CPU-independent set of instructions that can efficiently be converted to native code. Microsoft intermediate language (MSIL) is a translation used as the output of a number of compilers. It is the input to a just-in-time (JIT) compiler. The Common Language Runtime includes a JIT compiler for the conversion of MSIL to native code.
  • Before Microsoft Intermediate Language (MSIL) can be executed it, must be converted by the .NET Framework just-in-time (JIT) compiler to native code. This is CPU-specific code that runs on the same computer architecture as the JIT compiler. Rather than using time and memory to convert all of the MSIL in a portable executable (PE) file to native code. It converts the MSIL as needed whilst executing, then caches the resulting native code so its accessible for any subsequent calls.
  • 192. How many .NET languages can a single .NET DLL contain?
  • 193. What type of code (server or client) is found in a Code-Behind class?
  • 194. Whats an assembly? Assemblies are the building blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of type implementations. To the runtime, a type does not exist outside the context of an assembly.
  • 195. How many classes can a single .NET DLL contain?
  • 196. What is the difference between string and String ?
    No difference
  • 197. What is manifest?
    It is the metadata that describes the assemblies.
  • 198. What is metadata? Metadata is machine-readable information about a resource, or ""data about data."" Such information might include details on content, format, size, or other characteristics of a data
    source. In .NET, metadata includes type definitions, version information, external assembly references, and other standardized information.
  • 199. What are the types of assemblies?
    There are four types of assemblies in .NET:
  • Static assemblies
    These are the .NET PE files that you create at compile time.
  • Dynamic assemblies These are PE-formatted, in-memory assemblies that you dynamically create at runtime using the classes in the System.Reflection.Emit namespace.
  • Private assemblies These are static assemblies used by a specific application.
  • Public or shared assemblies These are static assemblies that must have a unique shared name and can be used by any application.
  • An application uses a private assembly by referring to the assembly using a static path or through an XML-based application configuration file. While the CLR doesn't enforce versioning policies-checking whether the correct version is used-for private assemblies, it ensures that an
    application uses the correct shared assemblies with which the application was built. Thus, an application uses a specific shared assembly by referring to the specific shared assembly, and the CLR ensures that the correct version is loaded at runtime.
  • In .NET, an assembly is the smallest unit to which you can associate a version number;
  • 200. What are delegates?where are they used ? A delegate defines a reference type that can be used to encapsulate a method with a specific signature. A delegate instance encapsulates a static or an instance method. Delegates are roughly similar to function pointers in C++; however, delegates are type-safe and secure
  • 201. When do you use virutal keyword?.
  • When we need to override a method of the base class in the sub class, then we give the virtual keyword in the base class method. This makes the method in the base class to be overridable. Methods, properties, and indexers can be virtual, which means that their implementation can be overridden in derived classes.
  • 202. What are class access modifiers ? Access modifiers are keywords used to specify the declared accessibility of a member or a type. This section introduces the four access modifiers:
    · Public  - Access is not restricted.
    · Protected  - Access is limited to the containing class or types derived from the containing class.
    · Internal - Access is limited to the current assembly.
    · Protected inertnal - Access is limited to the current assembly or types derived · from the containing class.
    · Private - Access is limited to the containing type.
  • 203. What Is Boxing And Unboxing?
    Boxing :- Boxing is an implicit conversion of a value type to the type object type
  • Eg:-
    Consider the following declaration of a value-type variable:
    int i = 123;
    object o = (object) i;
    Boxing Conversion
  • UnBoxing :- Unboxing is an explicit conversion from the type object to a value type
    int i = 123;          // A value type
    object box = i;       // Boxing
    int j = (int)box;     // Unboxing
  • 204. What is Value type and refernce type in .Net?.
    Value Type : A variable of a value type always contains a value of that type. The assignment to a variable of a value type creates a copy of the assigned value, while the assignment to a variable of a reference type creates a copy of the reference but not of the referenced object.
  • The value types consist of two main categories:
    * Stuct Type
    * Enumeration Type
  • Reference Type :Variables of reference types, referred to as objects, store references to the actual data. This section introduces the following keywords used to declare reference types:
    * Class
    * Interface
    * Delegate
  • This section also introduces the following built-in reference types:
    * object
    * string
  • 205. What is the difference between structures and enumeration?.
    Unlike classes, structs are value types and do not require heap allocation. A variable of a struct type directly contains the data of the struct, whereas a variable of a class type contains a reference to the data. They are derived from System.ValueType class.
  • Enum->An enum type is a distinct type that declares a set of named constants.They  are strongly typed constants. They are unique types that allow to declare symbolic names to integral values. Enums are value types, which means they contain their own value, can't inherit or be inherited from and assignment copies the value of one enum to another.
  • public enum Grade

  • 206. What is namespaces?. Namespace is a logical naming scheme for group related types.Some class types that logically belong together they can be put into a common namespace. They prevent namespace collisions and they provide scoping. They are imported as "using" in C# or "Imports" in Visual Basic. It seems as if these directives specify a particular assembly, but they don't. A namespace can span multiple assemblies, and an assembly can define multiple namespaces. When the compiler needs the definition for a class type, it tracks  through each of the different imported namespaces to the type name and searches each referenced assembly until it is found.
    Namespaces can be nested. This is very similar to packages in Java as far as scoping is concerned.

  • 207. How do you create shared assemblies?.
    Just look through the definition of Assemblies..
       *  An Assembly is a  logical unit of code
       * Assembly physically exist as DLLs or EXEs
       * One assembly can contain one or more files
       * The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
       * When you compile your source code by default the exe/dll generated is actually an assembly
       * Unless your code is bundled as assembly it can not be used in any other application
       * When you talk about version of a component you are actually talking about version of the assembly to which the component belongs.
       * Every assembly file contains information about itself. This information is called as Assembly Manifest.
  • Following steps are involved in creating shared assemblies :
  • * Create your DLL/EXE source code
       * Generate unique assembly name using SN utility
       * Sign your DLL/EXE with the private key by modifying AssemblyInfo file
       * Compile your DLL/EXE
       * Place the resultant DLL/EXE in global assembly cache using AL utility
  • 208. What is global assembly cache? Each computer where the common language runtime is installed has a machine-wide code cache called the global assembly cache. The global assembly cache stores assemblies specifically designated to be shared by several applications on the computer.  There are several ways to deploy an assembly into the global assembly cache: · Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache. Use a developer tool called the Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK.
    · Use Windows Explorer to drag assemblies into the cache.  
  • 209. What is MSIL?. When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations. Before code can be run, MSIL must be converted to CPU-specific code, usually by a just-in-time (JIT) compiler. Because the common language runtime supplies one or more JIT compilers for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture.
    When a compiler produces MSIL, it also produces metadata. Metadata describes the types in your code, including the definition of each type, the signatures of each type's members, the members that your code references, and other data that the runtime uses at execution time. The MSIL and metadata are contained in a portable executable (PE) file that is based on and extends the published Microsoft PE and common object file format (COFF) used historically for executable content. This file format, which accommodates MSIL or native code as well as metadata, enables the operating system to recognize common language runtime images. The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL). The runtime locates and extracts the metadata from the file as needed during execution.
  • 210. What is Jit compilers?.how many are available in clr?
    Just-In-Time compiler- it converts the language that you write in .Net into machine language that a computer can understand. there are tqo types of JITs one  is memory optimized & other  is performace optimized.
  • 211. What is tracing?Where it used.Explain few methods available
    Tracing refers to collecting information about the application while it is running. You use tracing  information to troubleshoot an application.
    Tracing allows us to observe and correct programming errors. Tracing enables you to record information in various log files about the errors that might occur at run time. You can analyze these log files to find the cause of the errors.
  • In .NET we have objects called Trace Listeners. A listener is an object that receives the trace output and outputs it somewhere; that somewhere could be a window in your development environment, a file on your hard drive, a Windows Event log, a SQL Server or Oracle database, or any other customized data store.
  • The System.Diagnostics namespace provides the interfaces, classes, enumerations and structures that are used for tracing The System.Diagnostics namespace provides two classes named Trace and Debug that are used for writing errors and application execution information in logs.
  • All Trace Listeners have the following functions. Functionality of these functions is same except that the target media for the tracing output is determined by the Trace Listener.
  • Method Name Result Fail   Outputs the specified text with the Call Stack.
    Write   Outputs the specified text.
    WriteLine    Outputs the specified text and a carriage return.
    Flush   Flushes the output buffer to the target media.
    Close   Closes the output stream in order to not receive the tracing/debugging output
  • 1.Describe the role of inetinfo.exe, aspnet_isapi.dll and aspnet_wp.exe in the page loading process ?

    Ans : inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process aspnet_wp.exe.
  • 2. What’s the difference between Response.Write() and Response.Output.Write()?
    Ans : Response.Output.Write() allows you to write formatted output.
  • 3. What methods are fired during the page load?
    Ans : 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.
  • 4. When during the page processing cycle is ViewState available?
    Ans : After the Init() and before the Page_Load(), or OnLoad() for a control.
  • 5. What namespace does the Web page belong in the .NET Framework class hierarchy?
    Ans : System.Web.UI.Page
  • 6. Where do you store the information about the user’s locale?
    Ans : System.Web.UI.Page.Culture
  • 7. What’s the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?
    Ans : CodeBehind is relevant to Visual Studio.NET only.
  • 8. What’s a bubbled event?
  • Ans : When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their event handlers, allowing the main DataGrid event handler to take care of its constituents. 
  • 9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button.  Where do you add an event handler?
  • Ans : Add an OnMouseOver attribute to the button.  Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
  • 10. What data types do the RangeValidator control support?
  • Ans : Integer, String, and Date.1. Explain the differences between Server-side and Client-side code?
  • Ans : Server-side code executes on the server.  Client-side code executes in the client's browser.
  • 12. What type of code (server or client) is found in a Code-Behind class?
  • Ans : The answer is server-side code since code-behind is executed on the server.  However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser.  But just to be clear, code-behind executes on the server, thus making it server-side code.
  • 13. Should user input data validation occur server-side or client-side?  Why?
  • Ans : All user input data validation should occur on the server at a minimum.  Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.
  • 14. What is the difference between Server.Transfer and Response.Redirect?  Why would I choose one over the other?
  • Ans : 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 perform as 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.
  • 15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
  • Valid answers are:
  • ·  A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
  • ·  A DataSet is designed to work without any continuing connection to the original data source.
  • ·  Data in a DataSet is bulk-loaded, rather than being loaded on demand.
  • ·  There's no concept of cursor types in a DataSet.
  • ·  DataSets have no current record pointer You can use For Each loops to move through the data.
  • ·  You can store many edits in a DataSet, and write them to the original data source in a single operation.
  • ·  Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
  • 16. What is the Global.asax used for?
  • Ans : The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
  • 17. What are the Application_Start and Session_Start subroutines used for?
  • Ans : This is where you can set the specific variables for the Application and Session objects.
  • 18. Can you explain what inheritance is and an example of when you might use it?
  • Ans : When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.
  • 19. Whats an assembly?
  • Ans : Assemblies are the building blocks of the .NET framework.
  • 20. Describe the difference between inline and code behind.
  • Ans : Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page
  • 21. Explain what a diffgram is, and a good use for one?
  • Ans : The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML.  A good use is reading database data to an XML file to be sent to a Web Service.
  • 22. Whats MSIL, and why should my developers need an appreciation of it if at all?
  • Ans : 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.
  • 23. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
  • Ans : The Fill() method.
  • 24. Can you edit data in the Repeater control?
  • Ans : No, it just reads the information from its data source.
  • 25. Which template must you provide, in order to display data in a Repeater control?
  • Ans : ItemTemplate

·         Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.

·         27. What's the implicit name of the parameter that gets passed into the class' set method?
Value, and it's datatype depends on whatever variable we're changing.

·         28. How do you inherit from a class in C#?
Place a colon and then the name of the base class. Notice that it's double colon in C++.

·         29. Does C# support multiple inheritance?
No, use interfaces instead.

·         30. So how do you retrieve the customized properties of a .NET application from XML .config file? Can you automate this process?
Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable. In Visual Studio yes, use Dynamic Properties for automatic .config creation, storage and retrieval.

·         31. Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio?
The designer will likely through it away, most of the code inside InitializeComponent is auto-generated.

·         32. Where do you add an event handler?
It's the Attributesproperty, the Add function inside that property.
e.g. btnSubmit.Attributes.Add(""onMouseOver"",""someClientCode();"")

·         33. What are jagged array?

·         First lets us answer the question that what an array is?
The dictionary meaning of array is an orderly arrangement or sequential arrangement of elements.

·         In computer science term:
An array is a data structure that contains a number of variables, which are accessed through computed indices. The variables contained in an array, also called the elements of the array, are all of the same type, and this type is called the element type of the array.

·         An array has a rank that determines the number of indices associated with each array element. The rank of an array is also referred to as the dimensions of the array. An array with a rank of one is called a single-dimensional array. An array with a rank greater than one is called a multi-dimensional array. Specific sized multidimensional arrays are often referred to as two-dimensional arrays, three-dimensional arrays, and so on.

·         Now let us answer What are jagged arrays?
 A jagged array is an array whose elements are arrays. The elements of jagged array can be of different dimensions and sizes. A jagged array is sometimes called as “array-of-arrays”. It is called jagged because each of its rows is of different size so the final or graphical representation is not a square.

·         When you create a jagged array you declare the number of rows in your array. Each row will hold an array that will be on any length. Before filling the values in the inner arrays you must declare them.

·         Jagged array declaration in C#:

·         For e.g. : int [] [] myJaggedArray = new int [3][];

·         Declaration of inner arrays:
 myJaggedArray[0] = new int[5] ;   // First inner array will be of length 5.
 myJaggedArray[1] = new int[4] ;  // Second inner array will be of length 4.
 myJaggedArray[2] = new int[3] ;   // Third inner array will be of length 3.

·         Now to access third element of second row we write:
  int value = myJaggedArray[1][2];

·         Note that while declaring the array the second dimension is not supplied because this you will declare later on in the code.

·         Jagged array are created out of single dimensional arrays so be careful while using them. Don’t confuse it with multi-dimensional arrays because unlike them jagged arrays are not rectangular arrays.

·         For more information on arrays: 

·         34. What is a delegate, why should you use it and how do you call it ? A delegate is a reference type that refers to a Shared method of a type or to an instance method of an object. Delegate is like a function pointer in C and C++.  Pointers are used to store the address of a thing. Delegate lets some other code call your function without needing to know where your function is actually located. All events in .NET actually use delegates in the background to wire up events. Events are really just a modified form of a delegate. It should give you an idea of some different areas in which delegates may be appropriate:

·                  They enable callback functionality in multi-tier applications as demonstrated in the examples above. <o:p></o:p>

·                  The CacheItemRemoveCallback delegate can be used in ASP.NET to keep cached information up to date. When the cached information is removed for any reason, the associated callback is exercised and could contain a reload of the cached information. <o:p></o:p>

·                  Use delegates to facilitate asynchronous processing for methods that do not offer asynchronous behavior.

·                  Events use delegates so clients can give the application events to call when the event is fired. Exposing custom events within your applications requires the use of delegates.

·         34. How does the XmlSerializer work? XmlSerializer in the .NET Framework is a great tool to convert Xml into runtime objects and vice versa

·         35. If you define integer variable and a object variable and a structure then how those will be plotted in memory.

·         Integer , structure – System.ValueType  -- Allocated memory on stack , infact integer is primitive type recognized and allocated memory by compiler itself .

·         Infact , System.Int32 definition is as follows :

·         [C#]
public struct Int32 : IComparable, IFormattable, IConvertible

·         So , it’s a struct by definition , which is the same case with various other value types .

·         Object – Base class , that is by default reference type , so at runtime JIT compiler allocates memory on the “Heap” Data structure .

·         Reference types are defined as class , derived directly or indirectly by System.ReferenceType


  • 26. How can you provide an alternating color scheme in a Repeater control?
  • Ans : Use the AlternatingItemTemplate.
  • 27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
    Ans : You must set the DataSource property and call the DataBind method.
  • 28. What base class do all Web Forms inherit from?
  • Ans : The Page class.
  • 29. Name two properties common in every validation control?
  • Ans : ControlToValidate property and Text property.
  • 30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
  • Ans : DataTextField property.
  • 31. Which control would you use if you needed to make sure the values in two different controls matched?
  • Ans : CompareValidator control.
  • 32. How many classes can a single .NET DLL contain?
  • Ans : It can contain many classes.33. What is ViewState?
  • Ans : 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 to retain the state of server-side objects between post backs.
  • 34. What is the lifespan for items stored in ViewState?
  • Ans : Item stored in ViewState exist for the life of the current page.  This includes postbacks (to the same page).
  • 35. What does the "EnableViewState" property do?  Why would I want it on or off?
  • Ans : 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. 


  • 36. What are the different types of Session state management options available with ASP.NET?
  • Ans : 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.
  • 37. What is CLS (Common Language Specificaiton)?
  • Ans : It provides the set of specificaiton which has to be adhered by any new language writer / Compiler writer for .NET Framework. This ensures Interoperability. For example: Within a ASP.NET application written in C#.NET language, we can refer to any DLL written in any other language supported by .NET Framework. As of now .NET Supports around 32 languages.
  • 38. What is CTS (Common Type System)?
  • Ans : It defines about how Objects should be declard, defined and used within .NET. CLS is the subset of CTS.
  • 39. What is Boxing and UnBoxing?
  • Ans : Boxing is implicit conversion of ValueTypes to Reference Types (Object). UnBoxing is explicit conversion of Reference Types (Object) to its equivalent ValueTypes. It requires type-casting.
  • 40. What is the difference between Value Types and Reference Types?
  • Ans : Value Types uses Stack to store the data where as the later uses the Heap to store the data.
  • 41. What are the different types of assemblies available and their purpose?
  • Ans : Private, Public/shared and Satellite Assemblies.
  • Private Assemblies : Assembly used within an application is known as private assemblies.

    Public/shared Assemblies : Assembly which can be shared across applicaiton is known as shared assemblies. Strong Name has to be created to create a shared assembly. This can be done using SN.EXE. The same has to be registered using GACUtil.exe (Global Assembly Cache).
  • Satellite Assemblies : These assemblies contain resource files pertaining to a locale (Culture+Language). These assemblies are used in deploying an Gloabl applicaiton for different languages.
  • 42. What is view state and use of it? The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested for the first time versus when the form is posted (sent to the server), which  allows you to program accordingly.

    43. What are user controls and custom controls?
    Custom controls:  A control authored by a user or a third-party software vendor that does not belong to   the .NET Framework class library. This is a generic term that includes user controls. A  custom server control is used in Web Forms (ASP.NET pages). A custom client control is used  in Windows Forms applications.User Controls: In ASP.NET: A user-authored server control that enables an ASP.NET page to be re-used   as a server control. An ASP.NET user control is authored declaratively  and persisted as a  text file with an .ascx extension. The ASP.NET page framework compiles a user control on  the fly to a class that derives from the        System.Web.UI.UserControl class.
  • 41. What are the validation controls? A set of server controls included with ASP.NET that test user input in HTML and Web server  controls for programmer-defined requirements. Validation controls perform input checking in server code. If the user is working with a browser that supports DHTML, the validation  controls can also perform validation using client script.

    45. What's the difference between Response.Write() andResponse.Output.Write()? The latter one allows you to write formattedoutput.

    46. 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.

    47. Where does the Web page belong in the .NET Framework class hierarchy?

    48. Where do you store the information about the user's locale?

    49. What's the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"? CodeBehind is relevant to Visual Studio.NET only.

    50. What's a bubbled event? When you have a complex control, likeDataGrid, writing an event processing routine for each object (cell, button,row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents. Suppose you want a certain ASP.NET function executed on MouseOver over a certain button
  • 51. Where do you add an event handler? It's the Attributesproperty, the Add function inside that property. e.g. btnSubmit.Attributes.Add("onMouseOver","someClientCode();")

    52. What data type does the RangeValidator control support?
    Integer,String and Date.
  • 53. What are the different types of caching?
    Caching is a technique widely used in computing to increase performance by keeping frequently accessed or expensive data in memory. In context of web application, caching is used to retain the pages or data across HTTP requests and reuse them without the expense of recreating them. ASP.NET has 3 kinds of caching strategies Output Caching, Fragment Caching, Data Caching.
  • Output Caching: Caches the dynamic output generated by a request. Some times it is useful to cache  the output of a website even for a minute, which will result in a better  performance. For caching the whole page the page should have OutputCache directive.<%@ OutputCache Duration="60" VaryByParam="state" %>
  • Fragment Caching: Caches the portion of the  page generated by the request. Some times it is not practical to cache the entire page, in such cases we can cache a portion of page<%@ OutputCache Duration="120" VaryByParam="CategoryID;SelectedID"%>
  • Data Caching: Caches the objects programmatically. For     data caching provides a cache object for eg: cache["States"] = dsStates;

    54. 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, Its access is limited it is known as       authorization.
  • 55. What are different types of directives in .NET?
    @Page: Defines page-specific attributes used by the ASP.NET page parser and compiler. Can       be included only in .aspx files <%@ Page AspCompat="TRUE" language="C#" %>
  • @Control:Defines control-specific attributes used by the ASP.NET page parser and        compiler. Can be included only in .ascx files. <%@ Control Language="VB" EnableViewState="false" %>

  • @Import: Explicitly imports a namespace into a page or user control. The Import         directive cannot have more than one namespace attribute. To import multiple     namespaces,     use multiple @Import directives. <% @ Import Namespace="System.web" %>
  • @Implements: Indicates that the current page or user control implements the specified .NET      framework interface.<%@ Implements Interface="System.Web.UI.IPostBackEventHandler" %>
  • @Register: Associates aliases with namespaces and class names for concise notation in   custom server control syntax.<%@ Register Tagprefix="Acme" Tagname="AdRotator" Src="AdRotator.ascx" %>
  • @Assembly: Links an assembly to the current page during compilation, making all         the     assembly's classes and interfaces available for use on the      page. <%@ Assembly Name="MyAssembly" %> <%@Assembly Src="MySource.vb" %>
  • @OutputCache: Declaratively controls the output caching policies of an ASP.NET page or a        user control contained in a page<%@ OutputCache Duration="#ofseconds" Location="Any | Client | Downstream | Server | None" Shared="True | False" VaryByControl="controlname" VaryByCustom="browser | customstring" VaryByHeader="headers" VaryByParam="parametername" %>
  • @Reference: Declaratively indicates that another user control or page source file               should be dynamically compiled and linked against the page in which this directive is   declared.
  • 56. How do I debug an ASP.NET application that wasn't written with Visual Studio.NET and that doesn't use code-behind?
    Start the DbgClr debugger that comes with the .NET Framework SDK, open the file containing      the code you want to debug, and set your breakpoints. Start the ASP.NET application. Go back to DbgClr, choose Debug Processes from the Tools menu, and select  aspnet_wp.exe from  the list of processes. (If aspnet_wp.exe doesn't appear in the list,check the "Show system      processes" box.) Click the Attach button to attach to aspnet_wp.exe and begin debugging.
    Be sure to enable debugging in the ASPX file before debugging it with DbgClr. You can   enable tell ASP.NET to build debug executables by placing a
    <%@ Page Debug="true" %>   statement at the top of an ASPX file or a   <COMPILATION debug="true" />statement in a Web.config file.
    57. Can a user browsing my Web site read my Web.config or Global.asax files? No. The <HTTPHANDLERS>section of Machine.config, which holds the master configuration  settings for ASP.NET, contains entries that map ASAX files, CONFIG files, and selected  other file types to an HTTP handler named HttpForbiddenHandler, which fails attempts to retrieve the associated file. You can modify it by editing  Machine.config or including an section in a local Web.config file.

    58. What's the difference between Page.RegisterClientScriptBlock and Page.RegisterStartupScript? RegisterClientScriptBlock is for returning blocks of client-side script containing functions. RegisterStartupScript is for returning blocks of client-script not   packaged in functions-in other words, code that's to execute when the page is loaded. The latter positions script blocks near the end of the document so elements on the page that the script interacts are loaded before the script runs.<%@ Reference Control="MyControl.ascx" %>
  • 59. Is it necessary to lock application state before accessing it?
    Only if you're performing a multistep update and want the update to be treated as an atomic     operation. Here's an example:
                    Application.Lock ();
                    Application["ItemsSold"] = (int) Application["ItemsSold"] + 1;
                    Application["ItemsLeft"] = (int) Application["ItemsLeft"] - 1;
                    Application.UnLock ();

  • By locking application state before updating it and unlocking it afterwards, you ensure  that another request being processed on another thread doesn't read application state   at exactly the wrong time and see an inconsistent view of it. If I update session state, should I lock it, too? Are concurrent accesses by multiple requests executing on multiple threads a concern with session state? Concurrent accesses aren't an issue with session state, for two reasons. One, it's unlikely that two requests from the same user will overlap. Two, if they do overlap, ASP.NET locks down session state during request processing so that two threads can't touch it at once. Session state is locked down when the HttpApplication instance that's processing the request fires an AcquireRequestState event and unlocked when it fires a ReleaseRequestState event.
  • Do ASP.NET forms authentication cookies provide any protection against replay attacks? Do they, for example, include the client's IP  address or anything else that would distinguish the real client from an attacker?
    No. If an authentication cookie is stolen, it can be used by an attacker. It's up to you to     prevent this from happening by using an encrypted communications channel (HTTPS). Authentication cookies issued as session cookies, do, however,include a time-out valid that     limits their lifetime. So a stolen session cookie can only be used in replay attacks as long as the ticket inside the cookie is valid. The default time-out interval is 30 minutes.You can change that by modifying the timeout attribute accompanying the <forms> element in Machine.config or a local Web.config file. Persistent authentication cookies do not  time-out and therefore are a more serious security threat if stolen.
  • 60. How do I send e-mail from an ASP.NET application?
            MailMessage message = new MailMessage ();
            message.From = <email>;
            message.To = <email>;
            message.Subject = "Scheduled Power Outage";
            message.Body = "Our servers will be down tonight.";
            SmtpMail.SmtpServer = "localhost";
            SmtpMail.Send (message);
  • MailMessage and SmtpMail are classes defined in the .NET Framework Class Library's  System.Web.Mail namespace. Due to a security change made to ASP.NET just before it shipped,  you need to set SmtpMail's SmtpServer property to "localhost" even though "localhost" is  the default. In addition, you must use the IIS configuration applet to enable localhost  ( to relay messages through the local SMTP service.
  • 61. What are VSDISCO files? VSDISCO files are DISCO files that support dynamic discovery of Web services. If you place the following VSDISCO file in a directory on your Web server, for example, it returns   references to all ASMX and DISCO files in the host directory and any subdirectories not noted in <exclude> elements:

  •              <?xml version="1.0" ?>
                      <exclude path="_vti_cnf" />
                      <exclude path="_vti_pvt" />
                      <exclude path="_vti_log" />
                      <exclude path="_vti_script" />
                      <exclude path="_vti_txt" />
  • 62. How does dynamic discovery work? ASP.NET maps the file name extension VSDISCO to an HTTP handler that scans the host  directory and subdirectories for ASMX and DISCO files and returns a dynamically generated DISCO document. A client who requests a VSDISCO file gets back what appears to be a static DISCO document.
    Note that VSDISCO files are disabled in the release version of ASP.NET. You can reenable them by uncommenting the line   in the <httpHandlers> section of Machine.config that maps *.vsdisco to System.Web.Services.Discovery.DiscoveryRequestHandler and granting the ASPNET  user account permission to read the IIS metabase. However, Microsoft is actively discouraging the use of VSDISCO files because they could represent a threat to Web server security.
    63. Is it possible to prevent a browser from caching an ASPX page? Just call SetNoStore on the HttpCachePolicy object exposed through the Response object's Cache property, as demonstrated here:

  •         <%@ Page Language="C#" %>
                  Response.Cache.SetNoStore ();
                  Response.Write (DateTime.Now.ToLongTimeString ());
  • SetNoStore works by returning a Cache-Control: private, no-store header in the HTTP response. In this example, it prevents caching of a Web page that shows the current time.
  • 64. What does AspCompat="true" mean and when should I use it?
    AspCompat is an aid in migrating ASP pages to ASPX pages. It defaults to false but should be set to true in any ASPX file that creates apartment-threaded COM objects--that is, COM objects registered ThreadingModel=Apartment. That includes all COM objects written with  Visual Basic 6.0. AspCompat should also be set to true (regardless of threading  model)  if the page creates COM objects that access intrinsic ASP objects such as Request and Response. The following directive sets AspCompat to true:
  • <%@ Page AspCompat="true" %> 
  • Setting AspCompat to true does two things. First, it makes intrinsic ASP objects available      to the COM components by placing unmanaged wrappers around the equivalent ASP.NET objects. Second, it improves the performance of calls that the page places to apartment- threaded COM objects by ensuring that the page (actually, the thread that processes the  request for the page) and the COM objects it creates share an apartment. AspCompat="true" forces ASP.NET request threads into single-threaded apartments (STAs). If those threads create COM objects marked ThreadingModel=Apartment, then the objects are created in the same STAs as the threads that created them. Without AspCompat="true," request threads run in a multithreaded apartment (MTA) and each call to an STA-based COM object incurs a performance hit when it's  marshaled across apartment boundaries.
  • Do not set AspCompat to true if your page uses no COM objects or if it uses COM objects that don't access ASP intrinsic objects and that are registered ThreadingModel=Free or  ThreadingModel=Both.
  • 65. Explain the differences between Server-side and Client-side code?
     Server side scripting means that all the script will be executed by the server and  interpreted as needed. ASP doesn't have some of the functionality like sockets, uploading,  etc. For these you have to make a custom components usually in VB or VC++. Client side  scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in  VBScript or JavaScript. Download time, browser compatibility, and visible code - since  JavaScript and VBScript code is included in the HTML page, then anyone can see the code by viewing the page source. Also a possible security hazards for the client computer.
  • 66. What type of code (server or client) is found in a Code-Behind class?
  • 67. Should validation (did the user enter a real date) occur server-side or client-side? Why?
    Client-side validation because there is no need to request a server side date when you  could obtain a date from the client machine.
  • 68. What are ASP.NET Web Forms? How is this technology different than what is available though ASP?
    Web Forms are the heart and soul of ASP.NET. Web Forms are the User Interface (UI) elements that give your Web applications their look and feel. Web Forms are similar to Windows Forms in that they provide properties, methods, and events for the controls that are placed onto  them. However, these UI elements render themselves in the appropriate markup language   required by the request, e.g. HTML. If you use Microsoft Visual Studio .NET, you will also get the familiar drag-and-drop interface used to create your UI for your Web application.
  • 69. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
    In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional   integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request  object. Sure, there are workarounds, but they're difficult. Finally, Response.Redirect  necessitates a round trip to the client, which, on high-volume sites, causes scalability problems.
    As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client.
  • 70. How can you provide an alternating color scheme in a Repeater control? AlternatingItemTemplate Like the ItemTemplate element, but rendered for every other row (alternating items) in the Repeater control. You can specify a different appearance for the AlternatingItemTemplate element by setting its style properties.
  • 71. Which template must you provide, in order to display data in a Repeater control?
  • 72. What event handlers can I include in Global.asax?
    Application_Start,Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed,  Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,
    Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache, Session_Start,Session_End
    You can optionally include "On" in any of method names. For example, you can name a BeginRequest event handler.Application_BeginRequest or Application_OnBeginRequest.You can also include event handlers in Global.asax for events fired by custom HTTP modules.Note that not all of the event handlers make sense for Web Services (they're designed for ASP.NET applications in general, whereas .NET XML Web Services are specialized instances of an ASP.NET app). For example, the Application_AuthenticateRequest and Application_AuthorizeRequest events are designed to be used with ASP.NET Forms authentication.
  • 73. What is different b/w  webconfig.xml & Machineconfig.xml
    Web.config & machine.config both are configuration files.Web.config contains settings specific to an application where as machine.config contains settings to a computer. The Configuration system first searches settings in machine.config file & then looks in application configuration  files.Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. There is only Machine.config file on a web server.
  • If I'm developing an application that must accomodate multiple security levels though secure login and my ASP.NET web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users?
    Use the state server or store the state in the database. This can be easily done through simple setting change in the web.config.
    sqlConnectionString="data source=; user id=sa; password="
  • You can specify mode as “stateserver” or “sqlserver”.
  • Where would you use an iHTTPModule, and what are the limitations of any approach you might take in implementing one
    "One of ASP.NET's most useful features is the extensibility of the HTTP pipeline, the path that data takes between client and server. You can use them to extend your ASP.NET applications by adding pre- and post-processing to each HTTP request coming into your application. For example, if you wanted custom authentication facilities for your application, the best technique would be to intercept the request when it comes in and process the request in a custom HTTP module.
  • 74. How do you turn off cookies for one page in your site?
    Since no Page Level directive is present, I am afraid that cant be done.
  • 75. How do you create a permanent cookie?
    Permanent cookies are available until a specified expiration date, and are stored on the hard disk.So Set the 'Expires' property any value greater than DataTime.MinValue with respect to the current datetime. If u want the cookie which never expires set its Expires property equal to DateTime.maxValue
  • Base class provides a base set of methods that all derived classes can use
    Explain assemblies.

    Answer 1:
    Assemblies are similar to dll files. Both has the reusable pieces of code in the form of classes/ functions. Dll needs to be registered but assemblies have its own metadata.

    Answer 2:
    Assembly is a single deployable unit that contains information about the implementation of classes, structures and interfaces. it also stores the information about itself called metadata and includes name and verison of the assembly, security information, information about the dependencies and the list of files that constitute the assembly.
    Assembly also contains namespaces. In the .Net Framework, applications are deployed in the form of assemblies.

    Answer 3:
    An assembly is a single deployable unit that contains all the information about the implementation of :
    - classes
    - structures and
    - interfaces
    An assembly stores all the information about itself. This information is called METADATA and include the name and the verison number of the assembly, security information, information about the dependencies and a lost of files that constitute the assembly.
    All the application developed using the .NET framework are made up of assemblies.
    Namespaces are also stored in assemblies

    Answer 4:
    In the Microsoft .NET framework an assembly is a partially compiled code library for use in deployment, versioning and security. In the Microsoft Windows implementation of .NET, an assembly is a PE (portable executable) file. There are two types, process assemblies (EXE) and library assemblies (DLL). A process assembly represents a process which will use classes defined in library assemblies. In version 1.1 of the CLR classes can only be exported from library assemblies; in version 2.0 this restriction is relaxed. The compiler will have a switch to determine if the assembly is a process or library and will set a flag in the PE file. .NET does not use the extension to determine if the file is a process or library. This means that a library may have either .dll or .exe as its extension.
    The code in an assembly is partially compiled into CIL, which is then fully compiled into machine language at runtime by the CLR.
    An assembly can consist of one or more files. Code files are called modules. An assembly can contain more than one code module and since it is possible to use different languages to create code modules this means that it is technically possible to use several different languages to create an assembly. In practice this rarely happens, principally because Visual Studio only allows developers to create assemblies that consist of a single code module.

    Name some of the languages .NET support?
    Some of the languages that are supported by .NET
    1. Visual Basic.NET
    2. Visual C#
    3. Visual C++

    ADO.NET features? Benefits? Drawbacks?
    Answer 1:
    1. Data will be retrieved through Datasets
    2. Scalability

    Answer 2:
    1. Disconnected Data Architecture
    2. Data cached in Datasets
    3. Data transfer in XML format
    4. Interaction with the database is done through data commands

    How many types of exception handlers are there in .NET?
    Answer 1:
    MSDN>gt; “How the Runtime Manages Exceptions”
    The exception information table represents four types of exception handlers for protected blocks:
    A finally handler that executes whenever the block exits, whether that occurs by normal control flow or by an unhandled exception.
    A fault handler that must execute if an exception occurs, but does not execute on completion of normal control flow.
    A type-filtered handler that handles any exception of a specified class or any of its derived classes.
    A user-filtered handler that runs user-specified code to determine whether the exception should be handled by the associated handler or should be passed to the next protected block.

    Answer 2:
    1. Unstructured Exception Handling
    2. Strutured Exception Handling

    Difference between Panel and GroupBox classes?
    Answer 1:
    Panel and Group box both can used as container for other controls like radio buttons and check box.
    the difference in panel and group box are Panel
    1) In case of panel captions cannot be displayed
    2) Can have scroll bars.

    Group box
    Captions can be displayed.
    2) Cannot have a scroll bar

    Answer 2:
    Panel is scrollable. In panel you can’t set caption like Group box.

    What is the base class of Button control?
    Listing from visual studio .net > Button Class

    What is Response object? How is it related to ASP’s Response object?
    Response object allows the server to communicate with the client(browser). It is useful for displaying information to the user (or) redirecting the client.
    Eg: Response.Write(”Hello World”)

    What is IIS? Have you used it?
    IIS - Internet Information Server
    IIS is used to access the ASP.Net web applications
    Yes, I used in ASP.NET web applications.

    Main differences between ASP and ASP.NET.
    Answer 1:
    1. ASP: Code is Interpreted
    SP.NET: Code is Compiled

    2. ASP: Business Logic and Presentation Logic are in a single file
    ASP.NET: Business Logic and Presentation Logic are in separate files (.cs or .vb) and (.aspx) respectively.

    3. ASP: No Web Server Controls
    ASP.NET: Web Server Controls supported by strong .NET Framework
    4. ASP: No RAD in Classic ASP
    ASP.NET: Supports RAD

    Answer 2:
    1.Asp is interpreted is compiled which is faster than asp.
    2 maintains its own CLR and is managed as it runs by CLR
    Where as asp is unmanaged
    3 We can mainatin sessions in state server and sql server which is Outproc,
    where in asp sessions will be last if we restart webserver or make changes.
    4 In we can configure each application using web.config file which is availble in application itself and we have machine.config wherer we can configure all applications.
    In asp we cannot configure single aplication
    5 we have autopostback event which is not in asp
    6 In we have global.asax where can hadle some global things which is not in asp.
    7 We have well built GUI to work in
    8 We have and as well as disconnected architecture in
    9 We have Xcopy deployment in
    10. We can work with any language as code behind technique in that supports .net frame work

    Answer 3:
    a) is compiled but ASP is a interpretor or script only.
    b) is supported more control then the asp.
    c) is more supported even control then the asp.
    d) In if update any component then no need to shutdown the computer but in asp if loaded any component then need tobe shutdown the computer.
    d) So lastly an is faster then asp

    What are the advantages and drawbacks of using ADO.NET?
    ADO.NET is rich with plenty of features that are bound to impress even the most skeptical of programmers. If this weren’t the case, Microsoft wouldn’t even be able to get anyone to use the Beta. What we’ve done here is come up with a short list of some of the more outstanding benefits to using the ADO.NET architecture and the System.Data namespace.

    * Performance – there is no doubt that ADO.NET is extremely fast. The actual figures vary depending on who performed the test and which benchmark was being used, but ADO.NET performs much, much faster at the same tasks than its predecessor, ADO. Some of the reasons why ADO.NET is faster than ADO are discussed in the ADO versus ADO.NET section later in this chapter.

    * Optimized SQL Provider – in addition to performing well under general circumstances, ADO.NET includes a SQL Server Data Provider that is highly optimized for interaction with SQL Server. It uses SQL Server’s own TDS (Tabular Data Stream) format for exchanging information. Without question, your SQL Server 7 and above data access operations will run blazingly fast utilizing this optimized Data Provider.

    * XML Support (and Reliance) – everything you do in ADO.NET at some point will boil down to the use of XML. In fact, many of the classes in ADO.NET, such as the DataSet, are so intertwined with XML that they simply cannot exist or function without utilizing the technology. You’ll see later when we compare and contrast the “old” and the “new” why the reliance on XML for internal storage provides many, many advantages, both to the framework and to the programmer utilizing the class library.

    * Disconnected Operation Model – the core ADO.NET class, the DataSet, operates in an entirely disconnected fashion. This may be new to some programmers, but it is a remarkably efficient and scalable architecture. Because the disconnected model allows for the DataSet class to be unaware of the origin of its data, an unlimited number of supported data sources can be plugged into code without any hassle in the future.

    * Rich Object Model – the entire ADO.NET architecture is built on a hierarchy of class inheritance and interface implementation. Once you start looking for things you need within this namespace, you’ll find that the logical inheritance of features and base class support makes the entire system extremely easy to use, and very customizable to suit your own needs. It is just another example of how everything in the .NET framework is pushing toward a trend of strong application design and strong OOP implementations.

    Hard as it may be to believe, there are a couple of drawbacks or disadvantages to using the ADO.NET architecture. I’m sure others can find many more faults than we list here, but we decided to stick with a short list of some of the more obvious and important shortcomings of the technology.
    * Managed-Only Access – for a few obvious reasons, and some far more technical, you cannot utilize the ADO.NET architecture from anything but managed code. This means that there is no COM interoperability allowed for ADO.NET. Therefore, in order to take advantage of the advanced SQL Server Data Provider and any other feature like DataSets, XML internal data storage, etc, your code must be running under the CLR.

    * Only Three Managed Data Providers (so far) – unfortunately, if you need to access any data that requires a driver that cannot be used through either an OLEDB provider or the SQL Server Data Provider, then you may be out of luck. However, the good news is that the OLEDB provider for ODBC is available for download from Microsoft. At that point the down-side becomes one of performance, in which you are invoking multiple layers of abstraction as well as crossing the COM InterOp gap, incurring some initial overhead as well.

    * Learning Curve – despite the misleading name, ADO.NET is not simply a new version of ADO, nor should it even be considered a direct successor. ADO.NET should be thought of more as the data access class library for use with the .NET framework. The difficulty in learning to use ADO.NET to its fullest is that a lot of it does seem familiar. It is this that causes some common pitfalls. Programmers need to learn that even though some syntax may appear the same, there is actually a considerable amount of difference in the internal workings of many classes. For example (this will be discussed in far more detail later), an ADO.NET DataSet is nothing at all like a disconnected ADO RecordSet. Some may consider a learning curve a drawback, but I consider learning curves more like scheduling issues. There’s a learning curve in learning anything new; it’s just up to you to schedule that curve into your time so that you can learn the new technology at a pace that fits your schedule.

    Why The JavaScript Validation Not Run on the Asp.Net Button But Run SuccessFully On The HTML Button
    The Asp.Net Button Is post backed on the server & not yet Submit & when It goes to the server its states is lost So if we r using javascript in our application so we always use the Input Button in the asp Button

    what is the difference between user control an custom control? advantages/disadvantages?
    Web user controls Vs Web custom controls
    Easier to create Vs Harder to create
    Limited support for consumers who use a visual design tool Vs Full visual design tool support for consumers
    A separate copy of the control is required in each application Vs Only a single copy of the control is required, in the global assembly cache
    Cannot be added to the Toolbox in Visual Studio Vs Can be added to the Toolbox in Visual Studio
    Good for static layout Vs Good for dynamic layout

    What’s the difference between Response.Write() andResponse.Output.Write()?
    Response.Output.Write() allows you to write formatted output

    What is the use of ErrorProvider Control?
    The ErrorProvider control is used to indicate invalid data on a data entry form. Using this control, you can attach error messages that display next to the control when the data is invalid, as seen in the following image. A red circle with an exclamation point blinks, and when the user mouses over the icon, the error message is displayed as a tooltip.

    What is CLR?
    Answer 1:
    CLR(Common Language Runtime) is the main resource of .Net Framework. it is collection of services like garbage collector, exception handler, jit compilers etc. with the CLR cross language integration is possible.

    Answer 2:
    The .NET Framework provides a runtime environment which runs the code and provides services that make the development process easier. This runtime environment in .NET Framework is known as Common Language Runtime (CLR). The CLR sits at the very heart of managed code. Common Language Runtime is the generalized multi-language, reflective execution engine on which code originally written in various languages runs. At a higher level, CLR is simply an engine that takes in Intermediate Language (IL) instructions, translates them into machine instructions, and executes them. Although the common language runtime provides many standard runtime services, managed code is never interpreted. A feature called just-in-time (JIT) compiling enables all managed code to run in the native machine language of the system on which it is executing. The CLR shares much in common with a traditional operating system.

    Managed code is the term used for any code that is running on .NET Framework.

    The CLR provides the infrastructure that enables managed code to execute as well provides variety of services during execution. When a method, for which IL has been generated, is called for the first time the CLR compiles the IL into native code that is specific to the processor the Environment it is running on (This process is known as Just in Time Compilation or JIT). If the same method is called next time, the existing JIT compiled code is reused. During execution managed code receives variety of services from the runtime environment.

    When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. Intermediate Language is a binary assembly language that is compiled at runtime down to whatever machine language is appropriate for the host CPU. This runtime compilation is called Just-In-Time Compiling or JIT-compiling.

    Advantages of Managed Execution Environments
    In unmanaged environments the compiler and linker directly compile the source code in to native instructions that are targeted at a specific processor. The disadvantage of this process is that each time you want to run your executable on a different platform you will have to re-compile the code using a compiler and linker that will compile the code that is targeted at the specific hardware. This means that each time you want your application to run on a different platform, you will have to ship the compiled instructions again and again. As this leads to compiling and maintaining multiple versions of the same application, the companies try to create a more generalized compiled version in order to target most of the environments. This process is known as the Lowest Common Denominator approach. This leads to a more generalized program which is not optimized properly and does not take advantages of the underlying hardware infrastructure (processor, cache, etc). Because the CLR supplies one or more Just in Time Compiler for each computer architecture it supports, the same set of MSIL can be JIT-compiled and run on any supported architecture. This

    CLR provides the following benefits for developers:
    Vastly simplified development.
    Seamless integration of code written in various languages.
    Evidence-based security with code identity.
    Assembly-based deployment that eliminates DLL Hell.
    Side-by-side versioning of reusable components.
    Code reuse through implementation inheritance.
    Automatic object lifetime management.
    Code access security.
    Cross Language Integration.
    Self describing objects.

    The CLR automatically handles object layout and manages references to objects, releasing them when they are no longer being used. This automatic memory management resolves the two most common application errors, memory leaks and invalid memory references. This process is known as Garbage Collection. The CLR also manages thread execution, code execution, code safety verification, compilation, and other system services.

    The CLR is designed for the software of the future, and it also supports software of today and yesterday. Interoperability between managed and unmanaged code provided by CLR helps developers continue to use necessary COM components and DLLs.

    What is Delegate and what is it used for ?
    Delegate is kinda like a pointer to a function in C++ or like an event handler in Java
    You can use it to “multicast” which means running multiple functions in different instances of object already created.
    This is useful when you want your objects to “register” to an event raised by another object.
    The way it works is the object you are registered to listen to recieves the delegate of the function it is supposed to run in your object, the delegate is then run from it. (if you switch the word delegate for pointer, this would be much simpler)

    How is meant by DLL ?
    A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. Basically it’s an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library.

    Which DLL translate XML to SQL in IIS?

    Can anyone tell me about Secure Socket Layer? How to make use of the technology?
    Secure Sockets Layer (SSL) and Transport Layer Security (TLS), its successor, are cryptographic protocols which provide secure communications on the Internet. There are slight differences between SSL 3.0 and TLS 1.0, but the protocol remains substantially the same. The term “SSL” as used here applies to both protocols unless clarified by context.

    What is the Differnce Between Response.write & response.output.

    In ASP.NET the Response object is of type HttpResponse and when you say Response.Write you’re really saying (basically) HttpContext.Current.Response.Write and calling one of the many overloaded Write methods of HttpResponse.
    Response.Write then calls .Write() on it’s internal TextWriter object:
    public void Write(object obj){ this._writer.Write(obj);}
    HttpResponse also has a Property called Output that is of type, yes, TextWriter, so:
    public TextWriter get_Output(){ return this._writer; }

    Which means you can to the Response whatever a TextWriter will let you. Now, TextWriters support a Write() method ala String.Format, so you can do this:
    Response.Output.Write(”Scott is {0} at {1:d}”, “cool”,DateTime.Now);
    But internally, of course, this this is happening:
    public virtual void Write(string format, params object[] arg)
    this.Write(string.Format(format, arg));

    Which dll is required to translate XML to SQL in IIS ?

    What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why.
    In a interface class, all methods are abstract without implementation where as in an abstract class some methods we can define concrete. In interface, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers. Interface and abstract class are basically a set of rules which u have to follow in case u r using them(inheriting them).

    Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class. A class that is derived from an abstract class may still implement interfaces. Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed. They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code.

    Abstract Classes
    An abstract class is the one that is not used to create objects. An abstract class is designed to act as a base class (to be inherited by other classes). Abstract class is a design concept in program development and provides a base upon which other classes are built. Abstract classes are similar to interfaces. After declaring an abstract class, it cannot be instantiated on it’s own, it must be inherited. Like interfaces, abstract classes can specify members that must be implemented in inheriting classes. Unlike interfaces, a class can inherit only one abstract class. Abstract classes can only specify members that should be implemented by all inheriting classes.

    An interface looks like a class, but has no implementation. They’re great for putting together plug-n-play like architectures where components can be interchanged at will. Think Firefox Plug-in extension implementation. If you need to change your design, make it an interface. However, you may have abstract classes that provide some default behavior. Abstract classes are excellent candidates inside of application frameworks.

    One additional key difference between interfaces and abstract classes (possibly the most important one) is that multiple interfaces can be implemented by a class, but only one abstract class can be inherited by any single class.

    Some background on this: C++ supports multiple inheritance, but C# does not. Multiple inheritance in C++ has always be controversial, because the resolution of multiple inherited implementations of the same method from different base classes is hard to control and anticipate. C# decided to avoid this problem by allowing a class to implement multiple interfaces, which do not contain method implementations, but restricting a class to have at most a single parent class. Although this can result in redundant implementations of the same method when different classes implement the same interface, it is still an excellent compromise.

    Another difference between interfaces and abstract classes is that an interface can be implemented by an abstract class, but no class, abstract or otherwise, can be inherited by an interface.

    What is an Abstract class?
    An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

    What is an Interface?
    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, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. 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.

    What is serialization, how it works in .NET?
    Serialization is when you persist the state of an object to a storage medium so an exact copy can be re-created at a later stage.
    Serialization is used to save session state in ASP.NET.
    Serialization is to copy objects to the Clipboard in Windows Forms
    Serialization is used by remoting to pass objects by value from one application domain to another

    What should one do to make class serializable?
    To make a class serializable is to mark it with the Serializable attribute as follows.
    public class MyObject {
    public int n1 = 0;
    public int n2 = 0;
    public String str = null;

    What exactly is being serialized when you perform serialization?
    The object’s state (values)

    How does output caching work in ASP.NET?
    Output caching is a powerful technique that increases request/response throughput by caching the content generated from dynamic pages. Output caching is enabled by default, but output from any given response is not cached unless explicit action is taken to make the response cacheable.
    To make a response eligible for output caching, it must have a valid expiration/validation policy and public cache visibility. This can be done using either the low-level OutputCache API or the high-level @ OutputCache directive. When output caching is enabled, an output cache entry is created on the first GET request to the page. Subsequent GET or HEAD requests are served from the output cache entry until the cached request expires.
    The output cache also supports variations of cached GET or POST name/value pairs.
    The output cache respects the expiration and validation policies for pages. If a page is in the output cache and has been marked with an expiration policy that indicates that the page expires 60 minutes from the time it is cached, the page is removed from the output cache after 60 minutes. If another request is received after that time, the page code is executed and the page can be cached again. This type of expiration policy is called absolute expiration - a page is valid until a certain time.

    What is connection pooling and how do you make your application use it?
    Opening database connection is a time consuming operation.
    Connection pooling increases the performance of the applications by reusing the active database connections instead of create new connection for every request.
    Connection pooling Behaviour is controlled by the connection string parameters.
    Follwing the the 4 parameters that control most of the connection pooling behaviour.
    1. Connect Timeout
    2. Max Pool Size
    3. Min Pool Size
    4. Pooling

    What are different methods of session maintenance in ASP.NET?
    3 types:
    In-process storage.
    Session State Service.
    Microsoft SQL Server.

    In-Process Storage
    The default location for session state storage is in the ASP.NET process itself.

    Session State Service
    As an alternative to using in-process storage for session state, ASP.NET provides the ASP.NET State Service. The State Service gives you an out-of-process alternative for storing session state that is not tied quite so closely to ASP.NET’s own process.

    To use the State Service, you need to edit the sessionState element in your ASP.NET application’s web.config file:

    You’ll also need to start the ASP.NET State Service on the computer that you specified in the stateConnectionString attribute. The .NET Framework installs this service, but by default it’s set to manual startup. If you’re going to depend on it for storing session state, you’ll want to change that to automatic startup by using the Services MMC plug-in in the Administrative Tools group.

    If you make these changes, and then repeat the previous set of steps, you’ll see slightly different behavior: session state persists even if you recycle the ASP.NET process.

    There are two main advantages to using the State Service. First, it is not running in the same process as ASP.NET, so a crash of ASP.NET will not destroy session information. Second, the stateConnectionString that’s used to locate the State Service includes the TCP/IP address of the service, which need not be running on the same computer as ASP.NET. This allows you to share state information across a web garden (multiple processors on the same computer) or even across a web farm (multiple servers running the application). With the default in-process storage, you can’t share state information between multiple instances of your application.

    The major disadvantage of using the State Service is that it’s an external process, rather than part of ASP.NET. That means that reading and writing session state is slower than it would be if you kept the state in-process. And, of course, it’s one more process that you need to manage. As an example of the extra effort that this can entail, there is a bug in the initial release of the State Service that allows a determined attacker to crash the ASP.NET process remotely. If you’re using the State Service to store session state, you should install the patch from Microsoft Security Bulletin MS02-66, or install SP2 for the .NET Framework.

    Microsoft SQL Server
    The final choice for storing state information is to save it in a Microsoft SQL Server database. To use SQL Server for storing session state, you need to perform several setup steps:

    Run the InstallSqlState.sql script on the Microsoft SQL Server where you intend to store session state. This script will create the necessary database and database objects. The .NET Framework installs this script in the same folder as its compilers and other tools–for example, C:\WINNT\Microsoft.NET\Framework\v1.0.3705 on a Windows 2000 computer with the 1.0 version of the Framework. Edit the sessionState element in the web.config file for your ASP.NET application as follows:

    Supply the server name, user name, and password for a SQL Server account that has access to the session state database in the sqlConnectionString attribute.

    Like the State Service, SQL Server lets you share session state among the processors in a web garden or the servers in a web farm. But you also get the additional benefit of persistent storage. Even if the computer hosting SQL Server crashes and is restarted, the session state information will still be present in the database, and will be available as soon as the database is running again. That’s because SQL Server, being an industrial-strength database, is designed to log its operations and protect your data at (almost) all costs. If you’re willing to invest in SQL Server clustering, you can keep the session state data available transparently to ASP.NET even if the primary SQL Server computer crashes.

    Like the State Service, SQL Server is slower than keeping session state in process. You also need to pay additional licensing fees to use SQL Server for session state in a production application. And, of course, you need to worry about SQL Server-specific threats such as the “Slammer” worm.

    What is Viewstate?
    A server control’s view state is the accumulation of all its property values. In order to preserve these values across HTTP requests, ASP.NET server controls use this property, which is an instance of the StateBag class, to store the property values.

    Can any object be stored in a Viewstate?
    An object that either is serializable or has a TypeConverter defined for it can be persisted in ViewState

    What should you do to store an object in a Viewstate?
    Do serialization of convert the object to string

    Explain how Viewstate is being formed and how it’s stored on client.

    The type of ViewState is System.Web.UI.StateBag, which is a dictionary that stores name/value pairs. ViewState is persisted to a string variable by the ASP.NET page framework and sent to the client and back as a hidden variable. Upon postback, the page framework parses the input string from the hidden variable and populates the ViewState property of each control. If a control uses ViewState for property data instead of a private field, that property automatically will be persisted across round trips to the client. (If a property is not persisted in ViewState, it is good practice to return its default value on postback.)

    What do you know about ADO.NET’s objects and methods?
    ADO.NET provides consistent access to data sources such as Microsoft SQL Server, as well as data sources exposed through OLE DB and XML.
    Data-sharing consumer applications can use ADO.NET to connect to these different data sources and retrieve, manipulate, and update data.
    ADO.NET provides first-class support for the disconnected, n-tier programming environment for which many new applications are written.

    Explain DataSet.AcceptChanges and DataAdapter.Update methods.
    DataAdapter.Update method Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet.
    DataSet.AcceptChanges method Commits all the changes made to this row since the last time AcceptChanges was called.

    When we go for html server controls and when we go for web server controls?
    Server controls are a part of When a server control is used there will be an extra overhead on the server to create the control at runtime and accordingly set the values. HTML controls are static controls and are easy to use. They are supported is
    As a rule, if there is a correspoding HTML control available instead of the server control, you should always go for the HTML control as it enhances the server performance and ensures faster response. Server controls should be used when it is found that the available HTML controls are not sufficient to achieve the task


  • dynamic content on web pages. For example you could write code that would give your visitors different information, different images or even a totally different page depending on what browser version they are using.

    How can you disable the browser to view the code?

    Writing codes within the Tag

    Question What is a "Virtual Directory"?

    Virtual directories are aliases for directory paths on the server. It allows moving files on the disk between different folders, drives or even servers without changing the structure of web pages. It avoids typing an extremely long URL each time to access an ASP page.

    Give the comment Tags for the following?

    VBScript : REM & ‘(apostrophe)
    JavaScript : // (single line comment)
    /* */ (Multi-line comments)

    Which is the default Scripting Language of ASP (server-side)?


    Which is the default Data types in VBScript?

    Variant is the default data type in VBScript, which can store a value of any type.

    What is a variable?

    Variable is a memory location through which the actual values are stored/retrieved. Its value can be changed.

    What is the maximum size of an array?

    Up to 60 dimensions.

    What is Querystring collection?

    This collection stores any values that are provided in the URL. This can be generated by three methods:
    By clicking on an anchor tag
    By sending a form to the server by the GET method
    Through user-typed HTTP address
    It allows you to extract data sent to the server using a GET request.

    What are the attributes of the tags? What are their functions?

    The two attributes are ACTION and METHOD
    The ACTION gives the name of the ASP file that should be opened next by which this file can access the information given in the form The METHOD determines which of the two ways (POST or GET) the browser can send the information to the server

    What are the methods in Session Object?

    The Session Object has only one method, which is Abandon. It destroys all the objects stored in a Session Object and releases the server resources they occupied.

    What is ServerVariables collection?

    The ServerVariables collection holds the entire HTTP headers and also additional items of information about the server.

    What is the difference between Querystring collection and Form collection?

    The main difference is that the Querystring collection gets appended to a URL.

    What is a Form collection?
    The Form collection holds the values of the form elements submitted with the POST method. This is the only way to generate a Form collection.

    What are the ASP Scripting Objects?

    The Dictionary object, the FileSystemObject object, TextStream object.

    What happens to a HTML page?

    The browser makes a HTTP request; the server gives a HTTP response to the browser and the browser converts into a HTML page.

    What happens to ASP pages?

    The browser makes a HTTP request; the server does the processing and gives a HTML response to the browser.

    How can you change the primary scripting language for a page?


    What is application Object?

    Shares information among users of an application. Gives a notification when an application starts or ends.

    What is the difference between client-side script and server-side script?

    Scripts executed only by the browser without contacting the server is called client-side script. It is browser dependent. The scripting code is visible to the user and hence not secure. Scripts executed by the web server and processed by the server is called server-side script.

    What is the command to display characters to the HTML page?


    Explain the POST & GET Method or Explain the difference between them?

    The POST method generates a FORM collection, which is sent as a HTTP request body. All the values typed in the form will be stored in the FORM collection.
    The GET method sends information by appending it to the URL (with a question mark) and stored as A Querystring collection. The Querystring collection is passed to the server as name/value pair.
    The length of the URL should be less than 255 characters.

    How many global.asa files can an Application have?

    Only one global.asa file and it’s placed in the virtual directory’s root.

    How many global.asa files can an Application have?

    Only one global.asa file and it’s placed in the virtual directory’s root.

    What are Scripting Objects?

    Objects that can enhance the application are known as the Scripting Objects


  • What is an Err Object?
    Name it’s properties and methods.

    What are LOCAL and GLOBAL variables?

    Local variables lifetime ends when the Procedure ends. Global variables lifetime begins at the start of the script and ends at the end of the script and it can be used by any procedure within the script. Declaring a variable by using the keyword PRIVATE makes the variable global within the script, but if declared using PUBLIC, then all scripts can refer the variable.

    Which is the default Scripting Language on the client side?


    What is HTML(Hypertext Markup Language)?

    It’s a method by which web pages can be built and generally used for formatting and linking text.

    What is a Web Server?

    It’s a Computer that provides Web services on the Internet or on a local Intranet. It is designed to locate, address and send out simple HTML pages to all other users who access these pages.

    What is Session Object?

    It stores information about a User’s session. Gives a notification when a user session begins or ends.

    What is Server-Side includes?

    It provides extra information by which it makes the site easier to manage. It can include text files using the #include statement, retrieve the size and last modification date of a file, defines how variables and error messages are displayed and inserts the values of HTTP variables in the page sent back to the browser.

    What is a FileSystemObject object?

    It provides access to the physical file system of the web server. It gets and manipulates information about all drives in a server, folders and sub-folders on a drive and files inside a folder.

    What is a Scripting Language?

    It permits to create more interactive Web Pages. Validation, formatting of web pages can be done. VBScript, JavaScript are some examples.

    What is a Dictionary object?

    It lets you store and retrieve information in a flexible data structure. Each value or information stored in a Dictionary is associated with a key through which the information can be retrieved.

    What is Global.asa file?

    It is text file that contains details about an ASP application, such as when it should begin and end.

    What is an .ASP file?

    It is a Text File that contains the combination of the following:
    HTML tags
    Script Commands

    What is Response Object?

    It controls the information sent to the user. The various methods are:
    Response.Write - Sends information directly to a browser
    Response.Redirect - Directs a user to a URL other than the requested URL
    Response.ContentType - Controls the type of content sent
    Response.Cookies - Sets cookie values
    Response.Buffer - To Buffer information

    Naming constraints for a variable ?

    It can be up to 255 characters Must start with an alphabet Must not contain an embedded period or full-stop

    What is a TextStream object?

    It allows you to access(read/write) the contents of text files stored on the web server.

    What is IIS?

    IIS is a Web Server that provides Web services, not only for web pages but also for ftp sites and video and audio services. It integrates with the database facilities of SQL Server.

    What is Request Object?

    Gets information from the user. It has five collections by which values can be accessed. They are: Querystring, Form, Cookies, Server Variables & ClientCertificate

    What are the special sub-types in VBScript?

    EMPTY: has no value
    NULL: Value does not exist (conjunction with database)

    What is Cookies collection?

    Cookies are text files that store information about the user by which the web server identifies and marks each different visitor to a web site and determines where a user has been before. A cookie can store information only when the user sends it. Individual cookies are limited to 4KB of data. The maximum number of cookies allowed is 300.
    Cookies are stored on client’s machine.

    What is the difference between Cookies collection and Form/Querystring collection?

    Cookie collection does not have the Count property. Cookies can have multiple values for the same cookie name but each value can be referred using a key whereas in a Form/Querystring cookie each value has to be referred using an index value.

    What is Server Object?

    Controls the ASP execution environment. It can set the amount of time script can run before an error occurs. Converts a virtual path to a physical path on the server. Takes a user supplied string and encode it into proper format for a URL string.

    What is Collection?

    Collection is a set of name/value pairs where the information supplied by the client is stored.

    How will you delete a Cookie?

    By setting its Expires property to any date prior to today Response.Cookies("cookie name"). Expires = Date 1


  • How are scripts executed?
    ASP provides scripting engines that execute the corresponding scripting languages on the server side. Scripts should be encoded within the Delimiters.

    What is ASP (Active Server Pages)?

    ASP is a server side-scripting environment for building dynamic and interactive web pages. Since the scripts run on the server side, the web server does all the processing.

    What are ARRAYS?

    Arrays are variables that store items of similar information.DIM ARRAY1(4) (declares an array with the name array1 with 5 elements)

    What is Application-scope?

    Application-scope means that variables (and objects) can be accessed from any ASP pages that is part of the application.

    What is Extranet?

    An area of a web site available only to a set of registered visitors.

    What is a session?

    A user accessing an application is known as a session.

    What is ClientCertificate collection?

    A ClientCertificate is an encrypted number that is stored in a file on the user’s computer. This stores details of any security certificates included with the request.

    What do you need to run ASP?

    A browser and a Web server

    What is the order of execution for an ASP application?

    1) Global.asa
    2) Server-side Includes
    3) Jscript scripts tagged within

    What are the types of HTML?

    Static HTML Browser uses HTTP to request HTML file from the Web Server
    Dynamic HTML Browser uses HTTP to request an executable application rather than a Static HTML file

    What are the properties of Session Object?

    SessionID returns the session identification number for each user.
    Timeout sets the timeout period assigned to the Session object for any application, in minutes.
    CodePage determines the code page that will be used to display content.
    LCID a locale identifier, which determines time zone and language, rules for the system

    What are the event handlers of Session Object?

    Session _OnStart This event will be fired when a new user begins a session with the web site.
    Session_OnEnd This event is called whenever a session terminates.

    Name the ASP Objects?

    Request Object
    Response Object
    Server Object
    Session Object
    Application Object

    What are the advantages of using ASP?

    Minimizes network traffic by limiting the need for the browser and server to talk to each other
    Makes for quicker loading time since HTML pages are only downloaded
    Allows to run programs in languages that are not supported by the browser
    Can provide the client with data that does not reside on the client’s machine
    Provides improved security measures since the script cannot be viewed by the browser

    What are the methods in Application Object?

    Lock prevents clients from modifying the variables stored in the Application object.
    Unlock removes the lock from variables stored in the Application object.

    What are the methods in Application Object?

    Internet Information Server (IIS) on Windows NT
    Personal Web Server (PWS) on Windows 95
    Peer Web Services on Windows NT

    What are the browsers that can access ASP pages?

    Internet Explorer (supports VBScript, JavaScript)
    Netscape Communicator/ Navigator (supports only JavaScript, VBScript can be also added too)

    What are the methods by which output stream is controlled?

    Flush sends previous buffered output to the client immediately, but continues processing the script.
    Clear erases any already-buffered HTML.
    End causes the server to stop processing the script.

    What are the methods by which output stream is controlled?

    What are the properties used to control the expiration of the page?
    Expires specifies the number of minutes before a page cached on a browser expires.
    ExpiresAbsolute sets the date and time at which a page cached on a browser expires.


  • tag.
    Static collection contains all the objects created

    What is the difference between ASP and HTML? Or Why ASP is better than HTML?

    - ASP executes code on the server side whereas the browser interprets HTML.
    - ASP can use any scripting languages
    - Gets feedback from the user and return information to the user
    - Create pages that will be customized to display only things that will be of interest to a particular user
    - Can edit contents of a web page by updating a text file or a database rather than the HTML code itself

    What are the event handlers of Application Object?

    Application_OnStart- This event will be fired when the first visitor hits the page.
    Application_OnEnd- This event runs when the server is stopped.

    Name some of the ASP components?

    Ad Rotator component- a way to manage advertisements on the web site.
    Content Linker component - a technique to direct users through a set of pages on a web site by creating a list of URLs and description of the next and previous pages.
    Browser Capabilities component - allows to customize the page to the ability of the browser viewing it.
    Database Access component - allows to access data from the database

    What are the tasks performed by &lt;&gt; tags?

    tags provides space for the user to input values
    the form has a button to submit information back to the server
    It transfers control to another ASP page
    It carries the information in the fields to another ASP page

    What are the tags necessary to be present within the tag ?

    -----tag: Provides input spaces (text boxes, combo boxes, radio button, etc.) on a form called fields. It has three attributes TYPE, NAME and VALUE. TYPE provides the characteristics of the field and the NAME specifies a name to the field by which it can be referred.

    What are the collections of Application Object?

    * Contents collection - contains all variables added via scripts in global.asa.
    * Static collection - contains the names of all objects

    How do you create a recordset object in VBScript?

    //First of all declare a variable to hold the Recordset object, ex-
    Dim objRs
    //Now, Create this varible as a Recordset object, ex-
    Set objRs=Server.CreateObject(ADODB.RECORDSET)
    ” rs.MoveNext
    end if
    *. Create Recordset object
    *. Place form field value in a variable named “param”
    *. Define query by concatenating strings and variable value
    *. Open RecordSet Object. Note that the first parameter is the Command Text. The second parameter is the Connection String. The Command Object and Connection Object are created implicitly.
    *. Make sure the RecordSet isn’t empty
    *. Begin executing a loop which goes through all records in the RecordSet.
    *. Write each record’s “firstname” and “lastname” fields to the page on a separate line.
    *. Move to Next Record.

    Explain the difference between POST and GET Method.

    GET requests are string data that is visible to the end user via the URL and a limit of 2kb, POST requests have no limit on total data and the user can’t see the data in a query string.

    Why do we use Option Explicit?

    To avoid multiple variables of the same name.
    Correct answer is - This statement force the declaration of variables in VB before using them.

    How do you write an SQL insert statement?

    insert into tablename (fieldA, fieldB, fieldC)Values(’dataA’, ‘dataB’, ‘dataC’);

    How can you have different number of cells for each row of a table in HTML?

    using colspan and rowspan

    What variable can you use to share info across the whole application for one user?

    Use the sessions object

    What is string concatenation function in VBScript?

    the ampersand symbol and ampersand space underscore across multiple lines

    How do you get the value of a combo box in Javascript?


    What is a class in CSS?

    A class allows you to define different style characteristics to the same HTML element.
    class is a child to the id, id should be used only once, a css class can be used multiple times:
    div id=”banner”
    p class=”alert”

    When inserting strings into a SQL table in ASP what is the risk and how can you prevent it?

    SQL Injection, to prevent you probably need to use Stored Procedures instead of inline/incode SQL

    Which is the default Data types in VBScript?
By Raman Katwal   Popularity  (17013 Views)