Professional Documents
Culture Documents
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games | Bookmarks | New Members FAQ | Mentor | C ode C onverter | IT C ompanies | Peer Appraisal | Members | Revenue Sharing | C omputer Jokes | New Posts | Social |
Join our online Google+ community for Bloggers, Content Writers and Webmasters
DotNetSpider
Like 5,446 people like DotNetSpider.
Last 7 Days
Pawan Awasthi (221) Ravindran (186) gandhi (155)
m ore ...
Online Members
Nita Kusuma Dewi Pawan Awasthi Shine S gandhi
More ...
Share
Tw eet
Responses
#62442 Author: Rating: Pritam Baldota Points: 2 Member Level: Gold Member Rank: 0 Date:
10/Jul/2006
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
1/69
3/15/13
Plz see techinterviews.com
also see Dumps which has llive scenario at http://www.pritambaldota.com in Download sections.
adve rtise he re
Email subscription
.NET Jobs .NET Article s .NET Forum s Article s R ss Fe e ds Forum R ss Fe e ds
#62447
Author: Rating:
Member Rank: 39
Date:
10/Jul/2006
Go through Exam question Section in Spider http://himabinduvejella.blogspot.com http://sysntaxhelp.com/asp.net http://groups.google.com/group/mugh Hima's Tech Blog
#62453
Author:
krishna
Date: 10/Jul/2006
Rating:
Points: 2
#62616
Author: Rating:
Member Rank: 39
Date:
11/Jul/2006
#68132
Author:
Member Rank: 66
Date:
09/Aug/2006
Rating:
http://www.andymcm.com => for c# and dot net frame work faqs http://www.syncfusion.com/faq/windowsforms/default.aspx
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
2/69
3/15/13
http://www.c-sharpcorner.com/faq.asp
ASP.net http://msdn.microsoft.com/asp.net/beta2/faq/default.aspx http://www.4guysfromrolla.com/webtech/faq/faqtoc.shtml http://www.syncfusion.com/FAQ/aspnet/Default.aspx http://www.aspnetfaq.com http://www.eggheadcafe.com/articles/20021016.asp http://www.cmap-online.org/Default.aspx?tabindex=4&tabid=-17 DotNetGuts (DNG) DotNetGuts Blog
#308673 Points: 5
Member Rank: 0
Date: 20/Oct/2008
Rating:
For 2 years exp, they didnt ask basic questions of 1-2 line answer, but asks deep questions like 1.Tell algorithm of garbage collector. 2.How to make strong key. 3. whta are different types to make and call webservice. 4. Dataset is refernce type or value type. 5. Use of cashe. 6.Oops concepts for c# in deep. using practical exam. 7.what is static constructor. 8.Need of static constructor. etc.
#311469
Member Rank: 0
Date: 29/Oct/2008
Rating:
Points: 5
1.oops concept--> a.Abstraction b.polymorphism c.Inheritance d.Encapsulation 2.Garbage Collection 3.CLR 4.Joins in SQL 5.diff between function and Sp 6.Diff between custom control and user control 7.Bubbled Event 8.Diff between views and trigger 9.Transaction 10.Ado objects 11.Exception Handling 12.Diff between Arraylist and HashTable 13.Partial class 14.Row number in sql 15.Difference .net 2003.2005,2008 16.Diff between Sqlserver2000 and 2005
#324276
Author:
Bunty
Member Rank: 14
Date: 02/Dec/2008
Rating:
Points: 6
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
3/69
3/15/13
Hi,
A trigger is a block of code that constitutes a set of T-SQL statements that are activated in response to certain actions or conditions. A trigger can also be interpreted as a special kind of stored procedure that is executed whenever an action,such as data modification,takes place. A Trigger is fired whenever data in the underlying table is affected by any of the Data M anipulation Language (DM L) statements -INSERT,UPDATE,OR DELETE. Triggers help in maintaining consistent,reliable,and correct data in tables.They enable the performance of complex actions and cascade these actions to other dependent tables
Regards S.S.Bajoria
#328409 Points: 0
Author: siri
Member Rank: 0
Date: 12/Dec/2008
Rating:
#331460
Author: Rating:
Member Rank: 0
Date:
22/Dec/2008
I found some questions which really help you... 1. What are container classes? 2. Difference between Lists and Arrays 3. Difference between User controls and Custom Controls 4. How sessions are managed in Web applications (In Proc,State Services, Sql State services) 5. How web application authentication is possible through IIS? 6. Purpose of Delegates 7. Difference between value and reference types and how Value types can be converted to reference types? 8. How can we manage to make changes to an already checked out file in VSS 9. What is an abstract class and sealed class? 10. Can an abstract class be instantiated? 11. Why is it better to use SQL stored procedures than writing direct queries in Code?
#333864
Author: rahulagrawal
Member Rank: 0
Date: 31/Dec/2008
Rating:
Points: 1
Do .net Framwork properly... it is the key for any selection. Even I ask more questions on the same. as well as that on IIS operations...
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
4/69
3/15/13
#336968 Author:
Points: 6
What is the base class of .NET? Base class provides a base set of methods that all derived classes can use Explain assemblies. Answer 1: Assemblies are similar to dll files. Both has the reusable pieces of code in the form of classes/ functions. Dll needs to be registered but assemblies have its own metadata. Answer 2: Assembly is a single deployable unit that contains information about the implementation of classes, structures and interfaces. it also stores the information about itself called metadata and includes name and verison of the assembly, security information, information about the dependencies and the list of files that constitute the assembly. Assembly also contains namespaces. In the .Net Framework, applications are deployed in the form of assemblies. Answer 3: An assembly is a single deployable unit that contains all the information about the implementation of : - classes - structures and - interfaces An assembly stores all the information about itself. This information is called METADATA and include the name and the verison number of the assembly, security information, information about the dependencies and a lost of files that constitute the assembly. All the application developed using the .NET framework are made up of assemblies. Namespaces are also stored in assemblies Answer 4: In the Microsoft .NET framework an assembly is a partially compiled code library for use in deployment, versioning and security. In the Microsoft Windows implementation of .NET, an assembly is a PE (portable executable) file. There are two types, process assemblies (EXE) and library assemblies (DLL). A process assembly represents a process which will use classes defined in library assemblies. In version 1.1 of the CLR classes can only be exported from library assemblies; in version 2.0 this restriction is relaxed. The compiler will have a switch to determine if the assembly is a process or library and will set a flag in the PE file. .NET does not use the extension to determine if the file is a process or library. This means that a library may have either .dll or .exe as its extension. The code in an assembly is partially compiled into CIL, which is then fully compiled into machine language at runtime by the CLR. An assembly can consist of one or more files. Code files are called modules. An assembly can contain more than one code module and since it is possible to use different languages to create code modules this means that it is technically possible to use several different languages to create an assembly. In practice this rarely happens, principally because Visual Studio only allows developers to create assemblies that consist of a single code module. Name some of the languages .NET support? Some of the languages that are supported by .NET 1. Visual Basic.NET 2. Visual C# 3. Visual C++ ADO.NET features? Benefits? Drawbacks? Answer 1: 1. Data will be retrieved through Datasets 2. Scalability Answer 2: 1. Disconnected Data Architecture 2. Data cached in Datasets 3. Data transfer in XML format 4. Interaction with the database is done through data commands How many types of exception handlers are there in .NET? Answer 1: From MSDN>gt; How the Runtime Manages Exceptions http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconexceptionsoverview.asp
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
5/69
3/15/13
Difference between Panel and GroupBox classes? Answer 1: Panel and Group box both can used as container for other controls like radio buttons and check box. the difference in panel and group box are Panel 1) In case of panel captions cannot be displayed 2) Can have scroll bars. Group box 1) Captions can be displayed. 2) Cannot have a scroll bar Answer 2: Panel is scrollable. In panel you cant set caption like Group box. What is the base class of Button control? Listing from visual studio .net > Button Class System.Object System.MarshalByRefObject System.ComponentModel.Component System.Windows.Forms.Control System.Windows.Forms.ButtonBase System.Windows.Forms.Button What is Response object? How is it related to ASPs Response object? Response object allows the server to communicate with the client(browser). It is useful for displaying information to the user (or) redirecting the client. Eg: Response.Write(Hello World) hat is IIS? Have you used it? IIS - Internet Information Server IIS is used to access the ASP.Net web applications Yes, I used in ASP.NET web applications. Main differences between ASP and ASP.NET. Answer 1: 1. ASP: Code is Interpreted ASP.NET: Code is Compiled 2. ASP: Business Logic and Presentation Logic are in a single file ASP.NET: Business Logic and Presentation Logic are in separate files (.cs or .vb) and (.aspx) respectively. 3. ASP: No Web Server Controls ASP.NET: Web Server Controls supported by strong .NET Framework 4. ASP: No RAD in Classic ASP ASP.NET: Supports RAD Answer 2: 1.Asp is interpreted Asp.net is compiled which is faster than asp. 2 Asp.net maintains its own CLR and is managed as it runs by CLR Where as asp is unmanaged 3 We can mainatin sessions in state server and sql server which is Outproc, where in asp sessions will be last if we restart webserver or make changes. 4 In asp.net we can configure each application using web.config file which is availble in application itself and we have machine.config wherer we can configure all applications.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
6/69
3/15/13
#336969
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
What are the advantages and drawbacks of using ADO.NET? Pros ==== ADO.NET is rich with plenty of features that are bound to impress even the most skeptical of programmers. If this werent the case, Microsoft wouldnt even be able to get anyone to use the Beta. What weve done here is come up with a short list of some of the more outstanding benefits to using the ADO.NET architecture and the System.Data namespace. * Performance there is no doubt that ADO.NET is extremely fast. The actual figures vary depending on who performed the test and which benchmark was being used, but ADO.NET performs much, much faster at the same tasks than its predecessor, ADO. Some of the reasons why ADO.NET is faster than ADO are discussed in the ADO versus ADO.NET section later in this chapter. * Optimized SQL Provider in addition to performing well under general circumstances, ADO.NET includes a SQL Server Data Provider that is highly optimized for interaction with SQL Server. It uses SQL Servers own TDS (Tabular Data Stream) format for exchanging information. Without question, your SQL Server 7 and above data access operations will run blazingly fast utilizing this optimized Data Provider. * XML Support (and Reliance) everything you do in ADO.NET at some point will boil down to the use of XML. In fact, many of the classes in ADO.NET, such as the DataSet, are so intertwined with XML that they simply cannot exist or function without utilizing the technology. Youll see later when we compare and contrast the old and the new why the reliance on XML for internal storage provides many, many advantages, both to the framework and to the programmer utilizing the class library. * Disconnected Operation Model the core ADO.NET class, the DataSet, operates in an entirely disconnected fashion. This may be new to some programmers, but it is a remarkably efficient and scalable architecture. Because the disconnected model allows for the DataSet class to be unaware of the origin of its data, an unlimited number of supported data sources can be plugged into code without any hassle in the future. * Rich Object Model the entire ADO.NET architecture is built on a hierarchy of class inheritance and interface implementation. Once you start looking for things you need within this namespace, youll find that the logical inheritance of features and base class support makes the entire system extremely easy to use, and very customizable to suit your own needs. It is just another example of how everything in the .NET framework is pushing toward a trend of strong application design and strong OOP implementations. Cons ==== Hard as it may be to believe, there are a couple of drawbacks or disadvantages to using the ADO.NET architecture. Im sure others can find many more faults than we list here, but we decided to stick with a short list of some of the more obvious and important shortcomings of the technology. * Managed-Only Access for a few obvious reasons, and some far more technical, you cannot utilize the ADO.NET architecture from anything but managed code. This means that there is no COM interoperability allowed for ADO.NET. Therefore, in order to take advantage of the advanced SQL Server Data Provider and any other feature like DataSets, XML internal data storage, etc, your code must be running under the CLR. * Only Three Managed Data Providers (so far) unfortunately, if you need to access any data that requires a driver that cannot be
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
7/69
3/15/13
Quote: Managed code is the term used for any code that is running on .NET Framework. The CLR provides the infrastructure that enables managed code to execute as well provides variety of services during execution. When a method, for which IL has been generated, is called for the first time the CLR compiles the IL into native code that is specific to the processor the Environment it is running on (This process is known as Just in Time Compilation or JIT). If the same method is called next time, the existing JIT compiled code is reused. During execution managed code receives variety of services from the runtime environment. Quote: When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code. Intermediate Language is a binary assembly language that is compiled at runtime down to whatever machine language is appropriate for the host CPU. This runtime compilation is called Just-In-Time Compiling or JIT-compiling. Advantages of Managed Execution Environments
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
In unmanaged environments the compiler and linker directly compile the source code in to native instructions that are targeted at
8/69
3/15/13
The CLR is designed for the software of the future, and it also supports software of today and yesterday. Interoperability between managed and unmanaged code provided by CLR helps developers continue to use necessary COM components and DLLs. What is Delegate and what is it used for ? Delegate is kinda like a pointer to a function in C++ or like an event handler in Java You can use it to multicast which means running multiple functions in different instances of object already created. This is useful when you want your objects to register to an event raised by another object. The way it works is the object you are registered to listen to recieves the delegate of the function it is supposed to run in your object, the delegate is then run from it. (if you switch the word delegate for pointer, this would be much simpler) How is meant by DLL ? A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. Basically its an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library. Which DLL translate XML to SQL in IIS? Sqlisapi.dll Can anyone tell me about Secure Socket Layer? How to make use of the technology? Secure Sockets Layer (SSL) and Transport Layer Security (TLS), its successor, are cryptographic protocols which provide secure communications on the Internet. There are slight differences between SSL 3.0 and TLS 1.0, but the protocol remains substantially the same. The term SSL as used here applies to both protocols unless clarified by context.
#336970
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
What is the Differnce Between Response.write & response.output.Write In ASP.NET the Response object is of type HttpResponse and when you say Response.Write youre really saying (basically) HttpContext.Current.Response.Write and calling one of the many overloaded Write methods of HttpResponse. Response.Write then calls .Write() on its internal TextWriter object: public void Write(object obj){ this._writer.Write(obj);} HttpResponse also has a Property called Output that is of type, yes, TextWriter, so: public TextWriter get_Output(){ return this._writer; } Which means you can to the Response whatever a TextWriter will let you. Now, TextWriters support a Write() method ala String.Format, so you can do this:
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
9/69
3/15/13
Response.Output.Write(Scott is {0} at {1:d}, cool,DateTime.Now); But internally, of course, this this is happening: public virtual void Write(string format, params object[] arg) { this.Write(string.Format(format, arg)); } Which dll is required to translate XML to SQL in IIS ? Microsoft.data.sqlxml.dll What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why. Answers1: In a interface class, all methods are abstract without implementation where as in an abstract class some methods we can define concrete. In interface, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers. Interface and abstract class are basically a set of rules which u have to follow in case u r using them(inheriting them). Answers2: Abstract classes are closely related to interfaces. They are classes that cannot be instantiated, and are frequently either partially implemented, or not at all implemented. One key difference between abstract classes and interfaces is that a class may implement an unlimited number of interfaces, but may inherit from only one abstract (or any other kind of) class. A class that is derived from an abstract class may still implement interfaces. Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed. They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code. Answers3: Abstract Classes An abstract class is the one that is not used to create objects. An abstract class is designed to act as a base class (to be inherited by other classes). Abstract class is a design concept in program development and provides a base upon which other classes are built. Abstract classes are similar to interfaces. After declaring an abstract class, it cannot be instantiated on its own, it must be inherited. Like interfaces, abstract classes can specify members that must be implemented in inheriting classes. Unlike interfaces, a class can inherit only one abstract class. Abstract classes can only specify members that should be implemented by all inheriting classes. Answers4: An interface looks like a class, but has no implementation. Theyre great for putting together plug-n-play like architectures where components can be interchanged at will. Think Firefox Plug-in extension implementation. If you need to change your design, make it an interface. However, you may have abstract classes that provide some default behavior. Abstract classes are excellent candidates inside of application frameworks. Answers5: One additional key difference between interfaces and abstract classes (possibly the most important one) is that multiple interfaces can be implemented by a class, but only one abstract class can be inherited by any single class. Some background on this: C++ supports multiple inheritance, but C# does not. Multiple inheritance in C++ has always be controversial, because the resolution of multiple inherited implementations of the same method from different base classes is hard to control and anticipate. C# decided to avoid this problem by allowing a class to implement multiple interfaces, which do not contain method implementations, but restricting a class to have at most a single parent class. Although this can result in redundant implementations of the same method when different classes implement the same interface, it is still an excellent compromise. Another difference between interfaces and abstract classes is that an interface can be implemented by an abstract class, but no class, abstract or otherwise, can be inherited by an interface. Answers6: What is an Abstract class? An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards. What is an Interface? An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesnt support multiple inheritance, interfaces are used to implement multiple inheritance. What is serialization, how it works in .NET?
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
Serialization is when you persist the state of an object to a storage medium so an exact copy can be re-created at a later stage.
10/69
3/15/13
#336972
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 0
What are different methods of session maintenance in ASP.NET? 3 types: In-process storage. Session State Service. Microsoft SQL Server. In-Process Storage The default location for session state storage is in the ASP.NET process itself. Session State Service As an alternative to using in-process storage for session state, ASP.NET provides the ASP.NET State Service. The State Service gives you an out-of-process alternative for storing session state that is not tied quite so closely to ASP. Net's own process. To use the State Service, you need to edit the sessionState element in your ASP.NET applications web.config file: Youll also need to start the ASP.NET State Service on the computer that you specified in the stateConnectionString attribute. The .NET Framework installs this service, but by default its set to manual startup. If youre going to depend on it for storing session
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
state, youll want to change that to automatic startup by using the Services MMC plug-in in the Administrative Tools group.
11/69
3/15/13
Can any object be stored in a Viewstate? An object that either is serializable or has a TypeConverter defined for it can be persisted in ViewState What should you do to store an object in a Viewstate? Do serialization of convert the object to string Explain how Viewstate is being formed and how its stored on client. The type of ViewState is System.Web.UI.StateBag, which is a dictionary that stores name/value pairs. ViewState is persisted to a string variable by the ASP.NET page framework and sent to the client and back as a hidden variable. Upon postback, the page framework parses the input string from the hidden variable and populates the ViewState property of each control. If a control uses ViewState for property data instead of a private field, that property automatically will be persisted across round trips to the client. (If a property is not persisted in ViewState, it is good practice to return its default value on postback.) What do you know about ADO.NETs objects and methods? ADO.NET provides consistent access to data sources such as Microsoft SQL Server, as well as data sources exposed through OLE DB and XML. Data-sharing consumer applications can use ADO.NET to connect to these different data sources and retrieve, manipulate, and update data. ADO.NET provides first-class support for the disconnected, n-tier programming environment for which many new applications are written. Explain DataSet.AcceptChanges and DataAdapter.Update methods. DataAdapter.Update method Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
12/69
3/15/13
deleted row in the DataSet.
#336976
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
How many languages .NET is supporting now? When .NET was introduced it came with several languages. VB.NET, C#, COBOL and Perl, etc. 44 languages are supported. How is .NET able to support multiple languages? A language should comply with the Common Language Runtime standard to become a .NET language. In .NET, code is compiled to Microsoft Intermediate Language (MSIL for short). This is called as Managed Code. This Managed code is run in .NET environment. So after compilation to this IL the language is not a barrier. A code can call or use a function written in another language. How ASP .NET different from ASP? Scripting is separated from the HTML, Code is compiled as a DLL, these DLLs can be executed on the server. What is smart navigation? The cursor position is maintained when the page gets refreshed due to the server side validation and the page gets refreshed. What is view state? The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control How do you validate the controls in an ASP .NET page? Using special validation controls that are meant for this. We have Range Validator, Email Validator. Can the validation be done in the server side? Or this can be done only in the Client side? Client side is done by default. Server side validation is also possible. We can switch off the client side and server side can be done. How to manage pagination in a page? Using pagination option in DataGrid control. We have to set the number of records for a page, then it takes care of pagination by itself. What is ADO .NET and what is difference between ADO and ADO.NET? ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch. Explain the differences between Server-side and Client-side code? Server side scripting means that all the script will be executed by the server and interpreted as needed. ASP doesnt have some of the functionality like sockets, uploading, etc. For these you have to make a custom components usually in VB or VC++. Client side scripting means that the script will be executed immediately in the browser such as form field validation, clock, email validation, etc. Client side scripting is usually done in VBScript or JavaScript. Download time, browser compatibility, and visible code - since JavaScript and VBScript code is included in the HTML page, then anyone can see the code by viewing the page source. Also a possible security hazards for the client computer.
What type of code (server or client) is found in a Code-Behind class? C# Should validation (did the user enter a real date) occur server-side or client-side? Why? Client-side validation because there is no need to request a server side date when you could obtain a date from the client
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
13/69
3/15/13
machine.
What does the "EnableViewState" property do? Why would I want it on or off? Enable ViewState turns on the automatic state management feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not. For example, if you are binding a control to data on every round trip (as in the datagrid example in tip #4), then you do not need the control to maintain its view state, since you will wipe out any re-populated data in any case. ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? Server.Transfer() : client is shown as it is on the requesting page only, but the all the content is of the requested page. Data can be persist across the pages using Context.Item collection, which is one of the best way to transfer data from one page to another keeping the page state alive. Response.Dedirect() :client know the physical location (page name and query string as well). Context.Items loses the persistence when navigate to destination page. In earlier versions of IIS, if we wanted to send a user to a new Web page, the only option we had was Response.Redirect. While this method does accomplish our goal, it has several important drawbacks. The biggest problem is that this method causes each page to be treated as a separate transaction. Besides making it difficult to maintain your transactional integrity, Response.Redirect introduces some additional headaches. First, it prevents good encapsulation of code. Second, you lose access to all of the properties in the Request object. Sure, there are workarounds, but theyre difficult. Finally, Response.Redirect necessitates a round trip to the client, which, on high-volume sites, causes scalability problems. As you might suspect, Server.Transfer fixes all of these problems. It does this by performing the transfer on the server without requiring a roundtrip to the client. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced .NET component? When to Use Web Services: * Communicating through a Firewall When building a distributed application with 100s/1000s of users spread over multiple locations, there is always the problem of communicating between client and server because of firewalls and proxy servers. Exposing your middle tier components as Web Services and invoking the directly from a Windows UI is a very valid option. * Application Integration When integrating applications written in various languages and running on disparate systems. Or even applications running on the same platform that have been written by separate vendors. * Business-to-Business Integration This is an enabler for B2B integration which allows one to expose vital business processes to authorized supplier and customers. An example would be exposing electronic ordering and invoicing, allowing customers to send you purchase orders and suppliers to send you invoices electronically. * Software Reuse This takes place at multiple levels. Code Reuse at the Source code level or binary component-based reuse. The limiting factor here is that you can reuse the code but not the data behind it. Webservice overcome this limitation. A scenario could be when you are building an app that aggregates the functionality of several other Applications. Each of these functions could be performed by individual apps, but there is value in perhaps combining the multiple apps to present a unified view in a Portal or Intranet. * When not to use Web Services: Single machine Applications When the apps are running on the same machine and need to communicate with each other use a native API. You also have the options of using component technologies such as COM or .NET Components as there is very little overhead. * Homogeneous Applications on a LAN If you have Win32 or Winforms apps that want to communicate to their server counterpart. It is much more efficient to use DCOM in the case of Win32 apps and .NET Remoting in the case of .NET Apps.
#336977
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
Can you explain the difference between an ADO.NET Dataset and an ADO Recordset? In ADO, the in-memory representation of data is the RecordSet. In ADO.NET, it is the dataset. There are important differences between them. * A RecordSet looks like a single table. If a recordset is to contain data from multiple database tables, it must use a JOIN query, which assembles the data from the various database tables into a single result table. In contrast, a dataset is a collection of one or more tables. The tables within a dataset are called data tables; specifically, they are DataTable objects. If a dataset contains data from multiple database tables, it will typically contain multiple DataTable objects. That is, each DataTable object typically corresponds to a single database table or view. In this way, a dataset can mimic the structure of the underlying database. A dataset usually also contains relationships. A relationship within a dataset is analogous to a foreign-key relationship in a database that is, it associates rows of the tables with each other. For example, if a dataset contains a table about investors and
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
14/69
3/15/13
* Minimized Open Connections: In ADO.NET you open connections only long enough to perform a database operation, such as a Select or Update. You can read rows into a dataset and then work with them without staying connected to the data source. In ADO the recordset can provide disconnected access, but ADO is designed primarily for connected access. There is one significant difference between disconnected processing in ADO and ADO.NET. In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. The important difference is that in ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database by optimizing for performance, performing data validation checks, or adding any other extra processing. Data adapters, data connections, data commands, and data readers are the components that make up a .NET Framework data provider. Microsoft and third-party providers can make available other .NET Framework data providers that can be integrated into Visual Studio. * Sharing Data Between Applications. Transmitting an ADO.NET dataset between applications is much easier than transmitting an ADO disconnected recordset. To transmit an ADO disconnected recordset from one component to another, you use COM marshalling. To transmit data in ADO.NET, you use a dataset, which can transmit an XML stream. * Richer data types.COM marshalling provides a limited set of data types those defined by the COM standard. Because the transmission of datasets in ADO.NET is based on an XML format, there is no restriction on data types. Thus, the components sharing the dataset can use whatever rich set of data types they would ordinarily use. * Performance. Transmitting a large ADO recordset or a large ADO.NET dataset can consume network resources; as the amount of data grows, the stress placed on the network also rises. Both ADO and ADO.NET let you minimize which data is transmitted. But ADO.NET offers another performance advantage, in that ADO.NET does not require data-type conversions. ADO, which requires COM marshalling to transmit records sets among components, does require that ADO data types be converted to COM data types. * Penetrating Firewalls.A firewall can interfere with two components trying to transmit disconnected ADO recordsets. Remember, firewalls are typically configured to allow HTML text to pass, but to prevent system-level requests (such as COM marshalling) from passing. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines? The Application_Start event is guaranteed to occur only once throughout the lifetime of the application. Its a good place to initialize global variables. For example, you might want to retrieve a list of products from a database table and place the list in application state or the Cache object. SessionStateModule exposes both Session_Start and Session_End events. If Im developing an application that must accomodate multiple security levels though secure login and my ASP.NET web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users? What are ASP.NET Web Forms? How is this technology different than what is available though ASP? Web Forms are the heart and soul of ASP.NET. Web Forms are the User Interface (UI) elements that give your Web applications their look and feel. Web Forms are similar to Windows Forms in that they provide properties, methods, and events for the controls that are placed onto them. However, these UI elements render themselves in the appropriate markup language required by the request, e.g. HTML. If you use Microsoft Visual Studio .NET, you will also get the familiar drag-and-drop interface used to create your UI for your Web application. How does VB.NET/C# achieve polymorphism? By using Abstract classes/functions. Can you explain what inheritance is and an example of when you might use it?
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
15/69
3/15/13
Where would you use an iHTTPModule, and what are the limitations of anyapproach you might take in implementing one? One of ASP.NETs 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. In what order do the events of an ASPX page execute. As a developer is it important to understand these events? Every Page object (which your .aspx page is) has nine events, most of which you will not have to worry about in your day to day dealings with ASP.NET. The three that you will deal with the most are: Page_Init, Page_Load, Page_PreRender. Which method do you invoke on the DataAdapter control to load your generated dataset with data? System.Data.Common.DataAdapter.Fill(System.Data.DataSet); If my DataAdapter is sqlDataAdapter and my DataSet is dsUsers then it is called this way: sqlDataAdapter.Fill(dsUsers); Which template must you provide, in order to display data in a Repeater control? ItemTemplate How can you provide an alternating color scheme in a Repeater control? AlternatingItemTemplate Like the ItemTemplate element, but rendered for every other row (alternating items) in the Repeater control. You can specify a different appearance for the AlternatingItemTemplate element by setting its style properties. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control? You must set the DataMember property which Gets or sets the specific table in the DataSource to bind to the control and the DataBind method to bind data from a source to a server control. This method is commonly used after retrieving a data set through a database query. What base class do all Web Forms inherit from? System.Web.UI.Page What method do you use to explicitly kill a users session?
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
The Abandon method destroys all the objects stored in a Session object and releases their resources.
16/69
3/15/13
How do you create a permanent cookie? Setting the Expires property to MinValue means that the Cookie never expires. Which method do you use to redirect the user to another page without performing a round trip to the client? Server.transfer()
#336978
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
What is the transport protocol you use to call a Web service? Answer1: SOAP. Transport Protocols: It is essential for the acceptance of Web Services that they are based on established Internet infrastructure. This in fact imposes the usage of of the HTTP, SMTP and FTP protocols based on the TCP/IP family of transports. Messaging Protocol: The format of messages exchanged between Web Services clients and Web Services should be vendor neutral and should not carry details about the technology used to implement the service. Also, the message format should allow for extensions and different bindings to specific transport protocols. SOAP and ebXML Transport are specifications which fulfill these requirements. We expect that the W3C XML Protocol Working Group defines a successor standard. Answer2: SOAP is not the transport protocol. SOAP is the data encapsulation protocol that is used but the transport protocol is fairly unlimited. Generally HTTP is the most common transport protocol used though you could conceivanly use things like SMTP or any others. SOAP is not dependant on any single transport protocol or OS, it is a syntactical and logical definition, not a transport protocol. True or False: A Web service can only be written in .NET.? False. What does WSDL stand for? Web Services Description Language Where on the Internet would you look for Web services? UDDI repositaries like uddi.microsoft.com, IBM UDDI node, UDDI Registries in Google Directory, enthusiast sites like XMethods.net. What tags do you need to add within the asp:datagrid tags to bind columns manually? Column tag and an ASP:databound tag. How is a property designated as read-only? In VB.NET: Public ReadOnly Property PropertyName As ReturnType Get Your Property Implementation goes in here End Get End Property in C# public returntype PropertyName { get{ //property implementation goes here } // Do not write the set implementation }
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
17/69
3/15/13
}
Which control would you use if you needed to make sure the values in two different controls matched? Use the CompareValidator control to compare the values of 2 different controls. True or False: To test a Web service you must create a windows application or Web application to consume this service? False. How many classes can a single .NET DLL contain? Unlimited. Describe session handling in a webfarm, how does it work and what are the limits? Set the sessionState mode in the web.config file to StateServer. StateServer mode uses an out-of-process Windows NT Server to store state information. It solves the session state loss problem in InProc mode. Allows a webfarm to store session on a central server. It provides a Single point of failure at the State Server. Follow these simple steps: - In a web farm, make sure you have the same in all your web servers. - Also, make sure your objects are serializable. - For session state to be maintained across different web servers in the web farm, the Application Path of the website in the IIS Metabase should be identical in all the web servers in the web farm. What are the disadvantages of viewstate/what are the benefits? Answer1: Disadvantage of viewstate is that additional data is sent to the browser. The benefits are that you do not have to manually manage refreshing the page fields after a submit, (when re-displaying the same page). Answer2: Automatic view-state management is a feature of server controls that enables them to repopulate their property values on a round trip (without you having to write any code). This feature does impact performance, however, since a server controls view state is passed to and from the server in a hidden form field. You should be aware of when view state helps you and when it hinders your pages performance. What tags do you need to add within the asp:datagrid tags to bind columns manually? Answer1: Set AutoGenerateColumns Property to false on the datagrid tag Answer2: tag and either or tags (with appropriate attributes of course) What is State Management in .Net and how many ways are there to maintain a state in .Net? What is view state? Web pages are recreated each time the page is posted to the server. In traditional Web programming, this would ordinarily mean that all information associated with the page and the controls on the page would be lost with each round trip. To overcome this inherent limitation of traditional Web programming, the ASP.NET page framework includes various options to help you preserve changes that is, for managing state. The page framework includes a facility called view state that automatically preserves property values of the page and all the controls on it between round trips. However, you will probably also have application-specific values that you want to preserve. To do so, you can use one of the state management options. Client-Based State Management Options: View State Hidden Form Fields Cookies Query Strings Server-Based State Management Options Application State Session State Database Support What tag do you use to add a hyperlink column to the DataGrid? Depends on whos definition of hyperlink your using. Manually a std html anchor tag (a) will work or you can use the micromagical tag What is the standard you use to wrap up a call to a Web service? Several possible answers depending on your interpretation of the quesiton, but I think you were aiming for SOAP (with the caveat that this is MSs version of SOAP)
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
18/69
3/15/13
Describe the difference between a Thread and a Process? Answer1: Thread - is used to execute more than one program at a time. process - executes single program Answer2: A thread is a path of execution that run on CPU, a proccess is a collection of threads that share the same virtual memory. A process have at least one thread of execution, and a thread always run in a process context. Answer3: The operating system creates a process for the purpose of running a program. Each process executes a single program. Processes own resources allocated by the operating system. Resources include memory, file handles, sockets, device handles, and windows. Processes do not share address spaces or file resources except through explicit methods such as inheriting file handles or shared memory segments, or mapping the same file in a shared way. Threads allow a program to do multiple things concurrently. At least one thread exists within each process. If multiple threads can exist within a process, then they share the same memory and file resources. Answer4: Thread is a light weight process, which is initialized itself by a process. Light weigt processes does not loads resources required by it itself, these are loaded by its parent process which has generated it. What is a Windows Service and how does its lifecycle differ from a standard EXE? Windows Service applications are long-running applications that are ideal for use in server environments. The applications do not have a user interface or produce any visual output; it is instead used by other programs or the system to perform operations. Any user messages are typically written to the Windows Event Log. Services can be automatically started when the computer is booted. This makes services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer. They do not require a logged in user in order to execute and can run under the context of any user including the system. Windows Services are controlled through the Service Control Manager where they can be stopped, paused, and started as needed.
#336979
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
What is the difference between an EXE and a DLL? An EXE can run independently, whereas DLL will run within an EXE. DLL is an in-process file and EXE is an out-process file What is strong-typing versus weak-typing? Which is preferred? Why? Strong type is checking the types of variables as soon as possible, usually at compile time. While weak typing is delaying checking the types of the system as late as possible, usually to run-time. Which is preferred depends on what you want. For scripts & quick stuff youll usually want weak typing, because you want to write as much less code as possible. In big programs, strong typing can reduce errors at compile time. What are PDBs? Where must they be located for debugging to work? Answer1: To debug precompiled components such as business objects and code-behind modules, you need to generate debug symbols. To do this, compile the components with the debug flags by using either Visual Studio .NET or a command line compiler such as Csc.exe (for Microsoft Visual C# .NET) or Vbc.exe (for Microsoft Visual Basic .NET). Using Visual Studio .NET 1. Open the ASP.NET Web Application project in Visual Studio .NET. 2. Right-click the project in the Solution Explorer and click Properties. 3. In the Properties dialog box, click the Configuration Properties folder. 4. In the left pane, select Build. 5. Set Generate Debugging Information to true. 6. Close the Properties dialog box.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
19/69
3/15/13
7. Right-click the project and click Build to compile the project and generate symbols (.pdb files). Answer2: A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program. The linker creates project.PDB, which contains debug information for the projects EXE file. The project.PDB contains full debug information, including function prototypes, not just the type information found in VCx0.PDB. Both PDB files allow incremental updates. They should be located at bin\Debug directory What is cyclomatic complexity and why is it important? Cyclomatic complexity is a computer science metric (measurement) developed by Thomas McCabe used to generally measure the complexity of a program. It directly measures the number of linearly independent paths through a programs source code. The concept, although not the method, is somewhat similar to that of general text complexity measured by the Flesch-Kincaid Readability Test. Cyclomatic complexity is computed using a graph that describes the control flow of the program. The nodes of the graph correspond to the commands of a program. A directed edge connects two nodes, if the second command might be executed immediately after the first command. By definition, CC = E - N + P where CC = cyclomatic complexity E = the number of edges of the graph N = the number of nodes of the graph P = the number of connected components. What is FullTrust? Do GACed assemblies have FullTrust? Your code is allowed to do anything in the framework, meaning that all (.Net) permissions are granted. The GAC has FullTrust because its on the local HD, and that has FullTrust by default, you can change that using caspol What does this do? gacutil /l | find /i about Answer1: This command is used to install strong typed assembly in GAC Answer2: gacutil.exe is used to install strong typed assembly in GAC. gacutil.exe /l is used to lists the contents of the global assembly cache. |(pipe) symbol is used to filter the output with another command. find /i about is to find the text about on gacutil output. If any lines contains the text about then that line will get displayed on console window. Contrast OOP and SOA. What are tenets of each Service Oriented Architecture. In SOA you create an abstract layer that your applications use to access various services and can aggregate the services. These services could be databases, web services, message queues or other sources. The Service Layer provides a way to access these services that the applications do not need to know how the access is done. For example, to get a full customer record, I might need to get data from a SGL Server database, a web service and a message queue. The Service layer hides this from the calling application. All the application knows is that it asked for a full customer record. It doesnt know what system or systems it came from or how it was retrieved. How does the XmlSerializer work? What ACL permissions does a process using it require? XmlSerializer requires write permission to the systems TEMP directory. Why is catch(Exception) almost always a bad idea? Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project. What is the difference between Debug. Write and Trace. Write? When should each be used? Answer1: The Debug. Write call wont be compiled when the DEBUG symbol is not defined (when doing a release build). Trace. Write calls will be compiled. Debug. Write is for information you want only in debug builds, Trace. Write is for when you want it in release build as well. And in any case, you should use something like log4net because that is both faster and better Answer2: Debug. Write & Trace. write - both works in Debug mode, while in Release Mode,Trace.write only will work .Try changing the Active Config property of Solution in Property page nd find the difference. Debug.write is used while debugging a project and Trace.write is used in Released version of Applications.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
20/69
3/15/13
#336980
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
What is the difference between a.Equals(b) and a == b? Answer1: a=b is used for assigning the values (rather then comparison) and a==b is for comparison. Answer2: a == b is used to compare the references of two objects a.Equals(b) is used to compare two objects Answer3: A equals b -> copies contents of b to a a == b -> checks if a is equal to b Answer4: Equals method compares both type and value of the variable, while == compares value. int a = 0; bool b = 0 if(a.Equals(b)) Answer5: a.Equals(b) checks whether the Type of a is equal to b or not! Put it in another way, Dim a As Integer = 1 Dim b As Single = 1 a.Equals(b) returns false. The Equals method returns a boolean value. a == b is a simple assignment statement. Answer6: a.equals(b) will check whether the b has same type as a has and also has the same data as a has. a==b will do the same thing. if you have done this in c++ under operator overloading than you guys must be aware of this sytaxts. they are doing the same thing there is only sytaxtical difference. let me explain it in different manner. a==b : means compare b with a. always left hand side expression evaluated first so here in this case a (considered an object) will call the overloaded operator = which defines Equals(object) method in its class. thus, ultimately a.equals(b) goanna called. so the answer is: both will perform the same task. they are different by syntaxt Answer7: Difference b/w a==b,a.Equals(b) a.Equals(b): The default implementation of Equals supports reference equality only, but derived classes can override this method to support
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
21/69
3/15/13
The default implementation of Equals supports reference equality only, but derived classes can override this method to support value equality. For reference types, equality is defined as object equality; that is, whether the references refer to the same object. For value types, equality is defined as bitwise equality == : For predefined value types, the equality operator (==) returns true if the values of its operands are equal, false otherwise. For reference types other than string, == returns true if its two operands refer to the same object. For the string type, == compares the values of the strings. How would one do a deep copy in .NET? Answer1: System.Array.CopyTo() - Deep copies an Array Answer2: How would one do a deep copy in .NET? The First Approach. 1.Create a new instance. 2.Copy the properties from source instance to newly created instance. [Use reflection if you want to write a common method to achive this] The Second Approach. 1. Serialize the object and deserialize the output. : Use binary serialization if you want private variables to be copied. : Use xml Serialization if you dont want private variable to be copied. What is boxing? Boxing is an implicit conversion of a value type to the type object int i = 123; // A value type Object box = i // Boxing Unboxing is an explicit conversion from the type object to a value type int i = 123; // A value type object box = i; // Boxing int j = (int)box; // Unboxing Is string a value type or a reference type? Answer1: String is Reference Type. Value type - bool, byte, chat, decimal, double, enum , float, int, long, sbyte, short,strut, uint, ulong, ushort Value types are stored in the Stack Reference type - class, delegate, interface, object, string Reference types are stored in the Heap
Answer2: Yes String is reference type. C# gives two types of variable reference and value type. string and object are reference type. How does the lifecycle of Windows services differ from Standard EXE? Windows services lifecycle is managed by Service Control Manager which is responsible for starting and stopping the service and the applications do not have a user interface or produce any visual output, but Standard executable doesnt require Control Manager and is directly related to the visual output Whats wrong with a line like this? DateTime.Parse(myString) the result returned by this function is not assigned to anything, should be something like varx = DateTime.Parse(myString) NET is Compile Time OR RunTime Environment? .Nets framework has CLS,CTS and CLR.CTS checks declartion of types at the time when u write code and CLS defines some rules and restrictions.and CLR comile everything at runtime with following benefits: Vastly simplified development Seamless integration of code written in various languages Evidence-based security with code identity Assembly-based deployment that eliminates DLL Hell Side-by-side versioning of reusable components Code reuse through implementation inheritance Automatic object lifetime management Self describing objects Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process. inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
22/69
3/15/13
#336981
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
To test a Web Service you must create a windows application or web application to consume this service? It is True/False? FALSE How many classes can a single.NET DLL contain? Answer1: As many Answer2: One or more What are good ADO.NET object(s) to replace the ADO Recordset object? The differences includes In ADO, the in-memory representation of data is the Recordset. In ADO.net, it is the dataset A recordset looks like a single table in ADO In contrast, a dataset is a collection of one or more tables in ADO.net ADO is designed primarily for connected access ADO.net the disconnected access to the database is used In ADO you communicate with the database by making calls to an OLE DB provider. In ADO.NET you communicate with the database through a data adapter (an OleDbDataAdapter, SqlDataAdapter, OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
23/69
3/15/13
OdbcDataAdapter, or OracleDataAdapter object), which makes calls to an OLE DB provider or the APIs provided by the underlying data source. In ADO you cant update the database from the recordset. ADO.NET the data adapter allows you to control how the changes to the dataset are transmitted to the database. On order to get assembly info which namespace we should import? System.Reflection Namespace How do you declare a static variable and what is its lifetime? Give an example. Answer1 static int MyintThe life time is during the entire application. br> Answer2 The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs. Example a. Static int var //in c#.net b. static void Time( ) //in c#.net How do you get records number from 5 to 15 in a dataset of 100 records? Write code. Answer1 DataSet ds1=new DataSet(); String strCon=data source=IBM-6BC8A0DACEF;initial catalog=pubs;integrated security=SSPI;persist + security info=False;user id=sa;workstation id=IBM-6BC8A0DACEF;packet size=4096?; String strCom1=SELECT * FROM employee; SqlDataAdapter sqlDa1=new SqlDataAdapter(strCom1,strCon); ds1.Tables.Add(employee); sqlDa1.Fill(ds1,40,50,ds1.Tables[employee].TableName); DataGrid dg1.DataSource=ds1.Tables[employee].DefaultView; dg1.DataBind();
Answer2 OleDbConnection1.Open() OleDbDataAdapter1.Fill(DataSet21, 5, 15, tab) This will fill the dataset with the records starting at 5 to 15 How do you call and execute a Stored Procedure in .NET? Give an example. Answer1 ds1=new DataSet(); sqlCon1=new SqlConnection(connectionstring); String strCom1=byroyalty; sqlCom1=new SqlCommand(strCom1,sqlCon1); sqlCom1.CommandType=CommandType.StoredProcedure; sqlDa1=new SqlDataAdapter(sqlCom1); SqlParameter myPar=new SqlParameter(@percentage,SqlDbType.Int); sqlCom1.Parameters.Add (myPar); myPar.Value=40; sqlDa1.Fill(ds1); dg1.DataSource=ds1; dg1.DataBind(); Answer2 Yes
Dim cn as new OleDbConnection ( Provider=Microsoft.Jet.OLEDB.4.0;+ _ Data Source=C:\Documents and Settings\User\My Documents\Visual Studio Projects\1209\db1.mdb+ _ User ID=Admin;+ _ Password=;); Dim cmd As New OleDbCommand(Products, cn)
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
24/69
3/15/13
#336985
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
How can you deploy an asp.net application ? You can deploy an ASP.NET Web application using any one of the following three deployment options. a) Deployment using VS.NET installer b) Using the Copy Project option in VS .NET
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
25/69
3/15/13
c) XCOPY Deployment
Explain similarities and differences between Java and .NET? Comparing Java and .NET is comparing apples and oranges. Either the question needs to be to compare Java and C# or J2EE and .NET. What are the XML files that are important in developing an ASP.NET application? The XML file necessary for the for developing an asp.net application is Web.config Specify the best ways to store variables so that we can access them in various pages of ASP.NET application? Declare the variables in Global.aspx How many objects are there in ASP? Answer1 8 objects, they are request,response, server,application,session,file, dictionary, textstream. Answer2 There are 6 objects in ASP.net a) Server b) Session c) Application d) ObjectContext e) Response f) Request Which DLL file is needed to be registered for ASP? The dll needed for the ASP.net is SYSTEM.WEB.dll
Is there any inbuilt paging (for example shoping cart, which will show next 10 records without refreshing) in ASP? How will you do pating? Use DataGrid control which has in-built paging features for the purpose. What does Server.MapPath do? Answer1 srver.mappath() maps the path given in the argument to the servers physical path. Answer2 It returns the complete(absolute) path of the file used in parameter. Answer3 It returns a string containing the physical path in the servers file system that corresponds to the virtual or relative path specified by the Path argument. Name atleast three methods of response object other than Redirect. Answer1 a) Response.Clear( ) Clears the content of the current output stream. b) Response.Close( ) Closes the network socket for the current response. c) Response.End( ) Stops processing the current request and sends all buffered content to the client immediately. Answer2 methods of Response is Redirect a. Transfer
Name atleast two methods of response object other than Transfer. a) Response.ClearContent( ) Clears the content of the current output stream. b) Response.ClearHeaders( ) Clears the HTTP headers from the current output stream. What is State? It is the property of the web forms.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
26/69
3/15/13
ASP.NET provides four types of state: Application state Session state Cookie state View state.
Explain differences between ADO and DAO. dao- can access only access database ado- can access any databases
How many types of cookies are there? 2 types, persistant and impersistant. How many types of cookies are there? Answer1 Two type of cookeies. a) single valued eg request.cookies(UserName).value=Mahesh b)Multivalued cookies. These are used in the way collections are used. e.g. request.cookies(CookiName)(UserName)=Mahesh request.cookies(CookiName)(UserID)=ABC003? rember no value method in multivalued cookie Answer2 There are two types of cookies: Session cookies Persistent cookies Tell few steps for optimizing (for speed and resource) ASP page/application. Avoid mixing html code with asp code
Which command using Query Analyzer will give you the version of SQL Server and Operating System? @@VERSION Returns version, processor architecture, build date, and operating system for the current installation of SQL Server. How to find the SQL server version from Query Analyzer ? Answer1 To determine which version of Microsoft SQL Server 2005 is running, connect to SQL Server 2005 by using SQL Server Management Studio, and then run the following Transact-SQL statement: SELECT SERVERPROPERTY(productversion), SERVERPROPERTY (productlevel), SERVERPROPERTY (edition) The results are: The product version (for example, 9.00.1399.06?) . The product level (for example, RTM). The edition (for example, Enterprise Edition). For example, the result looks similar to: 9.00.1399.06 RTM Enterprise Edition How to determine which version of SQL Server 2000 is running To determine which version of SQL Server 2000 is running, connect to SQL Server 2000 by using Query Analyzer, and then run the following code: SELECT SERVERPROPERTY(productversion), SERVERPROPERTY (productlevel), SERVERPROPERTY (edition) The results are: The product version (for example, 8.00.534). The product level (for example, RTM or SP2?). The edition (for example, Standard Edition). For example, the result looks similar to : 8.00.534 RTM Standard Edition Answer2 One can also use SELECT @@Version where the result would look like Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 5.1 (Build 2600: Service Pack 2)
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
27/69
3/15/13
#336986
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
Using query analyzer, name 3 ways you can get an accurate count of the number of records in a table. Answer1. a. Select count(*) from table1 b. SELECT object_name(id) ,rowcnt FROM sysindexes WHERE indid IN (1,0) AND OBJECTPROPERTY(id, IsUserTable) = 1 c. exec sp_table_validation @table = authors Answer2. SELECT count( * ) as totalrecords FROM employee This will display total records under the name totalrecords in the table employee use COUNT_BIG Returns the number of items in a group. @@ROWCOUNT Returns the number of rows affected by the last statement. Use this statement after an SQL select * statement, to retrieve the total number of rows in the table What is the purpose of using COLLATE in a query? Answer1. Collation refers to a set of rules that determine how data is sorted and compared. Character data is sorted using rules that define the correct character sequence, with options for specifying case-sensitivity, accent marks, kana character types and character width. Answer2. COLLATE is a clause that can be applied to a database definition or a column definition to define the collation, or to a character string expression to apply a collation cast. What is one of the first things you would do to increase performance of a query? For example, a boss tells you that a query that ran yesterday took 30 seconds, but today it takes 6 minutes? Answer1. Use Storedprocedure for any optimized result, because it is an compiled code. Answer2. One of the best ways to increase query performance is to use indexes. What is an execution plan? When would you use it? How would you view the execution plan? The Query Analyzer has a feature called Show Execution Plan. This option allows you to view the execution plan used by SQL Servers Query Optimizer to actually execute the query. This option is available from the Query menu on the main menu of Query Analyzer, and must be turned on before the query is executed. Once the query is executed, the results of the execution plan are displayed in graphical format in a separate window, available from a tab that appears below the query results window on the screen. What is the STUFF function and how does it differ from the REPLACE function? Answer1: stuff-> inserts into it without removing any thing. Replace->replace the given text with the new one.
Answer2: STUFF - it deletes a specified length of characters and inserts another set of characters at a specified starting point. REPLACE Replaces all occurrences of a specified string value with another string value. What does it mean to have quoted_identifier on? What are the implications of having it off? SET QUOTED_IDENTIFIER ON- Causes SQL Server to follow the SQL-92 rules regarding quotation mark delimiting identifiers and literal strings. Identifiers delimited by double quotation marks can be either Transact-SQL reserved keywords or can contain characters not usually allowed by the Transact-SQL syntax rules for identifiers. What is the difference between a Local temporary table and a Global temporary table? How is each one used? Answer1: Local templrary table will have a single # (#tablename) appended with the table name.Global templrary table will have Double # (##tablename) appended with the table name.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
28/69
3/15/13
Ex:create table #table1
#336987
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
What is indexing? If we give proper indexes on a table so that any queries written against this table can run efficiently. As your data sets grow over time, SQL Server will continue to rebuild indexes and move data around as efficiently as possible. This property is known as Indexing. Explain differences between Server.Transfer and server.execute method? Answer1: server.transfer-> transfers the servers control to the requested page given in the parameter. server.Execute-> executes the requested page from the current page itself, with no change in the address bar. after execution the next line of code is executed in the current page. Answer2. Execute method returns control to the page in which it is called once the page specified in the Execute method finishes processing, the Transfer method does not return control to the calling page. What is de-normalization? When do you do it and how? De-normalization is the process of attempting to optimize the performance of a database by adding redundant data. Its used To introduce redundancy into a table in order to incorporate data from a related table. The related table can then be eliminated. Denormalization can improve efficiency and performance by reducing complexity in a data warehouse schema. Explain features of SQL Server like Scalability , Availability, Integration with Internet. Scalability - The same Microsoft SQL Server 2000 database engine operates on Microsoft Windows 2000 Professional, Microsoft Windows 2000 Server, Microsoft Windows 2000 Advanced Server, Windows 98, and Windows Millennium Edition. It also runs on all editions of Microsoft Windows NT version 4.0. The database engine is a robust server that can manage terabyte-sized databases accessed by thousands of users. Availability - SQL Server 2000 can maintain the extremely high levels of availability required by large Web sites and enterprise systems. Integration -The SQL Server 2000 TCP/IP Sockets communications support
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
29/69
3/15/13
What is OLAP? OLAP is an acronym for On Line Analytical Processing. It is an approach to quickly provide the answer to analytical queries that are dimensional in nature. How do we upgrade SQL Server 7.0 to 2000? Run the installation of the SQL Server 2000 In the Existing Installation dialog box, click Upgrade your existing installation, and then click Next. In the Upgrade dialog box, you are prompted as to whether you want to proceed with the requested upgrade. Click Yes, upgrade my to start the upgrade process, and then click Next. The upgrade runs until finished. In the Connect to Server dialog box, select an authentication mode, and then click Next. If you are not sure which mode to use, accept the default: The Windows account information I use to log on to my computer with (Windows). In Start Copying Files dialog box, click Next. Now your Sql Server would be upgraded. What is job? It can be defined as a task performed by a computer system. For example, printing a file is a job. Jobs can be performed by a single program or by a collection of programs. What is Task? Whenever you execute a program, the operating system creates a new task for it. The task is like an envelope for the program: it identifies the program with a task number and attaches other bookkeeping information to it. How do you find the error, how can you know the number of rows affected by last SQL Statement? Answer1 @@errors->give the last error occurred in the current DB. Ans. select @@rowcount Answer2. Use @@ERROR which returns the error number for the last Transact-SQL statement executed fro knowing the error. Use @@ROWCOUNT which returns the number of rows affected by the last statement for finding the no of rows affected. What are the advantages/disadvantages of viewstate? Disadvantages - Because the view state for a given page must be kept on the server, it is possible for the current state to be out of synchronization with the current page of the browser, if the user uses the Back feature on the browser to go back in the history. Advantages - On ordinary Web Forms pages, their view state is sent by the server as a hidden variable in a form, as part of every response to the client, and is returned to the server by the client as part of a postback. However, to reduce bandwidth demand when using mobile controls, ASP.NET does not send a pages view state to the client. Instead, the view state is saved as part of a users session on the server. Where there is a view state, a hidden field that identifies this pages view state is sent by the server as part of every response to the client, and is returned to the server by the client as part of the next request.
#336988
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
Describe session handling in webform. How does it work and what are the limits? Session management in ASP.NET can be done in two ways: Using Cookies Encoding of URLs with Session ID Explain differences between framework 1.0 and framework 1.1? 1. Native Support for Developing Mobile Web Applications 2. Unified Programming Model for Smart Client Application Development 3. Enable Code Access Security for ASP.NET Applications 4. Native Support for Communicating with ODBC and Oracle Databases 5. Supports for IPv6 If we write any code for dataGrid methods, what is the access specifier used for that methods in the code behind file and why and
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
30/69
3/15/13
If we write any code for dataGrid methods, what is the access specifier used for that methods in the code behind file and why and how? Give an example. We use Friends Modifer for the dataGrid methods. Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid What is the use of trace utility? Tracing is a very important monitoring and debugging tool for distributed, multitier applications. Such applications often contain problems that can only be observed when the application is under a heavy load and the inherent randomness of a real-life environment. Trace utility allows developers and administrators to monitor the health of applications running in real-life settings. What are the differences between User control and Web control and Custom control? Answer1: Usercontrol-> control that is created as u wish. Web Control-> any control placed in web page (web application page) Custom Control-> same as user control with some difference. user control custome control 1.easy to create difficult 2.no full suport for customers using Visual studio tools Full support 3. Seperate copy of the control in each assembly only one copy in global assembly. 4. best for static layout best for dynamic layout.
Answer2 User control 1) Reusability web page 2) We cant add to toolbox 3) Just drag and drop from solution explorer to page (aspx) 4) Good for static layout 5) Easier to create 6) Not complied into DLL Custom controls 1) Reusability of control (or extend functionalities of existing control) 2) We can add toolbox 3) Just drag and drop from toolbox 4) You can register user control to. Aspx page by Register tag 5) A single copy of the control is required in each application 6) Good for dynamic layout 7) Hard to create 8) Compiled in to dll Custom controls 1) Reusability of control 2) Pre defined Control 3) Just drag and drop from toolbox If I have more than one version of one assemblies, then how will I use old version in my application? Give an example. Change the assembly version number in the AssemblyInfo.vb file How does you handle this COM components developed in other programming languages in .NET? Answer1: add the component in add reference window, click .NETCOM tab. Answer1: While adding the refferences we can handle the COM components in other .Net programming languages. How will you register COM+ services? Through X-Copy Deployment. How do u call and execute a stored procedure in .NET? system.Data; system.Data.SqlClient; SqlConnection sqCon = new SqlConnection(connection string); SqlCommand sqCmd = new SqCmd(); sqCmd.Connection = sqCon;
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
31/69
3/15/13
#336990
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
.Net Deployment Interview Questions and Answers What do you know about .NET assemblies? Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET Remoting applications.
Whats the difference between private and shared assembly? Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name. Whats a strong name? A strong name includes the name of the assembly, version number, culture identity, and a public key token. How can you tell the application to look for assemblies at the locations other than its own install? Use the directive in the XML .config file for a given application. <probing privatePath=c:\mylibs; bin\debug /> should do the trick. Or you can add additional search paths in the Properties box of the deployed application. How can you debug failed assembly binds? Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched. Where are shared assemblies stored? Global assembly cache.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
32/69
3/15/13
#336992
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
1. Are Web Services a replacement for other distributed computing platforms? No. Web Services is just a new way of looking at existing implementation platforms. 2. In a Webservice, need to display 10 rows from a table. So DataReader or DataSet is best choice? A: WebService will support only DataSet. 3. How to generate WebService proxy? What is SOAP, WSDL, UDDI and the concept behind Web Services? What are various components of WSDL? What is the use of WSDL.exe utility? SOAP is an XML-based messaging framework specifically designed for exchanging formatted data across the Internet, for example using request and reply messages or sending entire documents. SOAP is simple, easy to use, and completely neutral with respect to operating system, programming language, or distributed computing platform. After SOAP became available as a mechanism for exchanging XML messages among enterprises (or among disparate applications within the same enterprise), a better way was needed to describe the messages and how they are exchanged. The Web Services Description Language (WSDL) is a particular form of an XML Schema, developed by Microsoft and IBM for the purpose of defining the XML message, operation, and protocol mapping of a web service accessed using SOAP or other XML protocol. WSDL defines web services in terms of "endpoints" that operate on XML messages. The WSDL syntax allows both the messages and the operations on the messages to be defined abstractly, so they can be mapped to multiple physical implementations. The current WSDL spec describes how to map messages and operations to SOAP 1.1, HTTP GET/POST, and MIME. WSDL creates web service definitions by mapping a group of endpoints into a logical sequence of operations on XML messages. The same XML message can be mapped to multiple operations (or services) and bound to one or more communications protocols (using "ports"). The Universal Description, Discovery, and Integration (UDDI) framework defines a data model (in XML) and SOAP APIs for registration and searches on business information, including the web services a business exposes to the Internet. UDDI is an independent consortium of vendors, founded by Microsoft, IBM, and Ariba, for the purpose of developing an Internet standard for web service description registration and discovery. Microsoft, IBM, and Ariba also are hosting the initial deployment of a UDDI service, which is conceptually patterned after DNS (the Internet service that translates URLs into TCP addresses). UDDI uses a private agreement profile of SOAP (i.e. UDDI doesn't use the SOAP serialization format because it's not well suited to passing complete XML documents (it's aimed at RPC style interactions). The main idea is that businesses use the SOAP APIs to register themselves with UDDI, and other businesses search UDDI when they want to discover a trading partner, for example someone from whom they wish to procure sheet metal, bolts, or transistors. The information in UDDI is categorized according to industry type and geographical location, allowing UDDI consumers to search through lists of potentially matching businesses to find the specific one they want to contact. Once a specific business is chosen, another call to UDDI is made to obtain the specific contact information for that business. The contact information includes a pointer to the target business's WSDL or other XML schema file describing the web service that the target business publishes. 4. How to generate proxy class other than .net app and wsdl tool? To access an XML Web service from a client application, you first add a Web reference, which is a reference to an XML Web service. When you create a Web reference, Visual Studio creates an XML Web service proxy class automatically and adds it to your
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
project. This proxy class exposes the methods of the XML Web service and handles the marshalling of appropriate arguments
33/69
3/15/13
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
34/69
3/15/13
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
35/69
3/15/13
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
36/69
3/15/13
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
37/69
3/15/13
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
38/69
3/15/13
<P>
Areas for study Assemblies, GAC (how to post private assembly to gac) .net architecture, MSIL, CTS, CLR Events, delegates (this is the basics of .net. u have to understand it very well) asp.net, webform, server controls, user controls ado.net, dataset, datareader, dataadapter remoting, webservice desktop application - datagrid. Threading
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
#336993
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
39/69
3/15/13
#336993 Author: Points: 6
What is .NET? ============= That's difficult to sum up in a sentence. According to Microsoft, .NET is a "revolutionary new platform, built on open Internet protocols and standards, with tools and services that meld computing and communications in new ways". A more practical definition would be that .NET is a new environment for developing and running software applications, featuring ease of development of web-based services, rich standard run-time services available to components written in a variety of programming languages, and inter-language and inter-machine interoperability. Note that when the term ".NET" is used in this FAQ it refers only to the new .NET runtime and associated technologies. This is sometimes called the ".NET Framework". This FAQ does NOT cover any of the various other existing and new products/technologies that Microsoft are attaching the .NET name to (e.g. SQL Server.NET).
Does .NET only apply to people building web-sites? No. If you write any Windows software (using ATL/COM, MFC, VB, or even raw Win32), .NET may offer a viable alternative (or addition) to the way you do things currently. Of course, if you do develop web sites, then .NET has lots to interest you - not least ASP.NET.
When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET.
When was the first version of .NET released? The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.
What tools can I use to develop .NET applications? There are a number of tools, described here in ascending order of cost: .NET Framework SDK: The SDK is free and includes command-line compilers for C++, C#, and VB.NET and various other utilities to aid development. ASP.NET Web Matrix: This is a free ASP.NET development environment from Microsoft. As well as a GUI development environment, the download includes a simple web server that can be used instead of IIS to host ASP.NET apps. This opens up ASP.NET development to users of Windows XP Home Edition, which cannot run IIS. Microsoft Visual C# .NET Standard 2003: This is a cheap (around $100) version of Visual Studio limited to one language and also with limited wizard support. For example, there's no wizard support for class libraries or custom UI controls. Useful for beginners to learn with, or for savvy developers who can work around the deficiencies in the supplied wizards. As well as C#, there are VB.NET and C++ versions. Microsoft Visual Studio.NET Professional 2003: If you have a license for Visual Studio 6.0, you can get the upgrade. You can also upgrade from VS.NET 2002 for a token $30. Visual Studio.NET includes support for all the MS languages (C#, C++, VB.NET) and has extensive wizard support.
What platforms does the .NET Framework run on? The runtime supports Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms - for example, ASP.NET is only supported on Windows XP and Windows 2000. Windows 98/ME cannot be used for development. IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home. The Mono project is attempting to implement the .NET framework on Linux.
What languages does the .NET Framework support? MS provides compilers for C#, C++, VB and JScript. Other vendors have announced that they intend to develop .NET compilers for languages such as COBOL, Eiffel, Perl, Smalltalk and Python.
Will the .NET Framework go through a standardisation process? From http://msdn.microsoft.com/net/ecma/: "On December 13, 2001, the ECMA General Assembly ratified the C# and common language infrastructure (CLI) specifications into international standards. The ECMA standards will be known as ECMA-334 (C#) and ECMA-335 (the CLI)."
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
40/69
3/15/13
#336994
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
1 What is the CLR? CLR = Common Language Runtime. The CLR is a set of standard resources that (in theory) any .NET program can take advantage of, regardless of programming language. Robert Schmidt (Microsoft) lists the following CLR resources in his MSDN PDC# article: Object-oriented programming model (inheritance, polymorphism, exception handling, garbage collection) Security model Type system All .NET base classes Many .NET framework classes Development, debugging, and profiling tools Execution and code management IL-to-native translators and optimizers What this means is that in the .NET world, different programming languages will be more equal in capability than they have ever been before, although clearly not all languages will support all CLR services. 2 What is the CTS? CTS = Common Type System. This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS. 3 What is the CLS? CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language. In theory this allows very tight interop between different .NET languages - for example allowing a C# class to inherit from a VB class.. 4 What is IL? IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler. 5 What is C#? C# is a new language designed by Microsoft to work with the .NET framework. In their "Introduction to C#" whitepaper, Microsoft describe C# as follows: "C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced C sharp) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++." Substitute 'Java' for 'C#' in the quote above, and you'll see that the statement still works pretty well :-). If you are a C++ programmer, you might like to check out my C# FAQ. 6 What does 'managed' mean in the .NET context? The term 'managed' is the cause of much confusion. It is used in various places within .NET, meaning slightly different things. Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+). Managed data: This is data that is allocated and de-allocated by the .NET runtime's garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword. Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages - for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class. 7 What is reflection? All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
41/69
3/15/13
#336995
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
3. Assemblies 3.1 What is an assembly? An assembly is sometimes described as a logical .EXE or .DLL, and can be an application (with a main entry point) or a library. An assembly consists of one or more files (dlls, exes, html files etc), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing. An important aspect of assemblies is that they are part of the identity of a type. The identity of a type is the assembly that houses it combined with the type name. This means, for example, that if assembly A exports a type called T, and assembly B exports a type called T, the .NET runtime sees these as two completely different types. Furthermore, don't get confused between assemblies and namespaces - namespaces are merely a hierarchical way of organising type names. To the runtime, type names are type names, regardless of whether namespaces are used to organise the names. It's the assembly plus the typename (regardless of whether the type name belongs to a namespace) that uniquely indentifies a type to the runtime. Assemblies are also important in .NET with respect to security - many of the security restrictions are enforced at the assembly boundary. Finally, assemblies are the unit of versioning in .NET - more on this below. 3.2 How can I produce an assembly? The simplest way to produce an assembly is directly from a .NET compiler. For example, the following C# program: public class CTest { public CTest() { System.Console.WriteLine( "Hello from CTest" ); } } can be compiled into a library assembly (dll) like this: csc /t:library ctest.cs You can then view the contents of the assembly by running the "IL Disassembler" tool that comes with the .NET SDK. Alternatively you can compile your source into modules, and then combine the modules into an assembly using the assembly linker (al.exe). For the C# compiler, the /target:module switch is used to generate a module instead of an assembly. 3.3 What is the difference between a private assembly and a shared assembly? Location and visibility: A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. the .NET framework classes. Versioning: The runtime enforces versioning constraints only on shared assemblies, not on private assemblies. 3.4 How do assemblies find each other? By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache. 3.5 How does assembly versioning work? Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly. The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file. Remember: versioning is only applied to shared assemblies, not private assemblies. 4. Application Domains 4.1 What is an Application Domain? An AppDomain can be thought of as a lightweight process. Multiple AppDomains can exist inside a Win32 process. The primary
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
42/69
3/15/13
#336996
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
5. Garbage Collection 5.1 What is garbage collection? Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time. 5.2 Is it true that objects don't always get destroyed immediately when the last reference goes away? Yes. The garbage collector offers no guarantees about the time when an object will be destroyed and its memory reclaimed.
5.3 Why doesn't the .NET runtime offer deterministic destruction? Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next sweep of the heap. Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep. 5.4 Is the lack of deterministic destruction in .NET a problem? It's certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
43/69
3/15/13
#336997
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
6. Serialization 6.1 What is serialization? Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database). 6.2 Does the .NET Framework have in-built support for serialization? There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code. 6.3 I want to serialize instances of my class. Should I use XmlSerializer, SoapFormatter or BinaryFormatter? It depends. XmlSerializer has severe limitations such as the requirement that the target class has a parameterless constructor, and only public read/write properties and fields can be serialized. However, on the plus side, XmlSerializer has good support for customising the XML document that is produced or consumed. XmlSerializer's features mean that it is most suitable for crossplatform work, or for constructing objects from existing XML documents. SoapFormatter and BinaryFormatter have fewer limitations than XmlSerializer. They can serialize private fields, for example. However they both require that the target class be marked with the [Serializable] attribute, so like XmlSerializer the class needs to be written with serialization in mind. Also there are some quirks to watch out for - for example on deserialization the constructor of the new object is not invoked. The choice between SoapFormatter and BinaryFormatter depends on the application. BinaryFormatter makes sense where both serialization and deserialization will be performed on the .NET platform and where performance is important. SoapFormatter generally makes more sense in all other cases, for ease of debugging if nothing else. 6.4 Can I customise the serialization process? Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement]
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
44/69
3/15/13
field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement] attribute, which can be used to specify the XML element name to be used for a particular property or field. Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer's [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized. 6.5 Why is XmlSerializer so slow? There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize or deserialize an object of a given type in an application, there is a significant delay. This normally doesn't matter, but it may mean, for example, that XmlSerializer is a poor choice for loading configuration settings during startup of a GUI application. 6.6 Why do I get errors when I try to serialize a Hashtable? XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction. 6.7 XmlSerializer is throwing a generic "There was an error reflecting MyClass" error. How do I find out what the problem is? Look at the InnerException property of the exception that is thrown to get a more specific error message
#336999
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
7. Attributes 7.1 What are attributes? There are at least two types of .NET attribute. The first type I will refer to as a metadata attribute - it allows some data to be attached to a class or method. This data becomes part of the metadata for the class, and (like other class metadata) can be accessed via reflection. An example of a metadata attribute is [serializable], which can be attached to a class and means that instances of the class can be serialized. [serializable] public class CTest {} The other type of attribute is a context attribute. Context attributes use a similar syntax to metadata attributes but they are fundamentally different. Context attributes provide an interception mechanism whereby instance activation and method calls can be pre- and/or post-processed. If you've come across Keith Brown's universal delegator you'll be familiar with this idea. 7.2 Can I create my own metadata attributes? Yes. Simply derive a class from System.Attribute and mark it with the AttributeUsage attribute. For example: [AttributeUsage(AttributeTargets.Class)] public class InspiredByAttribute : System.Attribute { public string InspiredBy; public InspiredByAttribute( string inspiredBy ) { InspiredBy = inspiredBy; } }
class CApp { public static void Main() { object[] atts = typeof(CTest).GetCustomAttributes(true); foreach( object att in atts ) if( att is InspiredByAttribute ) Console.WriteLine( "Class CTest was inspired by {0}", ((InspiredByAttribute)att).InspiredBy ); } }
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
#337000
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
45/69
3/15/13
#337000 Author: Points: 6
8. Code Access Security 8.1 What is Code Access Security (CAS)? CAS is the part of the .NET security model that determines whether or not a piece of code is allowed to run, and what resources it can use when it is running. For example, it is CAS that will prevent a .NET web applet from formatting your hard disk. 8.2 How does CAS work? The CAS security policy revolves around two key concepts - code groups and permissions. Each .NET assembly is a member of a particular code group, and each code group is granted the permissions specified in a named permission set. For example, using the default security policy, a control downloaded from a web site belongs to the 'Zone - Internet' code group, which adheres to the permissions defined by the 'Internet' named permission set. (Naturally the 'Internet' named permission set represents a very restrictive range of permissions.) 8.3 Who defines the CAS code groups? Microsoft defines some default ones, but you can modify these and even create your own. To see the code groups defined on your system, run 'caspol -lg' from the command-line. On my system it looks like this: Level = Machine
Code Groups: 1. All code: Nothing 1.1. Zone - MyComputer: FullTrust 1.1.1. Honor SkipVerification requests: SkipVerification 1.2. Zone - Intranet: LocalIntranet 1.3. Zone - Internet: Internet 1.4. Zone - Untrusted: Nothing 1.5. Zone - Trusted: Internet 1.6. StrongName - 0024000004800000940000000602000000240000525341310004000003 000000CFCB3291AA715FE99D40D49040336F9056D7886FED46775BC7BB5430BA4444FEF8348EBD06 F962F39776AE4DC3B7B04A7FE6F49F25F740423EBF2C0B89698D8D08AC48D69CED0FC8F83B465E08 07AC11EC1DCC7D054E807A43336DDE408A5393A48556123272CEEEE72F1660B71927D38561AABF5C AC1DF1734633C602F8F2D5: Everything Note the hierarchy of code groups - the top of the hierarchy is the most general ('All code'), which is then sub-divided into several groups, each of which in turn can be sub-divided. Also note that (somewhat counter-intuitively) a sub-group can be associated with a more permissive permission set than its parent. 8.4 How do I define my own code group? Use caspol. For example, suppose you trust code from www.mydomain.com and you want it have full access to your system, but you want to keep the default restrictions for all other internet sites. To achieve this, you would add a new code group as a subgroup of the 'Zone - Internet' group, like this: caspol -ag 1.3 -site www.mydomain.com FullTrust Now if you run caspol -lg you will see that the new group has been added as group 1.3.1: ... 1.3. Zone - Internet: Internet 1.3.1. Site - www.mydomain.com: FullTrust ... Note that the numeric label (1.3.1) is just a caspol invention to make the code groups easy to manipulate from the command-line. The underlying runtime never sees it. 8.5 How do I change the permission set for a code group? Use caspol. If you are the machine administrator, you can operate at the 'machine' level - which means not only that the changes you make become the default for the machine, but also that users cannot change the permissions to be more permissive. If you are a normal (non-admin) user you can still modify the permissions, but only to make them more restrictive. For example, to allow intranet code to do what it likes you might do this: caspol -cg 1.2 FullTrust Note that because this is more permissive than the default policy (on a standard system), you should only do this at the machine level - doing it at the user level will have no effect. 8.6 Can I create my own permission set? Yes. Use caspol -ap, specifying an XML file containing the permissions in the permission set. To save you some time, here is a sample file corresponding to the 'Everything' permission set - just edit to suit your needs. When you have edited the sample, add it to the range of available permission sets like this: caspol -ap samplepermset.xml Then, to apply the permission set to a code group, do something like this: caspol -cg 1.3 SamplePermSet (By default, 1.3 is the 'Internet' code group) 8.7 I'm having some trouble with CAS. How can I diagnose my problem? Caspol has a couple of options that might help. First, you can ask caspol to tell you what code group an assembly belongs to, using caspol -rsg. Similarly, you can ask what permissions are being applied to a particular assembly using caspol -rsp.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
46/69
3/15/13
using caspol -rsg. Similarly, you can ask what permissions are being applied to a particular assembly using caspol -rsp.
#337002
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
9. Intermediate Language (IL) 9.1 Can I look at the IL for an assembly? Yes. MS supply a tool called Ildasm which can be used to view the metadata and IL for an assembly. 9.2 Can source code be reverse-engineered from IL? Yes, it is often relatively straightforward to regenerate high-level source (e.g. C#) from IL. 9.3 How can I stop my code being reverse-engineered from IL? There is currently no simple way to stop code being reverse-engineered from IL. In future it is likely that IL obfuscation tools will become available, either from MS or from third parties. These tools work by 'optimising' the IL in such a way that reverseengineering becomes much more difficult. Of course if you are writing web services then reverse-engineering is not a problem as clients do not have access to your IL. 9.4 Can I write IL programs directly? Yes. Peter Drayton posted this simple example to the DOTNET mailing list: .assembly MyAssembly {} .class MyApp { .method static void Main() { .entrypoint ldstr "Hello, IL!" call void System.Console::WriteLine(class System.Object) ret } } Just put this into a file called hello.il, and then run ilasm hello.il. An exe assembly will be generated. 9.5 Can I do things in IL that I can't do in C#? Yes. A couple of simple examples are that you can throw exceptions that are not derived from System.Exception, and you can have non-zero-based arrays.
#337003
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
10. Implications for COM 10.1 Is COM dead? This subject causes a lot of controversy, as you'll see if you read the mailing list archives. Take a look at the following two threads: http://discuss.develop.com/archives/wa.exe?A2=ind0007&L=DOTNET&D=0&P=68241 http://discuss.develop.com/archives/wa.exe?A2=ind0007&L=DOTNET&P=R60761 FWIW my view is as follows: COM is many things, and it's different things to different people. But to me, COM is fundamentally about how little blobs of code find other little blobs of code, and how they communicate with each other when they find each other. COM specifies precisely how this location and communication takes place. In a 'pure' .NET world, consisting entirely of .NET objects, little blobs of code still find each other and talk to each other, but they don't use COM to do so. They use a model which is similar to COM in some ways - for example, type information is stored in a tabular form packaged with the component, which is quite similar to packaging a type library with a COM component. But it's not COM. So, does this matter? Well, I don't really care about most of the COM stuff going away - I don't care that finding components doesn't involve a trip to the registry, or that I don't use IDL to define my interfaces. But there is one thing that I wouldn't like to go away - I wouldn't like to lose the idea of interface-based development. COM's greatest strength, in my opinion, is its insistence on a cast-iron separation between interface and implementation. Unfortunately, the .NET framework seems to make no such insistence - it lets you do interface-based development, but it doesn't insist. Some people would argue that having a choice can never be a bad thing, and maybe they're right, but I can't help feeling that maybe it's a backward step. 10.2 Is DCOM dead? Pretty much, for .NET developers. The .NET Framework has a new remoting model which is not based on DCOM. Of course DCOM will still be used in interop scenarios. 10.3 Is MTS/COM+ dead? No. The approach for the first .NET release is to provide access to the existing COM+ services (through an interop layer) rather than replace the services with native .NET ones. Various tools and attributes are provided to try to make this as painless as possible. The PDC release of the .NET SDK includes interop support for core services (JIT activation, transactions) but not some of the higher level services (e.g. COM+ Events, Queued components). Over time it is expected that interop will become more seamless - this may mean that some services become a core part of the
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
47/69
3/15/13
[ object, uuid(EA013F93-487A-4403-86EC-FD9FEE5E6206), helpstring("ICppName Interface"), pointer_default(unique), oleautomation ] interface ICppName : IUnknown { [helpstring("method SetName")] HRESULT SetName([in] BSTR name); [helpstring("method GetName")] HRESULT GetName([out,retval] BSTR *pName ); }; [ uuid(F5E4C61D-D93A-4295-A4B4-2453D4A4484D), version(1.0), helpstring("cppcomserver 1.0 Type Library") ] library CPPCOMSERVERLib { importlib("stdole32.tlb"); importlib("stdole2.tlb"); [ uuid(600CE6D9-5ED7-4B4D-BB49-E8D5D5096F70), helpstring("CppName Class") ] coclass CppName { [default] interface ICppName; }; }; When you've built the component, you should get a typelibrary. Run the TLBIMP utility on the typelibary, like this: tlbimp cppcomserver.tlb If successful, you will get a message like this: Typelib imported successfully to CPPCOMSERVERLib.dll You now need a .NET client - let's use C#. Create a .cs file containing the following code: using System; using CPPCOMSERVERLib; public class MainApp { static public void Main() { CppName cppname = new CppName(); cppname.SetName( "bob" ); Console.WriteLine( "Name is " + cppname.GetName() ); } } Note that we are using the type library name as a namespace, and the COM class name as the class. Alternatively we could have used CPPCOMSERVERLib.CppName for the class name and gone without the using CPPCOMSERVERLib statement. Compile the C# code like this: csc /r:cppcomserverlib.dll csharpcomclient.cs
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
48/69
3/15/13
Note that the compiler is being told to reference the DLL we previously generated from the typelibrary using TLBIMP. You should now be able to run csharpcomclient.exe, and get the following output on the console: Name is bob 10.5 Can I use .NET components from COM programs? Yes. .NET components are accessed from COM via a COM Callable Wrapper (CCW). This is similar to a RCW (see previous question), but works in the opposite direction. Again, if the wrapper cannot be automatically generated by the .NET development tools, or if the automatic behaviour is not desirable, a custom CCW can be developed. Also, for COM to 'see' the .NET component, the .NET component must be registered in the registry. Here's a simple example. Create a C# file called testcomserver.cs and put the following in it: using System; using System.Runtime.InteropServices; namespace AndyMc { [ClassInterface(ClassInterfaceType.AutoDual)] public class CSharpCOMServer { public CSharpCOMServer() {} public void SetName( string name ) { m_name = name; } public string GetName() { return m_name; } private string m_name; } } Then compile the .cs file as follows: csc /target:library testcomserver.cs You should get a dll, which you register like this: regasm testcomserver.dll /tlb:testcomserver.tlb /codebase Now you need to create a client to test your .NET COM component. VBScript will do - put the following in a file called comclient.vbs: Dim dotNetObj Set dotNetObj = CreateObject("AndyMc.CSharpCOMServer") dotNetObj.SetName ("Amit Shah") MsgBox "Name is " & dotNetObj.GetName() and run the script like this: wscript comclient.vbs And hey presto you should get a message box displayed with the text "Amit Shah". 10.6 Is ATL redundant in the .NET world? Yes, if you are writing applications that live inside the .NET framework. Of course many developers may wish to continue using ATL to write C++ COM components that live outside the framework, but if you are inside you will almost certainly want to use C#. Raw C++ (and therefore ATL which is based on it) doesn't have much of a place in the .NET world - it's just too near the metal and provides too much flexibility for the runtime to be able to manage it.
#337004
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
11. Miscellaneous 11.1 How does .NET remoting work? .NET remoting involves sending messages along channels. Two of the standard channels are HTTP and TCP. TCP is intended for LANs only - HTTP can be used for LANs or WANs (internet). Support is provided for multiple message serializarion formats. Examples are SOAP (XML-based) and binary. By default, the HTTP channel uses SOAP (via the .NET runtime Serialization SOAP Formatter), and the TCP channel uses binary (via the .NET runtime Serialization Binary Formatter). But either channel can use either serialization format. There are a number of styles of remote access: SingleCall. Each incoming request from a client is serviced by a new object. The object is thrown away when the request has finished. Singleton. All incoming requests from clients are processed by a single server object. Client-activated object. This is the old stateful (D)COM model whereby the client receives a reference to the remote object and holds that reference (thus keeping the remote object alive) until it is finished with it. Distributed garbage collection of objects is managed by a system called 'leased based lifetime'. Each object has a lease time, and when that time expires the object is disconnected from the .NET runtime remoting infrastructure. Objects have a default renew time - the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
49/69
3/15/13
the lease.
class MainApp { [DllImport("user32.dll", EntryPoint="MessageBox", SetLastError=true, CharSet=CharSet.Auto)] public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType); public static void Main() { MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 ); } }
#337005
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
12. Class Library 12.1 File I/O 12.1.1 How do I read from a text file? First, use a System.IO.FileStream object to open the file: FileStream fs = new FileStream( @"c:\test.txt", FileMode.Open, FileAccess.Read ); FileStream inherits from Stream, so you can wrap the FileStream object with a StreamReader object. This provides a nice interface for processing the stream line by line: StreamReader sr = new StreamReader( fs ); string curLine; while( (curLine = sr.ReadLine()) != null ) Console.WriteLine( curLine ); Finally close the StreamReader object: sr.Close(); Note that this will automatically call Close() on the underlying Stream object, so an explicit fs.Close() is not required. 12.1.2 How do I write to a text file? Similar to the read example, except use StreamWriter instead of StreamReader. 12.1.3 How do I read/write binary files? Similar to text files, except wrap the FileStream object with a BinaryReader/Writer object instead of a StreamReader/Writer object. 12.2 Text Processing 12.2.1 Are regular expressions supported? Yes. Use the System.Text.RegularExpressions.Regex class. For example, the following code updates the title in an HTML file: FileStream fs = new FileStream( "test.htm", FileMode.Open, FileAccess.Read ); StreamReader sr = new StreamReader( fs ); Regex r = new Regex( "<TITLE>(.*)</TITLE>" ); string s; while( (s = sr.ReadLine()) != null ) { if( r.IsMatch( s ) ) s = r.Replace( s, "<TITLE>New and improved ${1}</TITLE>" ); Console.WriteLine( s ); } 12.3 Internet 12.3.1 How do I download a web page? First use the System.Net.WebRequestFactory class to acquire a WebRequest object: WebRequest request = WebRequest.Create( "http://localhost" ); Then ask for the response from the request: WebResponse response = request.GetResponse(); The GetResponse method blocks until the download is complete. Then you can access the response stream like this:
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
50/69
3/15/13
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
51/69
3/15/13
// ThreadMain() is executed on the new thread. private void ThreadMain() { Console.WriteLine( m_data ); } public void WaitUntilFinished() { m_thread.Join(); } private Thread m_thread; private string m_data; } In this case creating an instance of the MyThread class is sufficient to spawn the thread and execute the MyThread.ThreadMain() method: MyThread t = new MyThread( "Hello, world." ); t.WaitUntilFinished(); 12.5.3 How do I stop a thread? There are several options. First, you can use your own communication mechanism to tell the ThreadStart method to finish. Alternatively the Thread class has in-built support for instructing the thread to stop. The two principle methods are Thread.Interrupt() and Thread.Abort(). The former will cause a ThreadInterruptedException to be thrown on the thread when it next goes into a WaitJoinSleep state. In other words, Thread.Interrupt is a polite way of asking the thread to stop when it is no longer doing any useful work. In contrast, Thread.Abort() throws a ThreadAbortException regardless of what the thread is doing. Furthermore, the ThreadAbortException cannot normally be caught (though the ThreadStart's finally method will be executed). Thread.Abort() is a heavy-handed mechanism which should not normally be required. 12.5.4 How do I use the thread pool? By passing an instance of a WaitCallback delegate to the ThreadPool.QueueUserWorkItem() method: class CApp { static void Main() { string s = "Hello, World"; ThreadPool.QueueUserWorkItem( new WaitCallback( DoWork ), s ); Thread.Sleep( 1000 ); // Give time for work item to be executed } // DoWork is executed on a thread from the thread pool. static void DoWork( object state ) { Console.WriteLine( state ); } } 12.5.5 How do I know when my thread pool work item has completed? There is no way to query the thread pool for this information. You must put code into the WaitCallback method to signal that it has completed. Events are useful for this. 12.5.6 How do I prevent concurrent access to my data? Each object has a concurrency lock (critical section) associated with it. The System.Threading.Monitor.Enter/Exit methods are used to acquire and release this lock. For example, instances of the following class only allow one thread at a time to enter method f(): class C { public void f() { try { Monitor.Enter(this); ... } finally {
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
52/69
3/15/13
Monitor.Exit(this); } } }
C# has a 'lock' keyword which provides a convenient shorthand for the code above: class C { public void f() { lock(this) { ... } } } Note that calling Monitor.Enter(myObject) does NOT mean that all access to myObject is serialized. It means that the synchronisation lock associated with myObject has been acquired, and no other thread can acquire that lock until Monitor.Exit(o) is called. In other words, this class is functionally equivalent to the classes above: class C { public void f() { lock( m_object ) { ... } } private m_object = new object(); } 12.6 Tracing 12.6.1 Is there built-in support for tracing/logging? Yes, in the System.Diagnostics namespace. There are two main classes that deal with tracing - Debug and Trace. They both work in a similar way - the difference is that tracing from the Debug class only works in builds that have the DEBUG symbol defined, whereas tracing from the Trace class only works in builds that have the TRACE symbol defined. Typically this means that you should use System.Diagnostics.Trace.WriteLine for tracing that you want to work in debug and release builds, and System.Diagnostics.Debug.WriteLine for tracing that you want to work only in debug builds. 12.6.2 Can I redirect tracing to a file? Yes. The Debug and Trace classes both have a Listeners property, which is a collection of sinks that receive the tracing that you send via Debug.WriteLine and Trace.WriteLine respectively. By default the Listeners collection contains a single sink, which is an instance of the DefaultTraceListener class. This sends output to the Win32 OutputDebugString() function and also the System.Diagnostics.Debugger.Log() method. This is useful when debugging, but if you're trying to trace a problem at a customer site, redirecting the output to a file is more appropriate. Fortunately, the TextWriterTraceListener class is provided for this purpose. Here's how to use the TextWriterTraceListener class to redirect Trace output to a file: Trace.Listeners.Clear(); FileStream fs = new FileStream( @"c:\log.txt", FileMode.Create, FileAccess.Write ); Trace.Listeners.Add( new TextWriterTraceListener( fs ) ); Trace.WriteLine( @"This will be writen to c:\log.txt!" ); Trace.Flush(); Note the use of Trace.Listeners.Clear() to remove the default listener. If you don't do this, the output will go to the file and OutputDebugString(). Typically this is not what you want, because OutputDebugString() imposes a big performance hit. 12.6.3 Can I customise the trace output? Yes. You can write your own TraceListener-derived class, and direct all output through it. Here's a simple example, which derives from TextWriterTraceListener (and therefore has in-built support for writing to files, as shown above) and adds timing information and the thread ID for each trace line: class MyListener : TextWriterTraceListener { public MyListener( Stream s ) : base(s) { } public override void WriteLine( string s ) { Writer.WriteLine( "{0:D8} [{1:D4}] {2}", Environment.TickCount - m_startTickCount, AppDomain.GetCurrentThreadId(),
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
53/69
3/15/13
AppDomain.GetCurrentThreadId(), s ); }
protected int m_startTickCount = Environment.TickCount; } (Note that this implementation is not complete - the TraceListener.Write method is not overridden for example.) The beauty of this approach is that when an instance of MyListener is added to the Trace.Listeners collection, all calls to Trace.WriteLine() go through MyListener, including calls made by referenced assemblies that know nothing about the MyListener class.
#337006
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
T-SQL Queries 1. 2 tables Employee Phone empid empname salary mgrid empid phnumber 2. Select all employees who doesn't have phone? SELECT empname FROM Employee WHERE (empid NOT IN (SELECT DISTINCT empid FROM phone)) 3. Select the employee names who is having more than one phone numbers. SELECT empname FROM employee WHERE (empid IN (SELECT empid FROM phone GROUP BY empid HAVING COUNT(empid) > 1)) 4. Select the details of 3 max salaried employees from employee table. SELECT TOP 3 empid, salary FROM employee ORDER BY salary DESC 5. Display all managers from the table. (manager id is same as emp id) SELECT empname FROM employee WHERE (empid IN (SELECT DISTINCT mgrid FROM employee)) 6. Write a Select statement to list the Employee Name, Manager Name under a particular manager? SELECT e1.empname AS EmpName, e2.empname AS ManagerName FROM Employee e1 INNER JOIN Employee e2 ON e1.mgrid = e2.empid ORDER BY e2.mgrid 7. 2 tables emp and phone. emp fields are - empid, name Ph fields are - empid, ph (office, mobile, home). Select all employees who doesn't have any ph nos. SELECT * FROM employee LEFT OUTER JOIN phone ON employee.empid = phone.empid WHERE (phone.office IS NULL OR phone.office = ' ') AND (phone.mobile IS NULL OR phone.mobile = ' ') AND (phone.home IS NULL OR phone.home = ' ') 8. Find employee who is living in more than one city. Two Tables: Emp City
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
54/69
3/15/13
Empid empName Salary Empid City 9. SELECT empname, fname, lname FROM employee WHERE (empid IN (SELECT empid FROM city GROUP BY empid HAVING COUNT(empid) > 1))
10. Find all employees who is living in the same city. (table is same as above) SELECT fname FROM employee WHERE (empid IN (SELECT empid FROM city a WHERE city IN (SELECT city FROM city b GROUP BY city HAVING COUNT(city) > 1))) 11. There is a table named MovieTable with three columns - moviename, person and role. Write a query which gets the movie details where Mr. Amitabh and Mr. Vinod acted and their role is actor. SELECT DISTINCT m1.moviename FROM MovieTable m1 INNER JOIN MovieTable m2 ON m1.moviename = m2.moviename WHERE (m1.person = 'amitabh' AND m2.person = 'vinod' OR m2.person = 'amitabh' AND m1.person = 'vinod') AND (m1.role = 'actor') AND (m2.role = 'actor') ORDER BY m1.moviename 12. There are two employee tables named emp1 and emp2. Both contains same structure (salary details). But Emp2 salary details are incorrect and emp1 salary details are correct. So, write a query which corrects salary details of the table emp2 update a set a.sal=b.sal from emp1 a, emp2 b where a.empid=b.empid 13. Given a Table named Students which contains studentid, subjectid and marks. Where there are 10 subjects and 50 students. Write a Query to find out the Maximum marks obtained in each subject. 14. In this same tables now write a SQL Query to get the studentid also to combine with previous results. 15. Three tables student , course, marks how do go at finding name of the students who got max marks in the diff courses. SELECT student.name, course.name AS coursename, marks.sid, marks.mark FROM marks INNER JOIN student ON marks.sid = student.sid INNER JOIN course ON marks.cid = course.cid WHERE (marks.mark = (SELECT MAX(Mark) FROM Marks MaxMark WHERE MaxMark.cID = Marks.cID)) 16. There is a table day_temp which has three columns dayid, day and temperature. How do I write a query to get the difference of temperature among each other for seven days of a week? SELECT a.dayid, a.dday, a.tempe, a.tempe - b.tempe AS Difference FROM day_temp a INNER JOIN day_temp b ON a.dayid = b.dayid + 1 OR Select a.day, a.degree-b.degree from temperature a, temperature b where a.id=b.id+1 17. There is a table which contains the names like this. a1, a2, a3, a3, a4, a1, a1, a2 and their salaries. Write a query to get grand total salary, and total salaries of individual employees in one query. SELECT empid, SUM(salary) AS salary FROM employee GROUP BY empid WITH ROLLUP ORDER BY empid 18. How to know how many tables contains empno as a column in a database? SELECT COUNT(*) AS Counter FROM syscolumns WHERE (name = 'empno') 19. Find duplicate rows in a table? OR I have a table with one column which has many records which are not distinct. I need to find the distinct values from that column and number of times its repeated. SELECT sid, mark, COUNT(*) AS Counter FROM marks
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
55/69
3/15/13
GROUP BY sid, mark HAVING (COUNT(*) > 1)
20. How to delete the rows which are duplicate (dont delete both duplicate records). SET ROWCOUNT 1 DELETE yourtable FROM yourtable a WHERE (SELECT COUNT(*) FROM yourtable b WHERE b.name1 = a.name1 AND b.age1 = a.age1) > 1 WHILE @@rowcount > 0 DELETE yourtable FROM yourtable a WHERE (SELECT COUNT(*) FROM yourtable b WHERE b.name1 = a.name1 AND b.age1 = a.age1) > 1 SET ROWCOUNT 0 21. How to find 6th highest salary SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM employee ORDER BY salary DESC) a ORDER BY salary 22. Find top salary among two tables SELECT TOP 1 sal FROM (SELECT MAX(sal) AS sal FROM sal1 UNION SELECT MAX(sal) AS sal FROM sal2) a ORDER BY sal DESC 23. Write a query to convert all the letters in a word to upper case SELECT UPPER('test') 24. Write a query to round up the values of a number. For example even if the user enters 7.1 it should be rounded up to 8. SELECT CEILING (7.1) 25. Write a SQL Query to find first day of month? SELECT DATENAME(dw, DATEADD(dd, - DATEPART(dd, GETDATE()) + 1, GETDATE())) AS FirstDay Datepart Abbreviations year yy, yyyy quarter qq, q month mm, m dayofyear dy, y day dd, d week wk, ww weekday dw hour hh minute mi, n second ss, s millisecond ms 26. Table A contains column1 which is primary key and has 2 values (1, 2) and Table B contains column1 which is primary key and has 2 values (2, 3). Write a query which returns the values that are not common for the tables and the query should return one column with 2 records. SELECT tbla.a FROM tbla, tblb WHERE tbla.a <> (SELECT tblb.a FROM tbla, tblb WHERE tbla.a = tblb.a) UNION SELECT tblb.a FROM tbla, tblb WHERE tblb.a <> (SELECT tbla.a FROM tbla, tblb WHERE tbla.a = tblb.a) OR (better approach) SELECT a FROM tbla WHERE a NOT IN (SELECT a
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
56/69
3/15/13
FROM tblb) UNION ALL SELECT a FROM tblb WHERE a NOT IN (SELECT a FROM tbla)
27. There are 3 tables Titles, Authors and Title-Authors (check PUBS db). Write the query to get the author name and the number of books written by that author, the result should start from the author who has written the maximum number of books and end with the author who has written the minimum number of books. SELECT authors.au_lname, COUNT(*) AS BooksCount FROM authors INNER JOIN titleauthor ON authors.au_id = titleauthor.au_id INNER JOIN titles ON titles.title_id = titleauthor.title_id GROUP BY authors.au_lname ORDER BY BooksCount DESC 28. UPDATE emp_master SET emp_sal = CASE WHEN emp_sal > 0 AND emp_sal <= 20000 THEN (emp_sal * 1.01) WHEN emp_sal > 20000 THEN (emp_sal * 1.02) END 29. List all products with total quantity ordered, if quantity ordered is null show it as 0. SELECT name, CASE WHEN SUM(qty) IS NULL THEN 0 WHEN SUM(qty) > 0 THEN SUM(qty) END AS tot FROM [order] RIGHT OUTER JOIN product ON [order].prodid = product.prodid GROUP BY name Result: coke 60 mirinda 0 pepsi 10 30. ANY, SOME, or ALL? ALL means greater than every value--in other words, greater than the maximum value. For example, >ALL (1, 2, 3) means greater than 3. ANY means greater than at least one value, that is, greater than the minimum. So >ANY (1, 2, 3) means greater than 1. SOME is an SQL-92 standard equivalent for ANY. 31. IN & = (difference in correlated sub query) INDEX 32. What is Index? Its purpose? Indexes in databases are similar to indexes in books. In a database, an index allows the database program to find data in a table without scanning the entire table. An index in a database is a list of values in a table with the storage locations of rows in the table that contain each value. Indexes can be created on either a single column or a combination of columns in a table and are implemented in the form of B-trees. An index contains an entry with one or more columns (the search key) from each row in a table. A B-tree is sorted on the search key, and can be searched efficiently on any leading subset of the search key. For example, an index on columns A, B, C can be searched efficiently on A, on A, B, and A, B, C. 33. Explain about Clustered and non clustered index? How to choose between a Clustered Index and a Non-Clustered Index? There are clustered and nonclustered indexes. A clustered index is a special type of index that reorders the way records in the table are physically stored. Therefore table can have only one clustered index. The leaf nodes of a clustered index contain the data pages. A nonclustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk. The leaf nodes of a nonclustered index does not consist of the data pages. Instead, the leaf nodes contain index rows. Consider using a clustered index for: o Columns that contain a large number of distinct values. o Queries that return a range of values using operators such as BETWEEN, >, >=, <, and <=. o Columns that are accessed sequentially. o Queries that return large result sets. Non-clustered indexes have the same B-tree structure as clustered indexes, with two significant differences: o The data rows are not sorted and stored in order based on their non-clustered keys. o The leaf layer of a non-clustered index does not consist of the data pages. Instead, the leaf nodes contain index rows. Each index row contains the non-clustered key value and one or more row locators that point to the data row (or rows if the index is not unique) having the key value. o Per table only 249 non clustered indexes. 34. Disadvantage of index? Every index increases the time in takes to perform INSERTS, UPDATES and DELETES, so the number of indexes should not be
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
57/69
3/15/13
very much.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
58/69
3/15/13
44. GUID datasize? 128bit
45. How GUID becoming unique across machines? To ensure uniqueness across machines, the ID of the network card is used (among others) to compute the number. 46. What is the difference between text and image data type? Text and image. Use text for character data if you need to store more than 255 characters in SQL Server 6.5, or more than 8000 in SQL Server 7.0. Use image for binary large objects (BLOBs) such as digital images. With text and image data types, the data is not stored in the row, so the limit of the page size does not apply.All that is stored in the row is a pointer to the database pages that contain the data.Individual text, ntext, and image values can be a maximum of 2-GB, which is too long to store in a single data row. JOINS 47. What are joins? Sometimes we have to select data from two or more tables to make our result complete. We have to perform a join. 48. How many types of Joins? Joins can be categorized as: Inner joins (the typical join operation, which uses some comparison operator like = or <>). These include equi-joins and natural joins. Inner joins use a comparison operator to match rows from two tables based on the values in common columns from each table. For example, retrieving all rows where the student identification number is the same in both the students and courses tables. Outer joins. Outer joins can be a left, a right, or full outer join. Outer joins are specified with one of the following sets of keywords when they are specified in the FROM clause: LEFT JOIN or LEFT OUTER JOIN -The result set of a left outer join includes all the rows from the left table specified in the LEFT OUTER clause, not just the ones in which the joined columns match. When a row in the left table has no matching rows in the right table, the associated result set row contains null values for all select list columns coming from the right table. RIGHT JOIN or RIGHT OUTER JOIN - A right outer join is the reverse of a left outer join. All rows from the right table are returned. Null values are returned for the left table any time a right table row has no matching row in the left table. FULL JOIN or FULL OUTER JOIN - A full outer join returns all rows in both the left and right tables. Any time a row has no match in the other table, the select list columns from the other table contain null values. When there is a match between the tables, the entire result set row contains data values from the base tables. Cross joins - Cross joins return all rows from the left table, each row from the left table is combined with all rows from the right table. Cross joins are also called Cartesian products. (A Cartesian join will get you a Cartesian product. A Cartesian join is when you join every row of one table to every row of another table. You can also get one by joining every row of a table to every row of itself.) 49. What is self join? A table can be joined to itself in a self-join. 50. What are the differences between UNION and JOINS? A join selects columns from 2 or more tables. A union selects rows.
#337007
Author:
Amit Shah
Member Rank: 0
Date: 13/Jan/2009
Rating:
Points: 6
51. Can I improve performance by using the ANSI-style joins instead of the old-style joins? Code Example 1: select o.name, i.name from sysobjects o, sysindexes i where o.id = i.id Code Example 2: select o.name, i.name from sysobjects o inner join sysindexes i on o.id = i.id You will not get any performance gain by switching to the ANSI-style JOIN syntax. Using the ANSI-JOIN syntax gives you an important advantage: Because the join logic is cleanly separated from the filtering criteria, you can understand the query logic more quickly. The SQL Server old-style JOIN executes the filtering conditions before executing the joins, whereas the ANSI-style JOIN reverses this procedure (join logic precedes filtering). Perhaps the most compelling argument for switching to the ANSI-style JOIN is that Microsoft has explicitly stated that SQL Server will not support the old-style OUTER JOIN syntax indefinitely. Another important consideration is that the ANSI-style JOIN supports query constructions that the old-style JOIN syntax does not support. 52. What is derived table? Derived tables are SELECT statements in the FROM clause referred to by an alias or a user-specified name. The result set of the SELECT in the FROM clause forms a table used by the outer SELECT statement. For example, this SELECT uses a derived table
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
59/69
3/15/13
#343626
Author: Rating:
LOGESHWARAN Points: 6
Member Rank: 0
Date:
05/Feb/2009
1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process. inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension),the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe. 2. Whats the difference between Response.Write() andResponse.Output.Write()? The latter one allows you to write formattedoutput. 3. What methods are fired during the page load? Init() - when the pageis instantiated, Load() - when the page is loaded into server memory,PreRender() - the brief moment before the page is displayed to the user asHTML, Unload() - when page finishes loading. 4. Where does the Web page belong in the .NET Framework class hierarchy?System.Web.UI.Page 5. Where do you store the information about the users locale? System.Web.UI.Page.Culture 6. Whats the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"? CodeBehind is relevant to Visual Studio.NET only. 7. Whats a bubbled event? When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents. 8. Suppose you want a certain ASP.NET function executed on MouseOver overa certain button. Where do you add an event handler? Its the Attributesproperty, the Add function inside that property. So btnSubmit.Attributes.Add("onMouseOver","someClientCode();") 9. What data type does the RangeValidator control support? Integer,String and Date. 10. Explain the differences between Server-side and Client-side code? Server-side code runs on the server. Client-side code runs in the clients browser. 11. What type of code (server or client) is found in a Code-Behind class? Server-side code. 12. Should validation (did the user enter a real date) occur server-side or client-side? Why? Client-side. This reduces an additional request to the server to validate the users input. 13. What does the "EnableViewState" property do? Why would I want it on or off? It enables the viewstate on the page. It allows the page to save the users input on a form. REGARDS LOGESHWARAN.P mailto: logesh_ajax@logeshwaran.co.cc
#343627
Author: Rating:
LOGESHWARAN Points: 6
Member Rank: 0
Date:
05/Feb/2009
14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to another page or site. 15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset? A DataSet can represent an entire relational database in memory, complete with tables, relations, and views. A DataSet is designed to work without any continuing connection to the original data source. Data in a DataSet is bulk-loaded, rather than being loaded on demand. There's no concept of cursor types in a DataSet. DataSets have no current record pointer You can use For Each loops to move through the data. You can store many edits in a DataSet, and write them to the original data source in a single operation. Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources. 16. Can you give an example of what might be best suited to place in the Application_Start and Session_Start subroutines? This is where you can set the specific variables for the Application and Session objects.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
60/69
3/15/13
#343628
Author: Rating:
LOGESHWARAN Points: 6
Member Rank: 0
Date:
05/Feb/2009
25. Which template must you provide, in order to display data in a Repeater control? ItemTemplate 26. How can you provide an alternating color scheme in a Repeater control? Use the AlternatingItemTemplate 27. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control? You must set the DataSource property and call the DataBind method. 28. What base class do all Web Forms inherit from? The Page class. 29. Name two properties common in every validation control? ControlToValidate property and Text property. 30. What tags do you need to add within the asp:datagrid tags to bind columns manually? Set AutoGenerateColumns Property to false on the datagrid tag 31. What tag do you use to add a hyperlink column to the DataGrid? <asp:HyperLinkColumn> 32. What is the transport protocol you use to call a Web service? SOAP is the preferred protocol. 33. True or False: A Web service can only be written in .NET? False 34. What does WSDL stand for? (Web Services Description Language) 35. Where on the Internet would you look for Web services? (http://www.uddi.org) 36. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box? DataTextField property 37. Which control would you use if you needed to make sure the values in two different controls matched? CompareValidator Control 38. True or False: To test a Web service you must create a windows application or Web application to consume this service? False, the webservice comes with a test page and it provides HTTP-GET method to test. 39. How many classes can a single .NET DLL contain? It can contain many classes. REGARDS LOGESHWARAN.P mailto: logesh_ajax@logeshwaran.co.cc
#347312
Author: Rating:
srinukatkam Points: 6
Member Rank: 0
Date:
16/Feb/2009
This is a list of questions I have gathered and created over a period of time from my experience, many of which I felt where incomplete or simply wrong. I have finally taken the time to go through each question and correct them to the best of my ability. However, please feel free to post feedback to challenge, improve, or suggest new questions. I want to thank those of you that have contributed quality questions and corrections thus far. There are some questions in this list that I do not consider to be good questions for an interview. However, they do exist on other lists available on the Internet so I felt compelled to keep them here for easy access.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
61/69
3/15/13
1.
Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process. inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe. 2. Whats the difference between Response.Write() andResponse.Output.Write()? Response.Output.Write() allows you to write formatted output. 3. What methods are fired during the page load? Init() - when the page is instantiated Load() - when the page is loaded into server memory PreRender() - the brief moment before the page is displayed to the user as HTML Unload() - when page finishes loading. 4. When during the page processing cycle is ViewState available? After the Init() and before the Page_Load(), or OnLoad() for a control. 5. What namespace does the Web page belong in the .NET Framework class hierarchy? System.Web.UI.Page 6. Where do you store the information about the users locale? System.Web.UI.Page.Culture 7. Whats the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"? CodeBehind is relevant to Visual Studio.NET only. 8. Whats a bubbled event? When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents. 9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler? Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();"); 10. What data types do the RangeValidator control support? Integer, String, and Date. 11. Explain the differences between Server-side and Client-side code? Server-side code executes on the server. Client-side code executes in the client's browser. 12. What type of code (server or client) is found in a Code-Behind class? The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code. 13. Should user input data validation occur server-side or client-side? Why? All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user. 14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other? Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address. 15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset? Valid answers are: A DataSet can represent an entire relational database in memory, complete with tables, relations, and views. A DataSet is designed to work without any continuing connection to the original data source. Data in a DataSet is bulk-loaded, rather than being loaded on demand. There's no concept of cursor types in a DataSet. DataSets have no current record pointer You can use For Each loops to move through the data. You can store many edits in a DataSet, and write them to the original data source in a single operation. Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
62/69
3/15/13
16. What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events. 17. What are the Application_Start and Session_Start subroutines used for? This is where you can set the specific variables for the Application and Session objects. 18. Can you explain what inheritance is and an example of when you might use it? When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class. 19. Whats an assembly? Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN 20. Describe the difference between inline and code behind. Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page. 21. Explain what a diffgram is, and a good use for one? The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service. 22. Whats MSIL, and why should my developers need an appreciation of it if at all? MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer. 23. Which method do you invoke on the DataAdapter control to load your generated dataset with data? The Fill() method. 24. Can you edit data in the Repeater control? No, it just reads the information from its data source. 25. Which template must you provide, in order to display data in a Repeater control? ItemTemplate. 26. How can you provide an alternating color scheme in a Repeater control? Use the AlternatingItemTemplate. 27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control? You must set the DataSource property and call the DataBind method. 28. What base class do all Web Forms inherit from? The Page class. 29. Name two properties common in every validation control? ControlToValidate property and Text property. 30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box? DataTextField property. 31. Which control would you use if you needed to make sure the values in two different controls matched? CompareValidator control. 32. How many classes can a single .NET DLL contain? It can contain many classes.
Web Service Questions 1. What is the transport protocol you use to call a Web service? SOAP (Simple Object Access Protocol) is the preferred protocol. 2. True or False: A Web service can only be written in .NET? False 3. What does WSDL stand for?
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
63/69
3/15/13
3. What does WSDL stand for? Web Services Description Language.
4. Where on the Internet would you look for Web services? http://www.uddi.org 5. True or False: To test a Web service you must create a Windows application or Web application to consume this service? False, the web service comes with a test page and it provides HTTP-GET method to test.
State Management Questions 1. What is ViewState? ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks. 2. What is the lifespan for items stored in ViewState? Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page). 3. What does the "EnableViewState" property do? Why would I want it on or off? It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.
4. What are the different types of Session state management options available with ASP.NET? ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.
#347320
Author: Rating:
srinukatkam Points: 6
Member Rank: 0
Date:
16/Feb/2009
C# Interview Questions This is a list of questions I have gathered from other sources and created myself over a period of time from my experience, many of which I felt where incomplete or simply wrong. I have finally taken the time to go through each question and correct them to the best of my ability. However, please feel free to post feedback to challenge, improve, or suggest new questions. I want to thank those of you that have contributed quality questions and corrections thus far. There are some question in this list that I do not consider to be good questions for an interview. However, they do exist on other lists available on the Internet so I felt compelled to keep them easy access. General Questions 1. Does C# support multiple-inheritance? No. 2. Who is a protected class-level variable available to? It is available to any sub-class (a class inheriting this class). 3. Are private class-level variables inherited? Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited. 4. Describe the accessibility modifier protected internal. It is available to classes that are within the same assembly and derived from the specified base class. 5. Whats the top .NET class that everything is derived from? System.Object. 6. What does the term immutable mean? The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
64/69
3/15/13
7. Whats the difference between System.String and System.Text.StringBuilder classes? System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed. 8. Whats the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created. 9. Can you store multiple data types in System.Array? No. 10. Whats the difference between the System.Array.CopyTo() and System.Array.Clone()? The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object. 11. How can you sort the elements of the array in descending order? By calling Sort() and then Reverse() methods. 12. Whats the .NET collection class that allows an element to be accessed using a unique key? HashTable. 13. What class is underneath the SortedList class? A sorted HashTable. 14. Will the finally block get executed if an exception has not occurred? Yes. 15. Whats the C# syntax to catch any possible exception? A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}. 16. Can multiple catch blocks be executed for a single try statement? No. Once the proper catch block processed, control is transferred to the finally block (if there are any). 17. Explain the three services model commonly know as a three-tier application. Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).
Class Questions
1. What is the syntax to inherit from a class in C#? Place a colon and then the name of the base class. Example: class MyNewClass : MyBaseClass 2. Can you prevent your class from being inherited by another class? Yes. The keyword sealed will prevent the class from being inherited. 3. Can you allow a class to be inherited, but prevent the method from being over-ridden? Yes. Just leave the class public and make the method sealed. 4. Whats an abstract class? A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation. 5. When do you absolutely have to declare a class as abstract? 1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden. 2. When at least one of the methods in the class is abstract. 6. What is an interface 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. 7. Why cant you specify the accessibility modifier for methods inside the interface?
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
65/69
3/15/13
Method and Property Questions 1. Whats the implicit name of the parameter that gets passed into the set method/property of a class? Value. The data type of the value parameter is defined by whatever data type the property is declared as. 2. What does the keyword virtual declare for a method or property? The method or property can be overridden. 3. How is method overriding different from method overloading? When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class. 4. Can you declare an override method to be static if the original method is not static? No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override) 5. What are the different ways a method can be overloaded? Different parameter data types, different number of parameters, different order of parameters. 6. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor? Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.
Events and Delegates 1. Whats a delegate? A delegate object encapsulates a reference to a method. 2. Whats a multicast delegate? A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.
XML Documentation Questions 1. Is XML case-sensitive? Yes. 2. Whats the difference between // comments, /* */ comments and /// comments? Single-line comments, multi-line comments, and XML documentation comments. 3. How do you generate documentation from the C# file commented properly with a command-line compiler? Compile it with the /doc switch.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
66/69
3/15/13
Debugging and Testing Questions
1. What debugging tools come with the .NET SDK? 1. CorDBG command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch. 2. DbgCLR graphic debugger. Visual Studio .NET uses the DbgCLR. 2. What does assert() method do? In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true. 3. Whats the difference between the Debug class and Trace class? Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds. 4. Why are there five tracing levels in System.Diagnostics.TraceSwitcher? The tracing dumps can be quite verbose. For applications that are constantly running you run the risk of overloading the machine and the hard drive. Five levels range from None to Verbose, allowing you to fine-tune the tracing activities. 5. Where is the output of TextWriterTraceListener redirected? To the Console or a text file depending on the parameter passed to the constructor. 6. How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger. 7. What are three test cases you should go through in unit testing? 1. Positive test cases (correct data, correct output). 2. Negative test cases (broken or missing data, proper handling). 3. Exception test cases (exceptions are thrown and caught properly). 8. Can you change the value of a variable while debugging a C# application? Yes. If you are debugging via Visual Studio.NET, just go to Immediate window.
ADO.NET and Database Questions 1. What is the role of the DataReader class in ADO.NET connections? It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed. 2. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so its not as fastest and efficient as SqlServer.NET. 3. What is the wildcard character in SQL? Lets say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve La%. 4. Explain ACID rule of thumb for transactions. A transaction must be: 1. Atomic - it is one unit of work and does not dependent on previous and following transactions. 2. Consistent - data is either committed or roll back, no in-between case where something has been updated and something hasnt. 3. Isolated - no transaction sees the intermediate results of the current transaction). 4. Durable - the values persist if the data had been committed even if the system crashes right after. 5. What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password). 6. Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted? Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction. 7. What does the Initial Catalog parameter define in the connection string? The database name to connect to. 8. What does the Dispose method do with the connection object? Deletes it from the memory. To Do: answer better. The current answer is not entirely correct.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
67/69
3/15/13
Assembly Questions 1. How is the DLL Hell problem solved in .NET? Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly. 2. What are the ways to deploy an assembly? An MSI installer, a CAB archive, and XCOPY command. 3. What is a satellite assembly? When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies. 4. What namespaces are necessary to create a localized application? System.Globalization and System.Resources. 5. What is the smallest unit of execution in .NET? an Assembly. 6. When should you call the garbage collector in .NET? As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is usually not a good practice. 7. How do you convert a value-type to a reference-type? Use Boxing. 8. What happens in memory when you Box and Unbox a value-type? Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a value-type, thus storing the value on the stack.
Post Reply
Subscribe
Un Subscribe
This thread is locked for new responses. Please post your comments and questions as a separate thread. If required, refer to the URL of this page in your new post.
Share
Tw eet
Next : Please Please help.................. tooo urgent Previous : To upload Documents like(doc,pdf,etc) to file system Return to Discussion Forum Post New Message no of click on advertisement in asp.net application Related Messages Validation Controls
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
68/69
3/15/13
Category:
About Us
Contact Us
Copyright
Privacy Policy
Terms Of Use
Advertise
Copyright SpiderWorks Technologies Pvt Ltd., Kochi, India 2005 - 2012 All Rights Reserved.
.NET and othe r trade m ark s m e ntione d in this site be long to Microsoft and othe r re spe ctive trade m ark owne rs. Article s, tutorials and all othe r conte nt offe re d he re is for e ducational purpose only. W e are not associate d with Microsoft or its partne rs.
www.dotnetspider.com/forum/44959-Please-tell-me-.Net-interview-Questions-2-Years-Exp.aspx
69/69