.net interview questions 1.

1

Explain dotnet framework ? The dot net Framework has two main components CLR and .NET Libraries. CLR (common language runtimes), that actually runs the code manages so many things for example code execution, garbage collection, memory allocation, thread management etc. Apart from CLR, the .NET framework contains .NET libraries, which are collection of namespaces and classes. The classes and namespaces are kept in a systematic way and can be used in making any application, code reusability etc. The root namespace of .NET framework is System, with this namespace many namespaces like web (system.web), data (system.data), windows (system.windows) are generated which can be further have their namespaces. 2. What is the difference between Metadata and Menifest ? Manifest describes the assembly itself. Assembly name, version number, culture information. strong name, list of all files, type reference and reference assembly. While the Metadata describes the contents within the assembly. like classes, interfaces, namespaces, base class, scope, properties and their parameters etc. 3. What are public and private assemblies ? differences and scope ? Public assembly are the dll/exe file that can be used in different application. The main advantage of public assemblies is code reusability. These can be used in different machine on different computers. These are also called as shared assemblies. Private assembly is the assembelyinfo.cs or assembelyinfo.vb file within an application. An application must have one private assembly, outside this application there is no scope of private assembly. 4. What is an Assembly ? Assemblies are the fundamental building block of .NET framework. They contains the type and resources that are useful to make an application. Assembly enables code reuse, version control, security and deployment. An assembly can have four parts : Manifest, Type metadata, MSIL and Resource file 5. What is GAC ? GAC (global assemble cache) Its an space (directory C:\winnt\assembely) on the server where all the shared assemblies are registered and that can be used in the application for code reuse. 6. What do you know about Machine.Config file ? Its a base configuration file for all .NET assemblies running on the server. It specifies settings that are global to a particular machine. 7. Different types of authentication modes in .NET Framework? Windows, Forms, Passport and None. 8. What is Strong name? Strong name ensures the uniqueness of assembly on the server. A strong name includes information about Assembly version, Public/Private Key token, Culture information and Assembly name. 9. Where does the GAC exist? By default C:\\assembely e.g c:\winnt\assembely or c:\windows\assembely 10. What are different types that a variable can be defined and their scopes? Public- Can be accessed anywhere Private- anywhere in the same class Protected -within the class and the class that inherits this class Friend- Members of the class within the assembly Protected friend- member of assembly or inheriting class 11. What is DLL HELL? Previously (when using VB) we can have a situation that we have to put same name dll file in a single directory, but the dlls are of different versions. This is known as dll hell. 12. What is COM, COM+ and DCOM? COM (Component Object Model) A standard that is used to for communication between OS and the software. COM is used to create reusable software components

.net interview questions
COM+ : COM+ is an extension of Component Object Model (COM). COM+ is both an OOP architecture and a set of operating system services. DCOM an extension of the Component Object Model (COM) that allows COM components to communicate across network boundaries. Traditional COM components can only perform interprocess communication across process boundaries on the same machine. DCOM uses the RPC mechanism to transparently send and receive information between COM components (i.e., clients and servers) on the same network.

2

13. What is boxing and unboxing ? Implicit (manual) conversion of value type to reference type of a variable is known as BOXING, for example integer to object type conversion. Conversion of Boxed type variable back to value type is called as UnBoxing. 14. what is connected and disconnected database ? Connected and disconnected database basically the approach that how you handle the database connection, It may be connected that once the application starts you have to open the connection only for a single time and then performs many transactions and close the connection just before exit the application. This approach will be generally used in windows based application. On other hand disconnected architecter refere to open and close the connection for each time while performing a transactio. 15. What is garbage collection and how it works ? Garbage Collection is Automatic Memory Manager for the dotnet framework. It manages the momery allocated to the .NET framework. CLR takes cares about .NET framework. When a variable is defined, Its gets a space in the memory and when the program control comes out of that function the scope of variable gets ended, so the garbage collection acts on and memory will releases. What Is Unmanaged Code? Unmanaged code is what you use to make before Visual Studio .NET 2002 was released. Visual Basic 6, Visual C++ 6, heck, even that 15-year old C compiler you may still have kicking around on your hard drive all produced unmanaged code. It compiled directly to machine code that ran on the machine where you compiled it—and on other machines as long as they had the same chip, or nearly the same. It didn't get services such as security or memory management from an invisible runtime; it got them from the operating system. And importantly, it got them from the operating system explicitly, by asking for them, usually by calling an API provided in the Windows SDK. More recent unmanaged applications got operating system services through COM calls. Unlike the other Microsoft languages in Visual Studio, Visual C++ can create unmanaged applications. When you create a project and select an application type whose name starts with MFC, ATL, or Win32, you're creating an unmanaged application. This can lead to some confusion: When you create a .Managed C++ application., the build product is an assembly of IL with an .exe extension. When you create an MFC application, the build product is a Windows executable file of native code, also with an .exe extension. The internal layout of the two files is utterly different. You can use the Intermediate Language Disassembler, ildasm, to look inside an assembly and see the metadata and IL. Try pointing ildasm at an unmanaged exe and you'll be told it has no valid CLR (Common Language Runtime) header and can't be disassembled —Same extension, completely different files.

How big is the datatype int in .NET? 32 bits. How big is the char? 16 bits (Unicode). How do you initiate a string without escaping each backslash? Put an @ sign in front of the double-quoted string.

.net interview questions

3

What are valid signatures for the Main function? public static void Main() public static int Main() public static void Main( string[] args ) public static int Main(string[] args ) Does Main() always have to be public? No. How do you initialize a two-dimensional array that you don’t know the dimensions of? int [, ] myArray; //declaration myArray= new int [5, 8]; //actual initialization What’s the access level of the visibility type internal? Current assembly. What’s the difference between struct and class in C#? Structs cannot be inherited. Structs are passed by value, not by reference. Struct is stored on the stack, not the heap. Explain encapsulation. The implementation is hidden, the interface is exposed. What data type should you use if you want an 8-bit value that’s signed? sbyte. 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++. Where are the value-type variables allocated in the computer RAM? Stack. Where do the reference-type variables go in the RAM? The references go on the stack, while the objects themselves go on the heap. However, in reality things are more elaborate. 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. How do you convert a string into an integer in .NET? Int32.Parse(string), Convert.ToInt32() How do you box a primitive data type variable? Initialize an object with its value, pass an object, cast it to an object Why do you need to box a primitive variable? To pass it by reference or apply a method that an object supports, but primitive doesn’t. 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. How do you enforce garbage collection in .NET? System.GC.Collect(); Can you declare a C++ type destructor in C# like ~MyClass()? Yes, but what’s the point, since it will call Finalize(), and Finalize() has no guarantees when the memory will be cleaned up, plus, it introduces additional load on the garbage collector. The only time the finalizer should be implemented, is when you’re dealing with unmanaged code. What’s different about namespace declaration when comparing that to package declaration in Java? No semicolon. Package declarations also have to be the first thing within the file, can’t be nested, and affect all classes within the file. 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(). Can you create enumerated data types in C#? Yes. What’s different about switch statements in C# as compared to C++? No fall-throughs allowed. 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.

.net interview questions

4

Is goto statement supported in C#? How about Java? Gotos are supported in C#to the fullest. In Java goto is a reserved keyword that provides absolutely no functionality. Describe the compilation process for .NET code? Source code is compiled and run in the .NET Framework using a two-stage process. First, source code is compiled to Microsoft intermediate language (MSIL) code using a .NET Framework-compatible compiler, such as that for Visual Basic .NET or Visual C#. Second, MSIL code is compiled to native code. Name any 2 of the 4 .NET authentification methods. ASP.NET, in conjunction with Microsoft Internet Information Services (IIS), can authenticate user credentials such as names and passwords using any of the following authentication methods: Windows: Basic, digest, or Integrated Windows Authentication (NTLM or Kerberos). Microsoft Passport authentication Forms authentication Client Certificate authentication How do you turn off SessionState in the web.config file? In the system.web section of web.config, you should locate the httpmodule tag and you simply disable session by doing a remove tag with attribute name set to session.

CodeBehind is relevant to Visual Studio.NET only. 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 itsconstituents. Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler? It’s the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.Add("onMouseOver","someClientCode();")A simple"Javascript:ClientCode();” in the button control of the .aspx page will attach the handler (javascript function)to the onmouseover event. What data type does the RangeValidator control support? Integer,String and Date. 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. Explain what a diffgram is, and a good use for one? A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the

.net interview questions
necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.

5

ASP.NET 1. What are the different types of caching ? Output caching, Fragment Caching and Data caching. 2. 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 varified for performing the various tasks, It access is limited it is known as authorization. 3. What is Setellite Assemblies ? Setellite assemblies holds the cultural information. Cultural refers the cultural information about the region in the the application is going to use. 4. What are different types of directives in .NET ? Page, Outputcache, Register 5. What is difference between server side and client side ? 6. Difference between Server.Transfer and Response.redirect ? 7. How to use Dataview property ? 8. How to reflect updation of data in dataset to database ? 9. What is is advantage of Dataset over Datareader ? 10. What is advantage of Datareader over dataset ? 11. What are the different types a command can be execute ? (Execute reader, executeonquery.. ) 12. What are different types of validations ? 13. What is ViewState ? and how it is managed ? 14. What is web.config file ? 15. what is the difference between usercontrol and costem control ? 16. How you will set the datarelation between two coloumns ? 17. What are advantage of viewstate and what are benifits ? 18. How doyou turn off cookies in one page of your asp.net application ? 19. Dataset is always disconnected ? True 20. What is a Dataset ?

1)How do u do exception management 2)if u are using components in ur application , how can u handle exceptions raised in a document. * 3)can we throw exception from catch block 4)wat is the differeces b/w value type and reference type 5)is string reference/value type 6)wat is the web.config and how many web.config files can we allowed to use in an application. 7)wat are the asynchronuos call backs 8)how to write unmanaged code and how to identify 9)whether code is managed/unmanaged 10)how to authenticate user in web.config 11)wat is strong name and which tool is used for this 12)wat is gacutil.exe where do we strore assemblies 13)should sn.exe be used before gauctil.exe 14)wat does assemblyinfo.cs consists of 15)differences b/w trace and debug 16)differences b/w dataset and datareader 17)wat is custom tag in web.config

.net interview questions

6

18)how do u define authentication In web.config 19)wat is sequence of code in retrieving data from database 20)about dts package . purpose of dts. 21)where does the web.config info stored? Will this be stored in the registry 22)how do u register the dotnet component or assembly 23)authenication mechanism in dotnet? And state management in dotnet? 24)wat are http handler? 25)types of optimization and name a few and how do u ? 26)how do u do role based security? 27)diff b/w response.expires and expires.absolute? 28)types of objects in asp 29)diff b/w ado and ado.net 30)diff b/w isql and osql 31)how can I make a coulumn unique. 32)about sql profiler 33)wat are user defined stored procedures. 34)wat are code pages. 35)wat is refferential integrity 36)about sql profiler usage 37)wat are the advantages of dotnet and disadvantages. 38)wat are jitters and how many types. 39)how do u manage sessin in asp and asp.net 40)how do u handle session management in asp.net and how do u implements them.how do u handle in case of sqlserver mode. 41)wat is custom control. Wat is the diff b/w custom control and user control; 42)does c# supports multi dimentional arrays. 43)features and disadvantages In dataset. 44)wat is the reflection and disadvantages. 45)wat is boxing and how it works internally 46)TYPES OF AUTEHNICATIONS IN IIS. 47)disadvantage of com components 48)how do u load xml documents and perform validations of the document. 49)wat is ODP.NET 50)types of sessions management In asp.net 51)diff b/w datareader and dataset 52)wat are the steps in connecting to database 53)how do u register a .net assembly 54)caching techniques in .net 55)diff b/w .Net and previous version 56)diff b/w dataset and datareader 57)wat are runtime hosts 58)wat is an application domain 59)wat is view state 60)wat are the blocks in stored procedures 61)wat is normalization and how many type and give some examples. 62)wat is subquery and wat is correlated subquery 63)diff types of validation control in asp.net 64)diff b/w server.execute and response.redirect 65)how response.flush works in server.execute 66)tell about global.asax 67)tell about web.config 68)tell about machine.config 69)how do u set language in web.config. 70)wat is nested query 71)diff b/w in vb dll and assemblies in .net 72)wat is WSDL 73)Wat are WSDL PORTS 74)where do u store connection string

.net interview questions
75)wat does connection string consists of 76)which namaspace is used for exception 77)wat are the types of threading concepts 78)how many steps in .net application while running 79)how do u send an xml document from client to server 80)wat is intermedite lanuage in .net 81)wat is clr and how it generates native code 82)any disadvantage in dataset and in refleciton 83)wat is runtime host 84)wat is purpose of system.enterpriseservices namespace 85)types of statemanagemnt techniques. 86)how to invoke .net components and from com components , give the sequence. 87)how to check null values in the dataset 88)features in .net framework. 89)about disco and uddi 90)wat is jit , wat are the types of jits and their purpose. 91)wat is interoperablity 92)diff b/w application and session 93)wat is web application and session 94)wat is web application and virtual directory 95)diff b/w activex exe and dll 96)can tow web applications share a sesssion and application variable. 97)diff b/w CDATA AND PCDATA IN XML 98)types of compatability in vb and their usage. 99)if I have a page where I create an instance of a dll and invoking any method can I send value to next page. 100)about mts and it's purpose 101)about xlst 102)wat is xml 103)how do u attach an xsl to an xml in presenting output. 104)about response.buffer and response.flush 105)wat is dataset and datamining 106)about soap 107)usage of htmlencode and urlencode 108)usage of server variables 109)how to find the clint browser type 110)diff b/w sqlserver 7.0 and sql server 2000 111)about dts usage 112)how do u optimize sql queries. 113)define .net architecture 114)where does ado.net and xml web services come in the architecture. 115)wat is msil code 116)types of jit and wat is econo-jit 117)wat are webservices, its attributes . where they are available. 118) wat is uddi and how to register a webservrice 119)without uddi, is it possible to access a remote webservice. 120) wat is wsdl and disco file 121)wat does ado.net consists of? 122)wat does manifest consists? 123)wat do u mean by passport authentication and windows authenication 124)how wsdl stores 125)wat is key features of ado.net and ado 126)wat is odp.net 127)wat is process 128)wat is binding in webservice 129)how a proxy Is generated for a web service 130)wat is delegates how it works 131) types of backups 132) wat is INSTEAD OF trigger. 133)write a query for to get second maximum salary In emp table 134)wat is currency in database

7

.net interview questions

8

135)wat are nested triggers 136)wat is a heap related to database 137)diff b/w com and .net component 138)wat is UUID AND GUID wat is the size of this ID? 139)diff b/w dynamic querry and static query 140)about ado and its objects 141)wat is unmanaged code and will clr handle this kind of code or not. 142)garbage collector's functionality on unmanages code. 143)types of cursors and explain them 144)types of cursor locks and explanation eace of them 145)wat is side by side execution 146)how do u impliment inheritance In dotnet. 147)about ado.net components/objects . usage of data adapters and tell the steps to retrieve the data. 148)about sn.exe 149)wat was the problem in traditional component why side by side execution is supported in .net? 150)how .net assemblies are registered as private and public assemblies. 151)all kind of specifiers for a class and for methods. 152) wat is deployement and give one example with one progrme 153)if suppose I done a project in dotnet . suppose if that project is installed in some other system is it necessary to install all .net framework or not 154)diff b/w oracle and sql server 155)diff b/w sql server7.0 and 2000 156)wat asp.net objects where diff= difference b/w = between rem Basics !@#$% .NET = its an Environment for developing Windows & Web applications, services and components using multiple Programming Languages. S.O.A. = service oriented applications => eg. Web Services Apart from Windows OS ; .NET is already available on UNIX [Free BSD] & MAC ; & will be soon available on Linux [Project Mono] It is a Framework in which Windows applications may be developed and run.The Microsoft .NET Framework is a platform for building, deploying, and running Web Services and applications. It provides a highly productive, standards-based, multi-language environment for integrating existing investments with nextgeneration applications and services as well as the agility to solve the challenges of deployment and operation of Internet-scale applications. The .NET Framework consists of three main parts: the common language runtime, a hierarchical set of unified class libraries, and a componentized version of Active Server Pages called ASP.NET. The .NET Framework provides a new programming model and rich set of classes designed to simplify application development for Windows, the Web, and mobile devices. It provides full support for XML Web services, contains robust security features, and delivers new levels of programming power. The .NET Framework is used by all Microsoft languages including Visual C#, Visual J#, and Visual C++. Visual Studio .NET is a Rapid Application tool. · Drag n Drop · Intellisense · Debugging · Project Templates CLR is .NET equivalent of Java Virtual Machine (JVM). It is the runtime that converts a MSIL code into the host machine language code, which is then executed appropriately. The CLR is the execution engine for .NET Framework applications. It provides a number of services, including: · · Code management (loading and execution) Application memory isolation

.net interview questions
· Thread management · Verification of type safety · Conversion of IL to native code. · Access to metadata (enhanced type information) · Managing memory for managed objects (memory management) · Enforcement of code access security · Exception handling, including cross-language exceptions · Interoperation between managed code, COM objects, and pre-existing DLL's (unmanaged code and data) i.e. Robustness · Automation of object layout · Support for developer services (profiling, debugging, and so on).

9

Managed code is code that is written to target the services of the Common Language Runtime. In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/CLR). Closely related to managed code is managed data--data that is allocated and de- allocated by the Common Language Runtime's garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch), but when using Managed Extensions for C++, a class can be marked as managed using the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class becomes a full participating member of the .NET Framework community, with the benefits and restrictions that it brings. An example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can inherit from a Visual Basic class). An example of a restriction is that a managed class can only inherit from one base class. CTS defines all of the basic types that can be used in the .NET Framework and the operations performed on those type. All this time we have been talking about language interoperability, and .NET Class Framework. None of this is possible without all the language sharing the same data types. What this means is that an int should mean the same in VB, VC++, C# and all other .NET compliant languages. This is achieved through introduction of Common Type System (CTS). CLS = standards,guidelines for Compiler Vendors. CTS = datatypes r defined by .NET framework NOT defined by languages. Thread : a Unit of Execution; When its bare minimum no.of threads Active – i.e. 1 thread active ; Tats it : then tat Thread is called Default thread.If there are more threads [2 or more] CLR comes/steps in place of Operating System.dotNet supports MultiThreading ! In .NET Framework , all code resides in Types i.e. Classes · Logical arrangement – namespaces · Physical arrangement - assemblies Types reside in Namespaces & Namespaces reside in Assemblies. ' Namespace=Folder; Class=File What is the difference between a namespace and assembly name? A namespace is a logical naming scheme for types in which a simple type name, such as MyType, is preceded with a dot-separated hierarchical name. Such a naming scheme is completely under control of the developer. For example, types MyCompany.FileAccess.A and MyCompany.FileAccess.B might be logically expected to have functionally related to file access. The .NET Framework uses a hierarchical naming scheme for grouping types into logical categories of related functionality, such as the ASP.NET application framework, or remoting functionality. Design tools can make use of namespaces to make it easier for developers to browse and reference types in their code. The concept of a namespace is not related to that of an assembly. A single assembly may contain types whose hierarchical names have different namespace roots, and a logical namespace root may span multiple assemblies. In the .NET Framework, a namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time.

.net interview questions
Namespace => a Collection of names wherein each name is Unique. They form the logical boundary for a Group of classes. Namespace – must be specified in Project-Properties.

10

Assembly => a software Output Unit;It’s a unit of Deployment & a unit of versioning.Assemblies contain MSIL code. Assemblies r Self-Describing. [metadata,manifest] An assembly is the primary building block of a .NET Framework 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. .NET Assembly contains all the metadata about the modules, types, and other elements it contains in the form of a “manifest.” The CLR loves assemblies because differing programming languages are just perfect for creating certain kinds of applications. For example, COBOL stands for Common Business-Oriented Language because it’s tailor-made for creating business apps. However, it’s not much good for creating drafting programs. Regardless of what language you used to create your modules, they can all work together within one Portable Executable Assembly. There’s a hierarchy to the structure of .NET code. That hierarchy is “Assembly -> Module -> Type -> Method." Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files. You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed. Assemblies also allow Side-by-Side execution – 2 versions of same assembly being used @ same time. References ALWAYS contain names – which r ASSEMBLY names of External Dependencies in ur Project. code-construct for Attribute [attribute for assembly] [Assembly: company name] [Assembly: configuration] MSIL is an Instruction-set. MSIL by itself is a Programming Language. MSIL faster/optimized w.r.t java-byte-code. A .NET programming language (C#, VB.NET, J# etc.) does not compile into executable code; instead it compiles into an intermediate code called Microsoft Intermediate Language (MSIL). As a programmer one need not worry about the syntax of MSIL - since our source code in automatically converted to MSIL. The MSIL code is then send to the CLR (Common Language Runtime) that converts the code to machine language, which is, then run on the host machine. MSIL is similar to Java Byte code. MSIL is the CPU-independent instruction set into which .NET Framework programs are compiled. It contains instructions for loading, storing, initializing, and calling methods on objects. Combined with metadata and the common type system, MSIL allows for true cross- language integration Prior to execution, MSIL is converted to machine code. It is not interpreted. METADATA =è · Wats the name of Assembly ? · Wat r Classes available ? · Wat is Version no. ? · Wat r Programming Languages used ? Metadata is information about a PE. In COM, metadata is communicated through non-standardized type libraries. In .NET, this data is contained in the header portion of a COFF-compliant PE and follows certain guidelines; it contains information such as the assembly’s name, version, language (spoken, not computer— a.k.a., “culture”), what external types are referenced, what internal types are exposed, methods, properties, classes, and much more. The CLR uses metadata for a number of specific purposes. Security is managed through a public key in the PE’s header. Information about classes, modules, and so forth allows the CLR to know in advance what structures are necessary. The class loader component of the CLR uses metadata to locate specific classes within assemblies, either locally or across networks. Just-in-time (JIT) compilers use the metadata to turn IL into executable code. Other programs take advantage of metadata as well. A common example is placing a Microsoft Word document on a Windows 2000 desktop. If the document file has completed comments, author, title, or other Properties metadata, the text is displayed as a tool tip when a user hovers the mouse over the document on the desktop. You can use the Ildasm.exe utility to view the metadata in a PE. Literally, this tool is an IL disassembler.

.net interview questions

11

Module --Module is a Class whose all members are static/shared. ##### ADVANTAGES / usp :Advantages of VB.NET 1. First of all, VB.NET provides managed code execution that runs under the Common Language Runtime (CLR), resulting in robust, stable and secure applications. All features of the .NET framework are readily available in VB.NET.2. VB.NET is totally object oriented. This is a major addition that VB6 and other earlier releases didn't have.3. The .NET framework comes with ADO.NET, which follows the disconnected paradigm, i.e. once the required records are fetched the connection no longer exists. It also retrieves the records that are expected to be accessed in the immediate future. This enhances Scalability of the application to a great extent.4. VB.NET uses XML to transfer data between the various layers in the DNA Architecture i.e. data are passed as simple text strings.5. Error handling has changed in VB.NET. A new TryCatch-Finally block has been introduced to handle errors and exceptions as a unit, allowing appropriate action to be taken at the place the error occurred thus discouraging the use of ON ERROR GOTO statement. This again credits to the maintainability of the code.6. Another great feature added to VB.NET is free threading against the VB single-threaded apartment feature. In many situations developers need spawning of a new thread to run as a background process and increase the usability of the application. VB.NET allows developers to spawn threads wherever they feel like, hence giving freedom and better control on the application.7. Security has become more robust in VB.NET. In addition to the role-based security in VB6, VB.NET comes with a new security model, Code Access security. This security controls on what the code can access. For example you can set the security to a component such that the component cannot access the database. This type of security is important because it allows building components that can be trusted to various degrees.8. The CLR takes care of garbage collection i.e. the CLR releases resources as soon as an object is no more in use. This relieves the developer from thinking of ways to manage memory. CLR does this for them. BinaryIntellect sir - Points – Main Adv. 1. fully object-oriented 2. Rich built-in functionality 3. Automatic memory mangement 4. No registration & versioning issues 5. No marshalling overheads – Avoided bcoz of C T S 6. xcopy deployment [made easier] 7. EAI made easy thru Web Services. Classes can contain :1. variables 2. properties 3. methods 4. constructors 5. finalizers 6. events & delegates 'Struct, enum, property /no New keyword/ also Must create an instance purpose of using an enum is Basically to make s.c. more readable …. 'Also can contain methods... ' Property only for private/protected variables .... ' pvar1.age=23 => call of Set ' c.wl(pvar1.age) => call of Get can use keywords ReadOnly,WriteOnly with a Property as well …… Member vars = Field vars => @ Class-level; [these represent the State of ur Class]; These member vars WILL NOT be DIRECTLY Exposed to end-user. PROPERTIES r recommended over member-vars bcoz they provide Data Validation. 'Dim .... Redim .... Then data will be lost

.net interview questions
'BUT Dim .... Redim Preserve .... then no probs! 'str1=str1+str2 OR str1=str1 & str2 [string concatenation] ' Try.... Catch ex as Exception.... Finally.... End Try 'Exception=CLASS; ex=instance 'Try can be with more than 1 catch 'Finally is Not Compulsory;Freeing the memory used up; whenever present Finally is ALWAYS executed 'Catch executed ONLY when error occurs STATIC or Shared => called straight-directly by OS / CLR . 'Shared ===> basically access "that class" without creating an instance[objt] string[] args => command-line arguments.

12

'Both constr destrr r methods/procedures; constrr is marked by New(); destrr marked by Finalize() 'Constrr = initialization & database connectivity ; 'Destrr = Clean Up ; destrr / finalizer = a funcn tat gets called automatically by Garbage Collector when tat Object is NOT in use. 'Signature w.r.t a proc/funcn 'Also 2 mainpts of a sgnre --- Return type & Parameters 'c.wl , WriteLine() mtd features both Shared, OverLoaded by default – No command-line arguments r specified in VB.NET code. -----------------------------------------------------ABSTRACTION Providing the end user wihout showing the complexity of execution is called abstraction. looking for what u want and eliminating the unnessary details A process of filtering out unwanted details based on a given context & identify a programmable entity from a RealWorld situation. Its in the “mind” of the Developer. < ONLY taking relevant details for Design of appropriate class > ENCAPSULATION A tactic of bundling data & functions [tat act on tat data] together aka - Data Hiding ; Classes, Properties & Methods use encapsulation. INHERITANCE A process of Specialized classes from Generic ones. [class_Manager is a special case of class_Employee] : at a time ONLY 1 base class Main Aim of Inheritance : - Specialization & in the process u can achieve Re-Use. Multiple inheritance NOT supported in .NET Interfaces --- a set of Property & Function signatures without any implementation. - a class implementing an interface must provide implementation for ALL members. these r like a Contract - All members must be implemented - Everything must be PUBLIC - they provide templates for Classes - Interfaces r developed prior-to/before Developing of Classes 'an Abstract Class contains at least 1 Abstract Method[with no body] can have other/normal mtds too ……… 'Interface is a pure abstract class; all mtds r abstract [only 1 parent class] 'b/w Classes ; b/w Interfaces =Inherits 'b/w Class and Interface =Implements eg. Code Class B inherits A implements I1,I2,I3 .................

.net interview questions
eg. Code namespace Employee public interface Iperson { DateTime D_O_B { get; set; } void Eat(); } Inherits Cemployee Implements Iperson Rule :- var of type Interface can point to Object of Class tat implements tat Interface

13

I N T E R F A C E -> Within the same Project, add Class [PTR] name ur class as “ all Interface names begin with I ” POLYMORPHISM Multiple forms of the same entity Eg. Door.Open() Book.Open() , Car.Run() Horse.Run() ………. 2 types – P via Inheritance P via Interfaces ----------------------------------------------------EVENTS - see presentation-study !!! 'we CAN have USE OF BOTH {WithEvents,Handles} & {AddHandler,Invoke} in an eg. program E V E N T => A notification from a class to the client. Modus operandi for Events n Delegates --1. 1st ur Class shud have an Event defined 2. In client-appcn u must have some Event-Handler 3. Agreed syntax b/w these 2 [ === delegate ] a Delegate - a type-safe funcn pointer.Events r instances of Delegates. Inside/within .NET f/w , Delegates r treated as Classes. An Event-Delegate requires 3 things :1. Class with an event { publisher } 2. Class with an event-handler { subscriber } 3. Agreed syntax { delegate } Event Publisher Event Subscriber Declare a delegate tat represents Create eventhandler funcn matching Signature of event signature of delegate Declare an instance of event Subcribe to the event Raise the event rem ADO.net !@#$% ' DBMS --- S/W for managing a database ' RDBMS - relational DBMS . eg. SQL,Oracle,Access,DB2,Informix.... ' MAIN IDEA ==> cnxn b/w RDBMS & VB.Net ' Dataset -> a collection of datatables[classes]. ' DataSet always with Data Adapter ..

.net interview questions
' OLEDB -> System.Data.Oledb ' SQL S -> System.Data.SqlClient 'Data Reader --- specifically for Web Forms [ReadOnly;ForwardOnly]; '[cnxn must be online] [1 Record at a time] ..... ' StoredProcedure .... rem cmndText= "name of proc" rem cmndType= "CommandType.StoredProcedure" ' these r basically for repetitive action/loop/code ........ rem Crystal Reports !@#$% ' 2 ways of intzg/lead-to DataSource - OFD & ds-da ' OFD ke thru useof CRV.ReportSource=ofd.Filename; CRV.ReportSource=rpt ; ' [rpt = Report object] *************************************** 4 fundas : ' Filling the Dataset ' Creating the Report object [rpt] ' Assign the Dataset to rpt ' Assign the Report to the ReportViewer **************************************** ' Note that Always along with .xsd,.resx ..... files; theres a .vb file also created! ' Export Report 4 possibilties : .pdf, .rtf , .xls[MS-EXCEL] , .doc[MS-WORD] ‘ .resx is a Resource-file …………………… rem WebService !@#$% ' standards used by a Web Service -> HTTP,XML,SOAP ' Web Service === Class located on a WebSite ... ' SOAP === Simple Object Access Protocol ..... ' WSDL === Web Service Description Language ' unlike in HTML; in XML we can have custom tags ...... ' w.r.t Web Service .... Imports System.Web.Services; attributes ' all ws's have extension ===> .asmx

14

' IMPT STEPS : ' $ Create/code Web Service... ' $ Make a Client Application.. ' $ Add a Web Reference ... ' $# after add-web-ref; 2 stmts ' dim ms as com10.MathService ' inside all subs :-> ms = New com10.MathService() ' due to xml we can have xfer of complex datatypes too such as ' arrays,collections,dataset ... rem rite way to rite ritely is ----> ' Assemblies can be static or dynamic. Static assemblies can include .NET Framework types (interfaces and classes), as well as resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in portable executable (PE) files. You can also use the .NET Framework to create dynamic assemblies, which are run directly from memory and are not saved to disk before execution. You can save dynamic assemblies to disk after they have executed. Assemblies also allow Side-by-Side execution – 2 versions of same assembly being used @ same time. References ALWAYS contain names – which r ASSEMBLY names of External Dependencies in ur Project. code-construct for Attribute [attribute for assembly] [Assembly: company name] [Assembly: configuration] Module --Module is a Class whose all members are static/shared. Modules r containers of Classes.

.net interview questions
' UML - explain Uses,Extends .... ? ' UML - Multiplicity ... ? ‘ OOPs concept relating to Parent class,Child class & instances ! ‘’ vsdisco files in Visual Studio ?? [ What for ???] Ans.6 all info bout Configuring the Web Service.

15

Shared Assembly – GAC --- explain ? Ans.7 concept :. What is Global Assembly Cache (GAC) and what is the purpose of it? (How to make an assembly to public? Steps) How more than one version of an assembly can keep in same place? 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. You should share assemblies by installing them into the global assembly cache only when you need to. Steps - Create a strong name using sn.exe tool eg: sn -k keyPair.snk - with in AssemblyInfo.cs add the generated file name eg: [assembly: AssemblyKeyFile("abc.snk")] - recompile project, then install it to GAC by either drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool) or gacutil -i abc.dll only for .NET assemblies; when Assemblies r shared b/w 2 appcns thru a Cache called GAC !for this purpose, we register a Shared Assembly in the GAC & not in Windows Registry ### GAC => possible with same name & different versions; then the identification is by the Strong Name.SN assembly is an assembly which has been encrypted with a pair [Public Key & Private Key] ### ‘ VSS Wat ? 3 main/code Options ??? Ans.8 VSS -> VisualSourceSafe 3 Options --o Explicit o Strict o Compare [binary/text] vb.net --- Application Domain ??? Ans.9 · What is Application Domain? The primary purpose of the AppDomain is to isolate an application from other applications. Win32 processes provide isolation by having distinct memory address spaces. This is effective, but it is expensive and doesn't scale well. The .NET runtime enforces AppDomain isolation by keeping control over the use of memory - all memory in the AppDomain is managed by the .NET runtime, so the runtime can ensure that AppDomains do not access each other's memory. Objects in different application domains communicate either by transporting copies of objects across application domain boundaries, or by using a proxy to exchange messages. MarshalByRefObject is the base class for objects that communicate across application domain boundaries by exchanging messages using a proxy. Objects that do not inherit from MarshalByRefObject are implicitly marshal by value. When a remote application references a marshal by value object, a copy of the object is passed across application domain boundaries. How does an AppDomain get created? AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application. AppDomains can also be explicitly created by .NET applications. Here is a C# sample which creates an

.net interview questions

16

AppDomain, creates an instance of an object inside it, and then executes one of the object's methods. Note that you must name the executable 'appdomaintest.exe' for this code to work as-is. · using System; · using System.Runtime.Remoting; · · public class CAppDomainInfo : MarshalByRefObject ·{ · public string GetAppDomainInfo() ·{ · return "AppDomain = " + AppDomain.CurrentDomain.FriendlyName; ·} ·} · public class App ·{ · public static int Main() ·{ · AppDomain ad = AppDomain.CreateDomain( "Andy's new domain", null, null ); · ObjectHandle oh = ad.CreateInstance( "appdomaintest", "CAppDomainInfo" ); · CAppDomainInfo adInfo = (CAppDomainInfo)(oh.Unwrap()); · string info = adInfo.GetAppDomainInfo(); · Console.WriteLine( "AppDomain info: " + info ); · return 0; ·} } i.e. pertaining to the Server [SQL Server2000, Oracle 8i, 9i] AD - logical process created by the OS; AD provides isolation & security w.r.t Processes. eg.s of Runtime Host --- asp.net,IE,Shell Executable. Application Domain : -------------------The logical and physical boundary created around every .NET application by the Common Language Runtime (CLR). The CLR can allow multiple .NET applications to be run in a single process by loading them into separate application domains. The CLR isolates each application domain from all other application domains and prevents the configuration, security, or stability of a running .NET applications from affecting other applications. Objects can only be moved between application domains by the use of remoting. SAME is << CLR :: AppDomain >> App Domain provides Memory Isolation . SQL Triggers ? Ans.10 for controlling table-to-table activity !!! ODBC v OLEDB ? [ ODBC esp. for ] Ans.11 OLEDB is most frequently used ! Specifics --ODBC - for DSN [Domain Server Name]; making any appcn which has Driver ! OLEDB - for RDBMS . Remoting - is it ------[Distributed Appcns over n/w] OR [among Heterogenous OS] ??? Ans.12 · What is Remoting? The process of communication between different operating system processes, regardless of whether they

.net interview questions
are on the same computer. The .NET remoting system is an architecture designed to simplify communication between objects living in different application domains, whether on the same computer or not, and between different contexts, whether in the same application domain or not. Remoting is Inter-Process communication/progmmg.Its different from Socket[n/w] progmmg i.e. Tx & Rx .Remoting - 2 protocols --- TCP & HTTP . so, it is " ". Remoting: --------A .NET technology that allows objects residing in different application domains to communicate. Objects in different application domains are said to be separated by a remoting boundary. Objects using remoting may be on the same computer, or on different computers connected by a network. Remoting is the .NET replacement for DCOM. REMOTING :_ accessing anything on some other machine from your machine.

17

· Difference between web services & remoting? ASP.NET Web Services .NET Remoting Protocol Can be accessed only over HTTP Can be accessed over any protocol (including TCP, HTTP, SMTP and so on) State Management Web services work in a stateless environment Provide support for both stateful and stateless environments through Singleton and SingleCall objects Type System Web services support only the datatypes defined in the XSD type system, limiting the number of objects that can be serialized. Using binary communication, .NET Remoting can provide support for rich type system Interoperability Web services support interoperability across platforms, and are ideal for heterogeneous environments. .NET remoting requires the client be built using .NET, enforcing homogenous environment. Reliability Highly reliable due to the fact that Web services are always hosted in IIS Can also take advantage of IIS for fault isolation. If IIS is not used, application needs to provide plumbing for ensuring the reliability of the application. Extensibility Provides extensibility by allowing us to intercept the SOAP messages during the serialization and deserialization stages. Very extensible by allowing us to customize the different components of the .NET remoting framework. Ease-of-Programming Easy-to-create and deploy. Complex to program. .asax mein kya kya primarily rehta hai [global .asax] ? Ans.13 used to define Event Handlers - with application/session scope; used to define Objects - with application/session scope. this file may contain :- event handlers........... application_start application_end session_start session_end application_beginrequest application_endrequest Web.Config mein System Settings hota hai kya [present/possible] ??? Session,State ??? Ans.15 When a user requests a Page from ur Website, Session starts;each user on ur website is given a session.Session object is used to store info needed for a particular user-session.Variables persist for the entire user-session. HTTP [stateless]:Web Server treats each http request for a page as an independent request. We can store values in the Session object;Info stored in the session object is available thruout the session &

.net interview questions
has session scope. Dataset cant have Tables other than those of Database - True/False ? Ans.19 Yes = True.

18

Web Service mein kya kya type-of-Parameters pass ho sakte hain ? 3. What is a WebService and what is the underlying protocol used in it?Why Web Services? Web Services are applications delivered as a service on the Web. Web services allow for programmatic access of business logic over the Web. Web services typically rely on XML-based protocols, messages, and interface descriptions for communication and access. Web services are designed to be used by other programs or applications rather than directly by end user. Programs invoking a Web service are called clients. SOAP over HTTP is the most commonly used protocol for invoking Web services. There are three main uses of Web services. 1. Application integration Web services within an intranet are commonly used to integrate business applications running on disparate platforms. For example, a .NET client running on Windows 2000 can easily invoke a Java Web service running on a mainframe or Unix machine to retrieve data from a legacy application. 2. Business integration Web services allow trading partners to engage in e-business leveraging the existing Internet infrastructure. Organizations can send electronic purchase orders to suppliers and receive electronic invoices. Doing e-business with Web services means a low barrier to entry because Web services can be added to existing applications running on any platform without changing legacy code. 3. Commercial Web services focus on selling content and business services to clients over the Internet similar to familiar Web pages. Unlike Web pages, commercial Web services target applications not humans as their direct users. Continental Airlines exposes flight schedules and status Web services for travel Web sites and agencies to use in their applications. Like Web pages, commercial Web services are valuable only if they expose a valuable service or content. It would be very difficult to get customers to pay you for using a Web service that creates business charts with the customers? data. Customers would rather buy a charting component (e.g. COM or .NET component) and install it on the same machine as their application. On the other hand, it makes sense to sell real-time weather information or stock quotes as a Web service. Technology can help you add value to your services and explore new markets, but ultimately customers pay for contents and/or business services, not for technology 4. Are Web Services a replacement for other distributed computing platforms? No. Web Services is just a new way of looking at existing implementation platforms. 5. In a Webservice, need to display 10 rows from a table. So DataReader or DataSet is best choice? A: WebService will support only DataSet. 1 Namespace --- 1 dll ? OR this associativity [ 1 to 1 w.r.t Namespace-dll associativity ] is not necessary ??? Ans.21 No, Not Necessary !!! ********** BEST OF LUCK/SUCCESS ********* 50 . Early & Late Binding: --------------------- Early binding is to know the type of an object at compile time. The compiler have all the needed element at compile time to build the call into the excutable code (resolution of calls at compile time) - With late binding, the type of an object is known only at runtime. It will need extra instructions to find out where is the method to be called (if it exists) before calling it (resolution of calls at runtime) *** Early binding is when the actual object behind the pointer is resolved at compile time. Late binding is when the actual object behind the pointer is resolved at run time. U can also go to foll link for details n an example.

.net interview questions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vaconEarlyLateBinding.asp 51. Application Domain : -------------------The logical and physical boundary created around every .NET application by the Common Language Runtime (CLR). The CLR can allow multiple .NET applications to be run in a single process by loading them into separate application domains. The CLR isolates each application domain from all other application domains and prevents the configuration, security, or stability of a running .NET applications from affecting other applications. Objects can only be moved between application domains by the use of remoting. SAME is << CLR :: AppDomain >> App Domain provides Memory Isolation . U can also go to foll link for details n an example. http://msdn.microsoft.com/library/default.asp?url=/library/enus/cpguide/html/cpconapplicationdomainhosts.asp Process: -------A process, in the simplest terms, is a running application. A thread is the basic unit to which the operating system allocates processor time for a process. *** A process is started by the Operating System to run any program on the computer. When you run Notepad, internally, Windows starts a process for the same. 52. Remoting: --------A .NET technology that allows objects residing in different application domains to communicate. Objects in different application domains are said to be separated by a remoting boundary. Objects using remoting may be on the same computer, or on different computers connected by a network. Remoting is the .NET replacement for DCOM. REMOTING :_ accessing anything on some other machine from your machine. 53. The difference between typed data set and untyped dataset:The difference between the two lies in the fact that a Typed DataSet has a schema and an Untyped DataSet does not have one. It should be noted that the Typed Datasets have more support in Visual studio. A typed dataset gives us easier access to the contents of the table through strongly typed programming that uses information from the underlying data schema. A typed DataSet has a reference to an XML schema file: Dim s As String s = dsCustomersOrders1.Customers(0).CustomerID In contrast, if we are working with an untyped DataSet, the equivalent code looks like this: Dim s As String s = _ CType(dsCustomersOrders1.Tables("Customers").Rows(0).Item ("CustomerID"), String) As the syntax is much simpler and more practical, using typed Datasets is much more handy. << Typed DataSet :- when the full structure gets copied using normal ado.net commands ; Untyped DataSet :- Only getting data into dataset ;

19

.net interview questions

20

i.e. w.r.t typed dataset-working; we know Field –Type ; we can use .separated & the Type automatically appears ……….. >> 55. asp.net – Post Back is the same as Refresh functionally !!! 56. For Classes : Multiple Inheritance is NOT possible ; for Interfaces however; Yes its Allowed/possible !!! 57. For Shadowing-purpose ; its OK if in the Base Class; we don’t write keyword : Overridable [MUST WRITE for Overriding-purpose] 26. Wats an Abstract Class ? Wats an Interface ? 59. Interface [vb.net] cant have default implementation ! · In which Scenario you will go for Interface or Abstract Class? Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. Even though class inheritance allows your classes to inherit implementation from a base class, it also forces you to make most of your design decisions when the class is first published. 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. Interfaces vs. Abstract Classes Feature Interface Abstract class Multiple inheritance A class may implement several interfaces. A class may extend only one abstract class. Default implementation An interface cannot provide any code at all, much less default code. An abstract class can provide complete code, default code, and/or just stubs that have to be overridden. Constants Static final constants only, can use them without qualification in classes that implement the interface. On the other paw, these unqualified names pollute the namespace. You can use them and it is not obvious where they are coming from since the qualification is optional. Both instance and static constants are possible. Both static and instance intialiser code are also possible to compute the constants. Third party convenience An interface implementation may be added to any existing third party class. A third party class must be rewritten to extend only from the abstract class. is-a vs -able or can-do Interfaces are often used to describe the peripheral abilities of a class, not its central identity, e.g. an Automobile class might implement the Recyclable interface, which could apply to many otherwise totally unrelated objects. An abstract class defines the core identity of its descendants. If you defined a Dog abstract class then Damamation descendants are Dogs, they are not merely dogable. Implemented interfaces enumerate the general things a class can do, not the things a class is. Plug-in You can write a new replacement module for an interface that contains not one stick of code in common with the existing implementations. When you implement the interface, you start from scratch without any default implementation. You have to obtain your tools from other classes; nothing comes with the interface other than a few constants. This gives you freedom to implement a radically different internal design. You must use the abstract class as-is for the code base, with all its attendant baggage, good or bad. The abstract class author has imposed structure on you. Depending on the cleverness of the author of the abstract class, this may be good or bad. Another issue that's important is what I call "heterogeneous vs. homogeneous." If implementors/subclasses are homogeneous, tend towards an abstract base class. If they are heterogeneous, use an interface. (Now all I have to do is come up with a good definition of hetero/homogeneous in this context.) If the various objects are all of-a-kind, and share a common state and behavior, then tend towards a common base class. If all they share is a set of method signatures, then tend towards an interface. Homogeneity If all the various implementations share is the method signatures, then an interface works best. If the various implementations are all of a kind and share a common status and behavior, usually an abstract class works best. Maintenance If your client code talks only in terms of an interface, you can easily change the concrete implementation behind it, using a factory method. Just like an interface, if your client code talks only in terms of an abstract class, you can easily change the concrete implementation behind it, using a factory method. Speed Slow, requires extra indirection to find the corresponding method in the actual class. Modern JVMs

.net interview questions

21

are discovering ways to reduce this speed penalty. Fast Terseness The constant declarations in an interface are all presumed public static final, so you may leave that part out. You can't call any methods to compute the initial values of your constants. You need not declare individual methods of an interface abstract. They are all presumed so. You can put shared code into an abstract class, where you cannot into an interface. If interfaces want to share code, you will have to write other bubblegum to arrange that. You may use methods to compute the initial values of your constants and variables, both instance and static. You must declare all the individual methods of an abstract class abstract. Adding functionality If you add a new method to an interface, you must track down all implementations of that interface in the universe and provide them with a concrete implementation of that method. If you add a new method to an abstract class, you have the option of providing a default implementation of it. Then all existing code will continue to work without change. 60. default Access Modifier for Vars/Method is Friend NOT public !!! 61. OOPS 4th feature – Abstraction --- Modelling --- concentrate on Modelling details ! ?????????? 62. BCL – base class Library ! 63. CLS is a Subset of CTS ! 64. ASP.net – session params/attributes :In Process ? State Server SQL Server L->T ; L&T

65. vb.net < method/sub declrn > ; OPTIONAL keyword is the last parameter Written 66. Clone [vb.net object] ; Does it create a Shallow copy or Deep copy ?? – creates Shallow copy ! 67. Databinding is relating Set of Controls to Dataset table-columns directly !!! 68. Wats Ad Hoc querying ??? It simply means AAA querying => Anywhere, Anytime Anyhow sql-querying !!!!!!! 69. XML-document Class – create/return an xml node objt :::: Create < node ; Attribute ; Element > ; which one ???? 70. Strong name assembly – tool --- is it sn.exe ?? You should share assemblies by installing them into the global assembly cache only when you need to. Steps - Create a strong name using sn.exe tool eg: sn -k keyPair.snk - with in AssemblyInfo.cs add the generated file name eg: [assembly: AssemblyKeyFile("abc.snk")] - recompile project, then install it to GAC by either drag & drop it to assembly folder (C:\WINDOWS\assembly OR C:\WINNT\assembly) (shfusion.dll tool) or gacutil -i abc.dll 71. use from & back to COM-version :**** to expose .net cmpt as a COM cmpt ::: **** there must be @ least 1 public zero-argument constructor Types cant be abstract All members must be Public n non-Static [subs,Vars,Properties etc. ]

.net interview questions

22

Basic .NET Framework questions 1) What is IL? (What is MSIL or CIL, What is JIT?) MSIL is the CPU –independent instruction set into which .Net framework programs are compiled. It contains instructions for loading, storing initializing, and calling methods on objects. 2) What is the CLR? Common Language Runtime is the execution engine for .NET Framework applications. It provides a number of services, including the following. Code management (loading and execution), Application memory isolation, Verification of type safety, Conversion of IL to native code , Access to metadata (enhanced type information), Managing memory for managed objects, Enforcement of code access security, Exception handling, including cross-language exceptions, Interoperation between managed code, COM objects, and pre-existing DLLs (unmanaged code and data), Automation of object layout, Support for developer services (profiling, debugging, and so on) 3) What is the CTS? The common type system is a rich type system, built into the common language runtime, that supports the types and operations found in most programming languages. The common type system supports the complete implementation of a wide range of programming languages. 4) What is CLS (Common Language Specification)? The Common Language Specification is a set of constructs and constraints that serves as a guide for library writers and compiler writers. It allows libraries to be fully usable from any language supporting the CLS, and for those languages to integrate with each other. The Common Language Specification is a subset of the common type system. The Common Language Specification is also important to application developers who are writing code that will be used by other developers. When developers design publicly accessible APIs following the rules of the CLS, those APIs are easily used from all other programming languages that target the common language runtime. 5) What is Managed Code? Managed code is code that is written to target the services of the common language runtime (see What is the Common Language Runtime?). In order to target these services, the code must provide a minimum level of information (metadata) to the runtime. Managed data—data that is allocated and de-allocated by the common language runtime's garbage collector. 6) What is 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. 7) What are different types of Assemblies? Single file and multi file assembly. Assemblies can be static or dynamic. Private assemblies and shared assemblies 8) What is Namespace? A namespace is a logical naming scheme for types in which a simple type name a 9) What is Difference between Namespace and Assembly? Namespace is a logical design-time naming convenience, whereas an assembly establishes the name scope for types at run time. 10) If you want to view a Assembly how to you go about it (: What is ILDASM ?)? You can use the MSIL Disassembler (Ildasm.exe) to view Microsoft intermediate language (MSIL) information in a file. If the file being examined is an assembly, this information can include the assembly's attributes, as well as references to other modules and assemblies. This information can be helpful in determining whether a file is an assembly or part of an assembly, and whether the file has references to other modules or assemblies. To view assembly contents At the command prompt, type the following command: Ildasm <assembly name> In this command, assembly name is the name of the assembly to examine. The following example opens the Hello.exe assembly. Ildasm Hello.exe 11) What is Manifest? Every assembly, whether static or dynamic, contains a collection of data that describes how the elements in the assembly relate to each other. The assembly manifest contains this assembly metadata. An assembly manifest contains all the metadata needed to specify the assembly's version requirements and security identity, and all metadata needed to define the scope of the assembly and resolve references to resources

.net interview questions
and classes. The assembly manifest can be stored in either a PE file (an .exe or .dll) with Microsoft intermediate language (MSIL) code or in a standalone PE file that contains only assembly manifest information. 12) Where is version information stored of an assembly? The version number is stored in the assembly manifest along with other identity information, including the assembly name and public key, as well as information on relationships and identities of other assemblies connected with the application. 13) Is versioning applicable to private assemblies?

23

14) What is GAC (What are situations when you register .NET assembly in GAC?)? 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: 1)Use an installer designed to work with the global assembly cache. This is the preferred option for installing assemblies into the global assembly cache. 2)Use a developer tool called the Global Assembly Cache tool (Gacutil.exe) provided by the .NET Framework SDK. 3) Use Windows Explorer to drag assemblies into the cache. 15) What is concept of strong names (How do we generate strong names or what is the process of generating strong names, What is use of SN.EXE, How do we apply strong names to assembly? How do you sign an assembly?)? A strong name consists of the assembly's identity — its simple text name, version number, and culture information (if provided) — plus a public key and a digital signature. It is generated from an assembly file using the corresponding private key. (The assembly file contains the assembly manifest, which contains the names and hashes of all the files that make up the assembly.) There are two ways to sign an assembly with a strong name: 1) Using the Assembly Linker (Al.exe) provided by the .NET Framework SDK. 2) Using assembly attributes to insert the strong name information in your code. You can use either the AssemblyKeyFileAttribute or the AssemblyKeyNameAttribute, depending on where the key file to be used is located. 16) How to add and remove an assembly from GAC? The gacutil.exe that ships with .NET can be used to add or remove a shared assembly from the GAC. To add a shared assembly, from the command line enter: gacutil.exe /i myassembly.dll To remove from shared assembly: gacutil.exe /u myassembly.dll 17) What is Delay signing? Delay signing allows a developer to add the public key token to an assembly, without having access to the private key token. 18) What is garbage collector? The garbage collector's job is to identify objects that are no longer in use and reclaim the memory. What does it mean for an object to be in use? 19) Can we force garbage collector to run? Garbage collector works automatically and you cannot force the garbage collector to run. 20) What is reflection? Reflection is the mechanism of discovering class information solely at run time 22) What are Value types and Reference types? Reference types are stored on the run-time heap; they may only be accessed through a reference to that storage. Because reference types are always accessed through references, their lifetime is managed by the .NET Framework Value types are stored directly on the stack, either within an array or within another type; their storage can only be accessed directly. Because value types are stored directly within variables, their lifetime is determined by the lifetime of the variable that contains them 23) What is concept of Boxing and Unboxing? Boxing and unboxing is a essential concept in. NET’s type system. With Boxing and unboxing one can link between value-types and reference-types by allowing any value of a value-type to be converted to and from type object. Boxing and unboxing enables a unified view of the type system wherein a value of any type can ultimately be treated as an object. Converting a value type to reference type is called Boxing. Unboxing is the opposite operation and is an explicit operation. 24) What’s difference between VB.NET and C#? Although differences exist between Visual Basic .NET and Visual C# .NET, they are both first-class

.net interview questions

24

programming languages that are based on the Microsoft® .NET Framework, and they are equally powerful..." 25) What is CODE Access security? Code access security is a mechanism that helps limit the access code has to protected resources and operations. In the .NET Framework *Primitive : Data types that can be mapped directly to the .NET Framework Class Library (FCL) types are called Primitive. For example, the type "int" is mapped to System.Int32, "short" is mapped to System.Int16, and so on. In fact, all data types in .NET are derived from the System.Object class. The following two classes are equivalent (in C#): // Class implicitly derives from System.Object Class Car{};Class Car{};// Class explicitly derives from System.Object Class Car: System.Object{}; NET Interoperability 1) How can we use COM Components in .NET (What is RCW)? Whenever managed client calls a method on a COM object, the runtime creates a runtime callable wrapper (RCW). NET components can call COM components. COM components can call .NET components. One tool for performing this conversion is called tlbimp (type library importer), and it is provided as part of the .NET Framework Software Developer Kit (SDK). Tlbimp reads the metadata from a COM type library and creates a matching CLR assembly for calling the COM component. For example, to convert a Visual Basic ActiveX DLL named support.dll to a matching .NET assembly with the name NETsupport.dll, you could use this command line: tlbimp support.dll/out: NETsupport.dll 2) Once I have developed the COM wrapper do I have to still register the COM in registry? 3) How can we use .NET components in COM (What is CCW) (COM callable wrapper)? What caution needs to be taken in order that .NET components are compatible with COM? When a COM client calls a .NET object, the common language runtime creates the managed object and a COM callable wrapper (CCW) for the object. Unable to reference a .NET object directly, COM clients use the CCW as a proxy for the managed object. 4) How can we make Windows API calls in .NET? Windows APIs are dynamic link libraries (DLLs) that are part of the Windows operating system. You use them to perform tasks when it is difficult to write equivalent procedures of your own. For example, Windows provides a function named FlashWindowEx that lets you make the title bar for an application alternate between light and dark shades. The advantage of using Windows APIs in your code is that they can save development time because they contain dozens of useful functions that are already written and waiting to be used. The disadvantage is that Windows APIs can be difficult to work with and unforgiving when things go wrong. 5) When we use windows API in .NET is it managed or unmanaged code? 6) What is COM? COM is a platform-independent; object-oriented system for creating binary software components that can interact with other COM-based components in the same process space or in other processes on remote machines. COM is the foundation technology for many other Microsoft technologies, such as Active Server Pages (ASP), Automation, ISAPI, and ActiveSync. 7) What is Reference counting in COM? The methods in the audio interfaces follow a general set of rules for counting references on the COM objects that they take as input parameters or return as output parameters. 7) Can you describe IUnknown interface in short? The components IUnknown interface helps to maintain a reference count of the number of clients using the component. When this count drops down to zero, the component is unloaded. All components should implement the IUnknown interface. The reference count is maintained through IUnknown:: AddRef() & IUnknown::Release() methods, interface discovery is handled through IUnknown::QueryInterface(). 8)Can you explain what is DCOM? Microsoft® Distributed COM (DCOM) extends the Component Object Model (COM) to support communication among objects on different computers—on a LAN, a WAN, or even the Internet. With DCOM, your application can be distributed at locations that make the most sense to your customer and to the application. 9) DTC in .NET?

.net interview questions
The DTC is a system service that is tightly integrated with COM+. To help make distributed transactions work more seamlessly, COM+ directs the DTC on behalf of an application. This makes it possible to scale transactions from one to many computers without adding special code. The DTC proxy DLL (Msdtcprx.dll) implements the DTC interfaces. Applications call DTC interfaces to initiate, commit, abort, and inquire about transactions 10) How many types of Transactions are there in COM + .NET? 11) How do you do object pooling in .NET? 12) What are types of compatibility in VB6?

25

ASP.NET 1) What’s the sequence in which ASP.NET events are processed? a) Initialize: Initialize settings needed during the lifetime of the incoming Web request. b) Load view state: At the end of this phase, the ViewState property of a control is automatically populated c) Process postback data: Process incoming form data and update properties accordingly. d) Load: Perform actions common to all requests, such as setting up a database query. At this point, server controls in the tree are created and initialized, the state is restored, and form controls reflect client-side data. e) Send postback change notifications: Raise change events in response to state changes between the current and previous postbacks. f) Handle postback events: Handle the client-side event that caused the postback and raise appropriate events on the server. g) Prerender: Perform any updates before the output is rendered. Any changes made to the state of the control in the prerender phase can be saved, while changes made in the rendering phase are lost. h) Save state: The ViewState property of a control is automatically persisted to a string object after this stage. This string object is sent to the client and back as a hidden variable. For improving efficiency, a control can override the SaveViewState method to modify the ViewState property. i) Render: Generate output to be rendered to the client. j) Dispose: Perform any final cleanup before the control is torn down. References to expensive resources such as database connections must be released in this phase. k) Unload: Perform any final cleanup before the control is torn down. Control authors generally perform cleanup in Dispose and do not handle this event. Initialization, Page Load, PreRendor, Page unload 2) In which event are the controls fully loaded? 3) How can we identify that the Page is PostBack? Property IsPostback as Boolean VB: Public Readonly C#: Public bool IsPostBack {get;}

4) How does ASP.NET maintain state in between subsequent request? When a form is submitted in ASP .NET, the form reappears in the browser window together with all form values. This is because ASP .NET maintains ViewState. The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat="server"> control. The source could look something like this: <form name =”_ct10” method="post" action="page.aspx" id="_ctl0"> <input type="hidden" name="__VIEWSTATE" value = “dfdsklgfgfdgfddfdl=” /></form> Maintaining the ViewState is the default setting for ASP.NET Web Forms. If you want to NOT maintain the ViewState, include the directive <%@ Page EnableViewState="false" %> at the top of an. aspx page or add the attribute EnableViewState="false" to any control. 5) What is event bubbling? The ASP.NET page framework provides a technique called event bubbling that allows a child control to propagate events up its containment hierarchy. Event bubbling enables events to be raised from a more convenient location in the controls hierarchy and allows event handlers to be attached to the original control as well as to the control that exposes the bubbled event. 6) How do we assign page specific attributes? Defines page-specific (.aspx file) attributes used by the ASP.NET page parser and compiler. Example: <%@ Page attribute="value" [attribute="value"...] %> 7) Administrator wants to make a security check that no one has tampered with ViewState, how can we ensure this? Microsoft has provided two mechanisms for increasing the security of ViewState. a) Machine Authentication Check (MAC) - tamper-proofing <%@ Page EnableViewStateMac="true"%> b) Encrypting the ViewState This encryption

.net interview questions
can only be applied at the machine.config level, as follows: <machineKey validation='3Des' />

26

8) @ Register directives? Associates aliases with namespaces and class names for concise notation in custom server control syntax. <%@ Register tagprefix="tagprefix" Namespace="namespace" Assembly="assembly %> <%@ Register tagprefix="tagprefix" Tagname="tagname" Src="pathname" %> 9) What’s the use of SmartNavigation property? Gets or sets a value indicating whether smart navigation is enabled. VB: Public Property SmartNavigation As Boolean C#: Public bool SmartNavigation {get; set;} 10) What is AppSetting Section in “Web.Config” file? The <appSettings> element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment; for instance, any database connection strings will change as you move your application from a testing and staging server into production. 11) Where is ViewState information stored? The ViewState is stored in the page as a hidden form field. When the page is posted, one of the first tasks performed by page processing is to restore the view state. 12) What’s the use of @ OutputCache directive in ASP.NET? The output cache respects the expiration and validation policies for pages <%@ OutputCache Duration="60" VaryByParam="none"%> 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. 13) How can we create custom controls in ASP.NET? To create a simple custom control, define a class that derives from System.Web.UI.Control and override its Render method. The Render method takes one argument of type System.Web.UI.HtmlTextWriter. The HTML that your control wants to send to the client is passed as a string argument to the Write method of HtmlTextWriter. 14) How many types of validation controls are provided by ASP.NET? A Validation server control is used to validate the data of an input control. If the data does not pass validation, it will display an error message to the user. The syntax: <asp: control_name id="some_id” runat="server" /> RequiredFieldValidator: Checks that the user enters a value that falls between two values RegularExpressionValidator: Ensures that the value of an input control matches a specified pattern RequiredFieldValidator CustomValidator: Allows you to write a method to handle the validation of the value entered RangeValidator: Checks that the user enters a value that falls between two values CompareValidator: Compares the value of one input control to the value of another input control or to a fixed value ValidationSummary: Displays a report of all validation errors occurred in a Web page 15) Can you explain what is “AutoPostBack” feature in ASP.NET? AutoPostBack automatically posted whenever the form containing textbox control Text Changed. 16) Paging in DataGrid? The ASP.NET DataGrid control provides a built-in engine for paging through bound data. The engine supports two working modes—automatic and manual. Automatic paging means that you bind the whole data source to the control and let it go. The control displays a proper navigation bar and handles users clicking on the movement buttons. Automatic paging doesn’t require a deep understanding of the grid’s internals, nor does it take you much time to arrange an effective solution. For large data sets, though, it might not be a smart option. Handcrafted, custom paging is the alternative. Custom paging means that the host page is responsible for filling the grid control with up-to-date information. When the grid’s current page index is, say, “3” the page must provide the set of records that fit in page number 3. 17) What’s the use of “GLOBAL.ASAX” file? The Global.asax file, called the ASP.NET application file, provides a way to respond to application or module level events in one central location. You can use this file to implement application security, as well as other tasks. Every ASP.Net application can contain single Global.asax in its root directory. Can be use to handle application wide events and declare application wide objects.

.net interview questions

27

18) What’s the difference between “Web.config” and “Machine.Config”? Web.config is a security in ASP.Net application and how to secure applications. Web.config does most of the work for the application the who, what, where, when and how to be authenticated Machine.config contains settings that apply to an entire computer. This file is located in the %runtime install path%\Config directory. Machine.config contains configuration settings for machine-wide assembly binding, built-in remoting channels 19) What’s a SESSION and APPLICATION object? 20) What’s difference between Server.Transfer and Response.Redirect? Response.Redirect simply sends a message down to the browser, telling it to move to another page. So, you may run code like: Response.Redirect ("WebForm2.aspx") Server.Transfer is similar in that it sends the user to another page with a statement such as Server.Transfer, "transfer" process can work on only those sites running on the server, you can't use Server.Transfer to send the user to an external site. Only Response.Redirect can do that. Transferring to another page using Server.Transfer conserves server resources. Instead of telling the browser to redirect, it simply changes the "focus" on the Web server and transfers the request. This means you don't get quite as many HTTP requests coming through, which therefore eases the pressure on your Web server and makes your applications run faster. 21) What’s difference between Authentication and authorization? Authentication and Authorization are two interrelated security concepts. In short, authentication is a process of identifying a user, while authorization is the process of determining if an authenticated user has access to the resource(s) they requested. 22) What is impersonation in ASP.NET? Impersonation is when ASP.NET executes code in the context of an authenticated and authorized client. By default, ASP.NET does not use impersonation and instead executes all code using the same user account as the ASP.NET process, which is typically the ASPNET account. <Identity impersonate="true" UserName="domain\user" Password="password"/> 24) What are the various ways of authentication techniques in ASP.NET? ASP.NET provides built-in support for user authentication through several authentication providers: Forms-based authentication: the application is secured by using a custom authentication model with cookie support. Passport authentication: the application is secured by using Microsoft® Passport authentication. Passport is a single sign-on technology developed by Microsoft for use on the web. Windows authentication: the application is secured by using integrated windows authentication where access to a web application is allowed only to those users who are able to verify their windows credentials.

25) What’s difference between Datagrid, Datalist and Repeater? From performance point of view how do they rate? The DataGrid Web control provides the greatest feature set of the three data Web controls, with its ability to allow the end-user to sort, page, and edit its data. The DataGrid is also the simplest data Web control to get started with, as using it requires nothing more than adding a DataGrid to the Web page and writing a few lines of code. The ease of use and impressive features comes at a cost, though, namely that of performance: the DataGrid is the least efficient of the three data Web controls, especially when placed within a Web form. With its templates, the DataList provides more control over the look and feel of the displayed data than the DataGrid. Using templates, however, typically requires more development time than using the DataGrid's column types. The DataList also supports inline editing of data, but requires a bit more work to implement than the DataGrid. Unfortunately, providing paging and sorting support in the DataList is not a trivial exercise. Making up for these lacking built-in features, the DataList offers better performance over the DataGrid. Finally, the Repeater control allows for complete and total control of the rendered HTML markup. With the Repeater, the only HTML emitted are the values of the databinding statements in the templates along with the HTML markup specified in the templates—no "extra" HTML is emitted, as with the DataGrid and DataList. By requiring the developer to specify the complete generated HTML markup, the Repeater often

.net interview questions

28

requires the longest development time. Furthermore, the Repeater does not offer built-in editing, sorting, or paging support. However, the Repeater does boast the best performance of the three data Web controls. Its performance is comparable to the DataList's, but noticeably better than the DataGrid's. 26) What’s the method to customize columns in DataGrid? You can control the order, behavior, and rendering of individual columns by directly manipulating the grid's Columns collection. The standard column type -- BoundColumn -- renders the values in text labels. The grid also supports other column types that render differently. Any of the column types can be used together with the Columns collection of a DataGrid. Note that you can use explicitly-declared columns together with auto-generated columns (AutoGenerateColumns=true). When used together, the explicitly-declared columns in the Columns collection are rendered first, and then the auto-generated columns are rendered. The auto-generated columns are not added to the Columns collection. Column Name Description BoundColumn Lets you control the order and rendering of the columns. HyperLinkColumn Presents the bound data in HyperLink controls. ButtonColumn Bubbles a user command from within a row to an event handler on the grid. TemplateColumn Lets you control which controls are rendered in the column. EditCommandColumn Displays Edit, Update, and Cancel links in response to changes in the DataGrid control's EditItemIndex property. 27) How can we format data inside DataGrid? You can format items in the DataGrid Web server control to customize their appearance. You can Set the color, font, borders, and spacing for the grid as a whole. Set the color, font, and alignment for each type of grid item (row) individually, such as item, alternating item, selected item, header, and footer. Changing these settings allows you to override the settings you make for the entire grid. Set the color, font, and alignment for individual columns. This is particularly useful for setting the appearance of a special-purpose column such as a button column. To set the format for an individual item 1. In Design view, select the DataGrid control, then click the Property Builder link at the bottom of the Properties window. 2. In the DataGrid Properties dialog box, click the Format tab, and under Objects do one of the following: Select Header, Footer, or Pager. -or- Expand the Items node and select the type of item to format. 3. Choose font, color, and alignment options for that item, and then choose Apply. 28) How will decide the design consideration to take a Datagrid, datalist or repeater? 29) Difference between ASP and ASP.NET? 30) What are major events in GLOBAL.ASAX file? What order they are triggered? The global.asax file can be found in the root directory of an ASP.Net application. Here is the list of events you can call. By calling them you are actually overriding the event that is exposed by the HttpApplication base class. Application_Start: used to set up an application environment and only called when the application first starts. Application_Init: This method occurs after _start and is used for initializing code. Application_Disposed: This method is invoked before destroying an instance of an application. Application_Error: This event is used to handle all unhandled exceptions in the application. Application_End: used to clean up variables and memory when an application ends. Application_BeginRequest: This event is used when a client makes a request to any page in the application. It can be useful for redirecting or validating a page request. Application_EndRequest: After a request for a page has been made, this is the last event that is called. Application_PreRequestHandlerExecute: This event occurs just before ASP.Net begins executing a handler such as a page or a web service. At this point, the session state is available. Application_PostRequestHandlerExecute: This event occurs when the ASP.Net handler finishes execution. Application_PreSendRequestHeaders: This event occurs just before ASP.Net sends HTTP Headers to the client. This can be useful if you want to modify a header Application_PreSendRequestContent: This event occurs just before ASP.Net sends content to the client. Application_AcquireRequestState: This event occurs when ASP.Net acquires the current state (eg: Session state) associated with the current request. Application_ReleaseRequestState: This event occurs after ASP.NET finishes executing all request handlers and causes state modules to save the current state data. Application_AuthenticateRequest: This event occurs when the identity of the current user has been established as valid by the security module. Application_AuthorizeRequest: This event occurs when the user has been authorized to access the resources of the security module. Session_Start: this event is

.net interview questions
triggered when any new user accesses the web site. Session_End: this event is triggered when a user's session times out or ends. Note this can be 20 mins (the default session timeout value) after the user actually leaves the site.

29

2005
1.What is the difference between user controls and custom controls? 2.what are the 3 types of session state modes? 3. what are the 6 types of validation controls in ASP.NET? 4.What are the 3 types of caching in ASP.NET? 5.How to Manage state in ASP.NET? 6.What is the difference between overloading and shadowing? 7.what is the difference between overloading and overriding? 8.what is the difference between Manifest and Metadata? 9.What is Boxing and Unboxing? 10.what are the method parameter in c#? 11.what are value types and reference types? 12.what are the two activation modes for .NET Remoting? 13.what's singlecall Activation mode used for ? 14.what's the singleton Activation mode used for? 15.what are the channels and Formatters? 16.What are the two Authentication modes for SQL server connection? 17.What is typed dataset? 18What is DataReader? 19)Difference between Dataset and Recordset? 20)What is Global Assembly cache? 21What is an Assembly, Private Assembly and Shared Assembly? What are the ways to deploy an assembly? 22.what is an Delegate? 23.what are webservices? 24.Define Automatic memory Management: 25.Define Threading: 26Difference Between XML AND HTML? 27.What is XSLT and what is it's use? 28.What is Diffgram/? 29.what is the Role of XSL? 30.What is SAX? 31.What is Safecode and unsafe code? 32.Give a few examples of types of applications that can benefit from using XML. 33.When constructing an XML DTD, how do you create an external entity reference in an attribute value? 34.Give some examples of XML DTDs or schemas that you have worked with. 35.What is SOAP and how does it relate to XML? 36.Explain the concepts of Dataset? 37.Explain the consideration involved in choosing between ADO& ADO.NET?

ValueType vs Reference Types. Value Types inherit from the System.ValueType class, which inturn from System.Object.The value type properties are 1. They are stored in stacks 2. They are accessed directly ie No need to use new operators There is another difference between structs and classes, and this is also the most important to understand. Structs are value types, while classes are reference types, and they are dealt with in different ways. When

.net interview questions

30

a value-type object is created, C# allocates a single space in memory, and puts the contents of the object into it. Primitive types such as int, float, bool or char are also value types, and they are instantiated in the same way. When the runtime deals with a value type, it's dealing directly with its underlying data and this can be very efficient, particularly with primitive types.With reference types, however, an object is created in memory, and then handled through a separate reference – rather like a pointer. Suppose Point is a struct, and Form is a class 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. All value types are derived implicitly from the Object class. Unlike reference types, it is not possible to derive a new type from a value type. However, like reference types, structs can implement interfaces. Unlike reference types, it is not possible for a value type to contain the null value. Each value type has an implicit default constructor that initializes the default value of that type.

Reference Types Variables of reference types, referred to as objects, store references to the actual data.