You are on page 1of 35

54 ASP and ASP.

NET questions

1. Explain the life cycle of an ASP .NET page.


2. Explain the .NET architecture.
3. What are object-oriented concepts?
4. How do you create multiple inheritance in c# and .NET?
5. When is web.config called?

1. Explain the life cycle of an ASP .NET page.


2. Explain the .NET architecture.
3. What are object-oriented concepts?
4. How do you create multiple inheritance in c# and .NET?
5. When is web.config called?
6. How many weg.configs can an application have?
7. How do you set language in weg.config?
8. What does connection string consist of?
9. Where do you store connection string?
10. What is abstract class?
11. What is difference between interface inhertance and class inheritance?
12. What are the collection classes?
13. What are the types of threading models?
14. What inheritance does VB.NET support?
15. What is a runtime host?
16. Describe the techniques for optimizing your application?
17. Differences between application and session
18. What is web application virtual directory?
19. Differences between Active.exe and Dll
20. Connection pooling in MTS?
21. If cookies is disabled in client browser, will session tracking work?
22. How do you make your site SSL-enabled?
23. Will the following code execute successfully: response.write(’value of i=’+i);
24. What are the provides available with VB.NET?
25. What is a Process, Sesion and Cookie?
26. What are Abstract base classes?
27. What are the Difference between bstract base classes and Abstrat classes
28. What are interface in .NET?
29. How is Polymorphism supports in .NET?
30. What are the 2 types of polymorphism supports in .NET?
31. Types of compatibilities and explain them.
32. What is aggregative? How can it be implements in .NET?
33. Difference between COM components and .NET components?how to register it
34. Difference between early binding and late binding?
35. ASP.NET OBJECTS?
36. Asp.NET life cycle? When request mode
37. Explain ADO and its objects.
38. What is side by side execution?
39. Explain serialization?
40. Explain a class access specifiers and method acess specifiers.
41. What is the difference between overloading and overriding ? how can this be .NET
42. Explain virtual function and its usage.
43. How do you implement inhetance in .NET?
44. If I want to override a method 1 of class A and this class B then how do you declared
45. Explain friend and protected friend.
46. Explain multiple and multi_level inheritance in .NET?
47. Name all kind of access specifiers for a class and for methods?
48. On ODP.NET
49. What is non-derterministic finalization?
50. What is isPostback property?
51. What is dictionary base class?
52. How can a class be extended and how is this mechanism difff from that of implementation an interface?
53. What are indexes .NET?
54. How can indexes be implemented in .NET?

53 Responses to “54 ASP and ASP.NET questions”


1. Param Says:
December 23rd, 2006 at 7:38 am

.Net architecture

The order starting from the bottom


1. CLR (Common Language Runtime)
2. .Net framework base classe
3. ASP.Net Web Form / Windows Form

Kindly correct me if i am being wrong

2. Param Says:
December 23rd, 2006 at 7:52 am

Life cycle of ASP.Net Web Form

Page Request >> Start >> Page Init >> Page Load >> Validation >> PostBack Event Handling >> Page Rendering >> Page
Unload

Page Request - When the page is requested ASP.Net determines whether the page is to be parsed and compiled or a cached
verion of the page is to be sent without running the page.

Start - Page propertied REQUEST and RESPONSE are SET, if the page is pastback request then the IsPostBack property is SET
and in addition to this UICulture property is also SET.

Page Initilization - In this the UniqueID of each property is SET. If the request was postback the data is not yet loaded from the
viewstate.

Page Load - If it was a postback request then the data gets loaded in the control from the ViewState and control property are set.

Validation - If any control validation present, they are performed and IsValid property is SET for each control.

PostBack Event Handling - If it was a postback request then any event handlers are called.

Page Rendering - Before this the viewstate is saved from the page and RENDER method of each page is called.

Page Unload - Page is fully rendered and sent to the client(Browser) and is discarded. Page property RESPONSE and
REQUEST are unloaded.

3. Param Says:
December 23rd, 2006 at 8:00 am

How many web.configs can an application have?

There can only be 1 web.config in an application.

4. Param Says:
December 23rd, 2006 at 8:02 am

What is abstract class

Abstract class connot be instantiated instead it has to be inherited. The methods in abstract class can be overridetn in the child
class.

5. Param Says:
December 23rd, 2006 at 8:05 am

Differences between application and session ?

The application level variable hold value at the application level and their instances are destroyed when the no more client access
that application, whereas session corresspond to a individual user accessing the application.

6. Param Says:
December 23rd, 2006 at 8:08 am
What is web application virtual directory

Virtual directory is the physical location of the application on the machine.

By defalut it’s - inetpub/wwwroot

7. Param Says:
December 23rd, 2006 at 8:11 am

If cookies is disabled in client browser, will session tracking work?

No, maintaning value in cokkie woont be possible. In that case you have to make use of other ways to maintain state of the data
on page.

you can check whether client support cookies or not by using

Request.Browser.Cookies property.

8. Param Says:
December 23rd, 2006 at 8:28 am

What is a Process, Sesion and Cookie?

Process - Instance of the application

Session - Instance of the user accessing the application

Cookie - Used for storing small amount of data on client machine.

9. Paramjyoth Chadha Says:


December 23rd, 2006 at 2:55 pm

Explain serialization?

Serialization is a process of converting an object into a stream of bytes.

.Net has 2 serializers namely XMLSerializer and SOAP/BINARY Serializer.

Serialization is maily used in the concept of .Net Remoting.

10. Paramjyoth Chadha Says:


December 23rd, 2006 at 3:00 pm

What is the difference between overloading and overriding ? how can this be .NET?

Very simple way to remember the diff between them.

Overriding - Method has the same signature as the parent class method.

Overloading - Method having diff parameters list or type or the return type may be different.

11. Paramjyoth Chadha Says:


December 23rd, 2006 at 3:02 pm

How do you implement inhetance in .NET?

In C# we implement using the following signature

In VB.Net we implemets using the following signature

Inherits
12. Paramjyoth Chadha Says:
December 23rd, 2006 at 3:07 pm

Explain friend and protected friend?

Friend/Internal - Method, Properties in that class can be accessed by all the classes within that particular assembly.

Protected Friend/Protected Internal - Methods, Properties can be accessed by the child classes of that particular class in that
particular assembly.

13. Paramjyoth Chadha Says:


December 24th, 2006 at 10:11 pm

How do you set language in weg.config?

In Web.Config under element we can set the ‘defaultlanguage’ attribute.

14. Avnish Says:


December 26th, 2006 at 2:09 am

Explain friend and protected friend?

Friend/Internal - Method, Properties in a class can be accessed by all the classes within that particular assembly.

Protected Friend/Protected Internal - Methods, Properties can be accessed by all the classes in that particular assembly and also
by the child classes of that particular class.

15. Praveen Says:


January 8th, 2007 at 2:23 am

50. What is isPostback property?

This property is used to check whether the page is being loaded and accessed for the first time or whether the page is loaded in
response to the client postback.

Example:
Consider two combo boxes
In one lets have a list of countries
In the other, the states.

Upon selection of the first, the subsequent one should be populated in accordance. So this requires postback property in combo
boxes to be true.

16. Praveen Says:


January 8th, 2007 at 2:26 am

Where do you store connection string?

Database connection string can be stored in the web config file.

17. Praveen Says:


January 8th, 2007 at 2:30 am

What does connection string consist of?

The connection string consists of the following parts:

In general:
Server: Whether local or remote.

Uid: User Id (sa-in sql server)

Password: The required password to be filled-in here

Database: The database name.


And some fields to indicate whether the connection is trusted or not.

Checkout: http://www.connectionstrings.com to get enlightened with various connection string infos for several databases.

18. sneha Says:


January 10th, 2007 at 4:05 am

.net ARchitecture

from top
1)Listing all languages
2) Cls
3) CTS
4) BAse class
5) All application used for designing code
6) Clr
7) OS

19. Paramjyoth Says:


January 12th, 2007 at 4:03 am

What are the collection classes?

The .NET Framework provides specialized classes for data storage and retrieval.

These classes provide support for stacks, queues, lists, and hash tables.

20. Paramjyoth Says:


January 22nd, 2007 at 4:45 am

Where do you store connection string?

The connection string can be stored in the WEB.Config file under element

21. Paramjyoth Says:


January 22nd, 2007 at 4:46 am

Where do you store connection string?

The connection string can be stored in the WEB.Config file under element appsettings

22. Miyuru Ratnayake Says:


January 23rd, 2007 at 5:02 pm

What are object-oriented concepts?

Inheritance

Abstraction

Polymorphism

Encapsulation

23. Miyuru Ratnayake Says:


January 23rd, 2007 at 5:06 pm

What is difference between interface inhertance and class inheritance?

If its a interface inheritance and the inheritad class is not a abstact class or a interface class then all the methods in the supper
class needs to be implemented.

Class inheritance no need such thing.


24. Paramjyoth Says:
January 24th, 2007 at 1:26 am

What are Abstract base classes?

Abstact Class is nothing but a true virtual class..

This class cannot be instantiated instead it has to be inherited.

The method in abstract class are virtual and hence they can be overriden in the child class.

25. Paramjyoth Says:


January 24th, 2007 at 1:34 am

What is difference between interface inhertance and class inheritance?

Interface inheritance -
1. The accessibility modifier in Interface is public by defalut.
2. All the methods defined in the interface class should be oveririden in the child class.

Class Inheritance -
1. There is not restriction on the acessibility modifier in a class.
2. Only the method that are defined virtual should be overriden.

26. Ahmed Says:


January 28th, 2007 at 11:02 am

1. Explain the life cycle of an ASP .NET page.

Stage Events/Method
Page Initialization Page_Init
View State Loading LoadViewState
Postback data processin LoadPostData
Page Loading Page_Load
PostBack Change Notification RaisePostDataChangedEvent
PostBack Event Handling RaisePostBackEvent
Page Pre Rendering Phase Page_PreRender
View State Saving SaveViewState
Page Rendering Page_Render
Page Unloading Page_UnLoad

2. Explain the .NET architecture.

3. What are object-oriented concepts?


Class: The formal definition of an object. The class acts as the template from which an instance of an object is created at run
time. The class defines the properties of the object and the methods used to control the object’s behaviour.

Object: An object is an instance of a class.

Encapsulation: hides detailed internal specification of an object, and publishes only its external interfaces. Thus, users of an
object only need to adhere to these interfaces. By encapsulation, the internal data and methods of an object can be changed
without changing the way of how to use the object.

Inheritance: A class that derives from another class - known as the base class - inherits the same methods and properties. This
promotes reuse and maintainability.

Abstraction: the describing of objects by defining their unique and relevant characteristics (properties). Whilst an object may have
100s of properties normally only those properties of importance to the situation are described. (eg life policies premiums are
normally important; whereas the time of day a policy was purchased is not usually of value).

Polymorphism: Allows objects to be represented in multiple forms. Even though classes are derived or inherited from the same
parent class, each derived class will have its own behavior. (Overriding and hiding methods)

4. How do you create multiple inheritance in c# and .NET?


Use interfaces

public class MyTest: IPaidInterface, ISoldInterface

5. When is web.config called?


Web.config is an xml configuration file. It is never directly called unless we need to retrieve a configurations setting.

6. How many weg.configs can an application have?


One.

7. How do you set language in weg.config?

defaultLanguage=”vb”: This specifies the default code language.


debug=”true”: This specifies that the application should be run in debug mode

8. What does connection string consist of?


Server, user id, password, database name.

9. Where do you store connection string?


Web.config

10. What is abstract class?


An abstract class is a class that cannot be instantiated. Its purpose is to act as a base class from which other classes may be
derived.

11. What is difference between interface inheritance and class inheritance?


We can only inherit from one class but multiple interfaces. In addition, an interface does not contain any implementation it just
contains a series of signatures.

12. What are the collection classes?


Queue, Stack, BitArray, HashTable, LinkedList, ArrayList, NameValueCollection, Array, SortedList , HybridDictionary,
ListDictionary, StringCollection, StringDictionary

13. What are the types of threading models?


Single Threading: This is the simplest and most common threading model where a single thread corresponds to your entire
application’s process.

Apartment Threading (STA): This allows multiple threads to exist in a single application. In single threading apartment (STA), each
thread is isolated in it’s own apartment. The process may contain multiple threads (apartments) however when an object is
created in a thread (i.e. apartment) it stays within that
apartment. If any communication needs to occur between different threads (i.e. different apartments) then we must marshal the
first thread object to the second thread.

Free Threading: The most complex threading model. Unlike STA, threads are not confined to their own apartments. Multiple
treads can make calls to the same methods and same components at the same time.

14. What inheritance does VB.NET support?


Single inheritance using classes or multiple inheritance using interfaces.

15. What is a runtime host?


The runtime host is the environment in which the CLR is started and managed.

16. Describe the techniques for optimising your application?


. Avoid round-trips to server. Perform validation on client.
. Save viewstate only when necessary.
. Employ caching.
. Leave buffering on unless there is a dire need to disable it.
. Use connection pooling.
. Use stored procedures instead of in-line SQL or dynamic SQL.

17. Differences between application and session


The session object maintains state on a per client basis whereas the application object is on a per application basis and is
consistent across all client requests.

18. What is web application virtual directory?


A virtual directory appears to client browsers as though it were contained in a Web server’s root directory, even though it can
physically reside somewhere else.

27. Sanjay Sikar Says:


January 29th, 2007 at 5:36 am

Net architecture
The order starting from the bottom

1. Physical Hardware Machine (Intel Pentium, apple machntosh)


2. Operating System (Microsoft Windows, Linux etc)
3. Common Language Runtime (CLR)
4. Framework Class Library (FCL)
5. ADO.Net and XML Library
6. WinForm, Web Application, Web Serivces (Managed Application)

28. Victor Fernandez Says:


February 9th, 2007 at 5:12 am

35. ASP.NET OBJECTS?

Application,Request,Responce,server and session

29. Sanjay Sinkar Says:


February 15th, 2007 at 1:03 am

What are object-oriented concepts?

Polymorphism
Encapsulation
Abstraction
Inheritance

30. Sasidhara K Karasi Says:


February 15th, 2007 at 5:05 am

Param said,
How many web.configs can an application have?

There can only be 1 web.config in an application.

@Param, Each directory can have a web.config file. but, the settings like httpmodules, authentication can resides in root
directory’s web.config file.
______________________
Sasi.
sasi.karasi@gmail.com

31. Arnab Says:


February 15th, 2007 at 8:56 am

How many web.configs can an application have?

There can be more than one Web.config file in an application.

32. Sivakumar Says:


February 17th, 2007 at 12:24 am

1.Explain the life cycle of an ASP .NET page.

In ASP.NET2.0 page life cycle events are fired by the following sequence.

1.PreInit, 2.Init, 3.InitComplete, 4.PreLoad, 5.Load, 6.Control events, 7.LoadComplete, 8.PreRender, 9. SaveStateComplete, 10.
Render, 11.Unload
———
Sivakumar
http://www.dotnetanalyst.com

33. Anil Goyal Says:


March 7th, 2007 at 5:12 am

How many web.configs can an application have?

There can be more than one Web.config file in an application depend on how many subdirectories in your application. i.e. one
eb.config for one subdir.

34. reshu Says:


April 10th, 2007 at 7:31 am
1) Explain the .NET architecture.
1) All .Net supported Languages
2) Common Language specification
3) Windows forms / web pages
4) ADO.Net / web services
5) Base class library
6) Common language runtime
7) Operating system.

2) How does u create multiple inheritances in c# and .net?


Multiple inheritances are created by using interfaces.

3) When web.config is called ?


Web.config is an xml configuration file.this never gets called directly unless we need to retrieve the configuration setting.

4) How many weg.configs a application can have


one.

5) How does u set language in weg.config


a) set the ‘defaultlanguage’ attribute.

6) What does connection string consists of


a) connection string consist of : server name, userid , password , database name.

7) Where do u store connection string


a) connection string can stored in web.config file under configuration / connection string tab.

8) What is abstract class?


Abstract class is a class which cannot be instantiated but inherited by derived classes. This class contains abstract as well as
non-abstract methods and members.

9) What is diff b/w interface inheritance and class inheritance


A class can have multiple interface inheritance, but only one.
In interface inheritance : Inherited class must implement all the methods define in that interface. Class inheritance : inherited
class may or may not implement all methods of that base class.

10) What are the collection classes?


1) Array list
2) Hash table
3) stack
4) Dictionary
5) Queue

12) What inheritance support vb.net?


a) Single class inheritance and multiple interface inheritance.

13) What is runtime host?


a) Runtime host is local environment where CLR is running.

14) OOPS CONCEPTS


1) Encapsulation : Hiding internal implementation of the objects and provide global interface access to object.
2) Inheritance : The ability of a class to reuse the members and member functions of its base class.
3) Polymorphism : The ability of the objects to be represented in multiple forms. This is possible with overriding and overloading.
4) Abstraction : Describing an object with its unique and relevant characteristics according to specific need.

15) optimization technique description


1) Avoid unnecessary use of view state which lowers the performance.
2) Avoid the round trips to server.
3) Use connection pooling.
4) Use stored procedures.

16) Diff b/w application and session


a) Application object maintains state on application basis whereas session object maintain the state of the client visited to the
application.

17) What is web application virtual directory?


a) Virtual directory is a physical location where actually application folder is situated.

18) Diff b/w Active.exe and Dll


1) Exe has an entry point.
2) If Dll is getting destroyed, exe also destroyed.
20) If cookies are disabled in client browser will session work
a) No. Identities of client gets destroy.

23) The following code executes successfully


response. Write (“value of i=”+i) ;
a) Yes.

25) What are a Process, Session and Cookie?


1) Process : Is a running thread of application.
2) Session : state used to maintain user state in application.
3) cookie : used to store user identification data on client machine.

29) How is Polymorphism supports in .net?


Polymorphism supports to objects to be represent in different forms..

30) What r the 2 types of polymorphism support in .net?


Overriding and overloading

35) ASP.NET OBJECTS?


Request, Response, Server, Session, application,

38) What is side by side execution


Asynchronous execution in which application keeps on running instead of waiting for the result of previous stage execution.

39) What serialization?


Serialization is a process of conversion an objects into stream of bytes so that they can transfer through the channels.

40) About a class access specifiers and method access specifiers


1) Public : available throughout application.
2) Private : available for class and its inherited class.
3) Protected : restricted to that class only.
4) Internal : available throughout that assembly.

41) What diff b/w overloading and overriding? How can this be .net
Overriding : derived classes follow the same base class method signatures.
Overloading : Derived classes may have different method signature with different parameters.
42) About virtual function and then use
Virtual function is that which is get override by the derived class to implement polymorphism.

How do u implement inheritance in .net?


In c# : we use :

44)if I want to override a method 1 of class A and this class B then how do u declared
answer :
public virtual void method1(){ }………..In class A. public override void method1(){}…………..In class B.

45) About friend and protected friend


Friend / internal : provides access throughout that particular assembly.
Protected friend : provides access for that particular class and to its child classes.

46) About multiple and multilevel Inheritance how to a chive in .net?


Multiple Inheritance: ex. Public void Employee : Persons, Iemployee. Means a class can be inherited by more than one interface
OR inherited by one class and
more than one interfaces.
Multi level inheritance: ex. Public void Person () {}, Public void Customer : person {} , Public void employee : customer{}.

50) What is isPostback property?


Is postback is a property of page to check weather the page is loaded first time or in response to the client callback.

35. Irfan Says:


May 14th, 2007 at 10:50 am

Q 52: What is dictionary base class?


Answer: Provides the abstract base class for a strongly typed collection of key/value pairs.
Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)

36. Irfan Says:


May 14th, 2007 at 11:03 am
Q 53: What are indexes .NET?
Answer: Indexes are set up as a subset of data from the column it is created in an index table and a set of pointers to the physical
table itself. The index tables are updated when data is inserted, updated or deleted. This can actually have negative performance
impact if indexes are unnecessarily created. The overuse of indexes can become as much as burden to the application as not
having indexes.

37. Brandon G. Wang Says:


May 26th, 2007 at 10:26 am

4) How many weg.configs a application can have

Each and Every ASP.NET application has its own copy of configuration settings stored in a file called Web.config. If the web
application spans multiple folders, each sub folder has its own Web.config file that inherits or overrides the parent’s file settings.

38. Muthu Says:


June 12th, 2007 at 2:21 am

28.What are interface in .NET?


Interface similar to class But it contains abstract methods only.
It supports Multiple interface instead of multiple inheritance.
It does’t support accessibility modifiers. Hence it is not implemented. It is implemented by class.

39. PradeepKumar Says:


June 14th, 2007 at 12:21 am

Where do you store connection string?

Database Connection can be stored in ur code behind file or web.config file.

while storing in web.config file it will minimize the code and performance willbe good compare to storing in code behind file

40. Deepak Kolhe Says:


July 2nd, 2007 at 2:31 am

Q. What are the 2 types of polymorphism supports in .NET?


A. Two types of polymorphism supported in .Net are:
1. Polymorphism via Inheritance
2. Polymorphism via Interfaces

41. Deepak Kolhe Says:


July 2nd, 2007 at 2:39 am

Q. What is the difference between overloading and overriding ? how can this be .NET
A.1.Overloading: Refers to two methods with same name but different Signature(varing parameters).
2.Overriding: Refers to inherit methods from base class with different same name as well as Signature.

42. elena Says:


July 8th, 2007 at 10:09 am

What is Server.Execute in (Terms.aspx)

43. Skip Oberon Says:


July 8th, 2007 at 9:52 pm

Hi all, I just wanted to ask your advice on a few things if you don’t mind. I have a web page and the IsPostback appears to be
going back and forth between true and false every time the thing is loaded and I don’t know where I can look in the
documentation for an indication of what or why these things are behaving in this way considering the fact that I have spent hours
upon days trying to untangle all the bits and peaces of this from that and the other oh why won’t you help me please to help me to
figure out why my conundrum clouds my ever doglegged contraption of a mental auction house barstool.

44. sachin Says:


July 25th, 2007 at 12:38 am

Q. What are the 2 types of polymorphism supports in .NET?


Ans.
1. Interface Polymorphism
2. Inheritance Polymorphism

45. sachin Says:


July 25th, 2007 at 12:40 am

What are object-oriented concepts?

Encapsulation
Polymorphism
Abstraction

46. What does connection string consist of? Says:


August 14th, 2007 at 12:16 am

Connection String for .Net & SQL Server consist of:

1.Data Source = “./SQLEXPRESS”; serverName\instanceName as Data Source to use a specific SQL Server instance

2.Initial Catalog = “DATABASE_NAME”;

Either
3.Uid=”UserID for SQL server” ;
4.Password= “Password for SQL server”;
OR
Integrated Security=”True”; Use Windows security

5.Provider Name =”System.Data.SqlClient”;

47. Deepak Kolhe Says:


August 14th, 2007 at 12:22 am

What are the types of threading models?

There are two types of threading models:


1.STA (Single threading arch.)
2.MTA (Multi threading arch.)

48. Mohammad Omar Says:


September 29th, 2007 at 1:43 pm

Q. What are the 2 types of polymorphism supports in .NET?

1. Runtime which is done by virtual functions, that is you have method overriding.
2. Compile time that is by the method overloading.

49. Mohammad Omar Says:


September 29th, 2007 at 1:46 pm

Q 53: What are indexes .NET?

It is a way to make your class iterate like an array. i.e if you have have a class Car then you can access its object like mycar[0],
mycar[1] …

50. Shilpa Says:


October 18th, 2007 at 10:23 am

Let me add up for number of web.config in an application,

We can have multiple web.config in an application provided that are being in different directories(folders), each folder can have
only one web.config, and will affeted all the pages under the same folder, but typically a web application itself is divided into
multiple folders, so we can have multiple web.config, and if a particular folder does not have web.config, then the web .config
present in its parent folder will be applicable to the all pages inside this folder.

51. Raj Says:


November 20th, 2007 at 1:50 pm
How many weg.configs can an application have?

An application can have any number of web.config files but each file in a seperate folder.

if an application has 5 folders then the application can have 5 web.config files in the folders + 1 web.config file in root directory

52. jiten Says:


December 15th, 2007 at 9:18 pm

Explain the life cycle of an ASP .NET page.


Explain the .NET architecture.
What are object-oriented concepts?
How do you create multiple inheritance in c# and .NET?

>> By using interface u can create multipal inheritance in c#

When is web.config called?

How many weg.configs can an application have?

>> As u want but in different folder in sol. explorer

How do you set language in weg.config?

What does connection string consist of?


Where do you store connection string?

>> In Web Comfig File

What is abstract class?

>> With Has a two type of method


1. just sign (No functionality )
2. concert method (with functionlity)
What is difference between interface inhertance and class inheritance?

>> interface inhetance may be multipal


class inhetance may be multy level

What are the collection classes?

What are the types of threading models?

What inheritance does VB.NET support?


What is a runtime host?
Describe the techniques for optimizing your application?

Differences between application and session


>> application state does not change for end user
session state is create for every user

What is web application virtual directory?


Differences between Active.exe and Dll
Connection pooling in MTS?

If cookies is disabled in client browser, will session tracking work?


>> no but sql and state seesion may be wotk

How do you make your site SSL-enabled?


Will the following code execute successfully: response.write(’value of i=’+i);
What are the provides available with VB.NET?
What is a Process, Sesion and Cookie?
What are Abstract base classes?
What are the Difference between bstract base classes and Abstrat classes

What are interface in .NET?


>> interface has only one type of method
witch is just signed not functionlity is there
By using interface multipal inheretace is possible
How is Polymorphism supports in .NET?

>> yes overloding and overiding

What are the 2 types of polymorphism supports in .NET?


>> compile time and run time polymorphism

Types of compatibilities and explain them.


What is aggregative? How can it be implements in .NET?
Difference between COM components and .NET components?how to register it

Difference between early binding and late binding?

ASP.NET OBJECTS?
Asp.NET life cycle? When request mode
Explain ADO and its objects.
What is side by side execution?
Explain serialization?

Explain a class access specifiers and method acess specifiers.


>> there is 5 access specifiers
public
protected
private
internal
protected internal
What is the difference between overloading and overriding ? how can this be .NET
>> with in class overloding is posible
by using drive class overriding is posible

Explain virtual function and its usage.


>> it’s tell compliler that this method might be override

How do you implement inhetance in .NET?

>> in c# using :
in Vb inhertans

If I want to override a method 1 of class A and this class B then how do you declared

>>class B : A
{
public override method1()
{}
}

Explain friend and protected friend.

>> friend == this type of members is available for all classs those are in same assembly

>> protected frined == same assembly classs and drive classs can able to access this type of members

Explain multiple and multi_level inheritance in .NET?

>> multiple == class A : intehert interface1,interface2

multi_level == class A {}
class B : A {}
class c : B {}

What is isPostback property?

>> it’s check this page is load first time

What is dictionary base class?


How can a class be extended and how is this mechanism difff from that of implementation an interface?
What are indexes .NET?
How can indexes be implemented in .NET?
Categories: Web dev, .NET
53. Balaji Telugunti Says:
December 26th, 2007 at 9:29 am

Q. How many weg.configs can an application have?

A. You should have only one web.config. but in sub folder you can have one web.cofing to set configuration of that folders.

example if your application have 3 folders then 4 web.config have in your application

6.

More interview questions »

Posted in: .NET, Web dev | Comments(53)

.NET WebDev interview questions - Part 3

1. State True or False: If you set AutoGenerateColumns=True and still provide custom column definitions, the DataGrid will render
both
o True
o False
2. The data from an XSL Transform with XmlReader can be returned in one of the following ways
o objReader = objXslT.Transform(objNav, nothing)
o objXslT.Transform(objNav, nothing)
o objReader = objXslT.Transform(objNav, nothing, objWriter)
o objXslT.Transform(objNav, nothing, objWriter)
3. Pick the command line that would result in the C# compiler generating an XML documentation file
o csc /doc:NewHome.xml NewHome.cs
o c /doc /docfile: NewHome.xml NewHome.cs
o csc /doc /out: NewHome.xml NewHome.cs
o csc /xml NewHome.cs
4. What is the comment syntax for C#’s XML-based documentation?
o /** and **/
o //#
o ///
o //*

More interview questions »

Posted in: .NET, Web dev | Comments(71)

.NET WebDev interview questions - Part 2

1. A structure in C# can be derived from one or more


o class
o interface
o both
o none
2. State True or False: Static method cannot be overridden
o True
o False
3. The Equivalent HTML Control for the <input type=”button”> tag is
o HtmlInput
o HtmlButton
o HtmlPushButton
o HtmlInputButton
4. The Equivalent Html Control for the <input type=”checkbox”> tag is
o HtmlCheckBox
o HtmlInputChkBox
o HtmlInputCheckBox
o HtmlInputTypeChkBox

More interview questions »

Posted in: .NET, Web dev | Comments(63)


.NET WebDev interview questions - Part 1

1. Which of the following languages is NOT included in the default .NET Framework installation?
o C#
o VB.NET
o JScript.NET
o VBScript.NET
2. What are the different types of serialization supported in .NET Framework
o XmlSerializer
o SoapFormatter
o XPathNavigator
o HttpFormatter
3. The CLR uses which format for assembly version numbers
o Major:Minor:Revision:Build
o Major:Build:Minor:Revision
o Major:Revision:Minor:Build
o Major:Minor:Build:Revision
4. What tool is used to manage the GAC?
o GacMgr.exe
o GacSvr32.exe
o GacUtil.exe
o RegSvr.exe

More interview questions »

Posted in: .NET, Web dev | Comments(43)

Some general quickies

1. How did you first get interested in Computer Science?


2. What do you like to do best related to computers now (programming, administration, testing, manage projects, etc)? What is it
about that area that you specifically enjoy?
3. What is your strongest programming language (Java, ASP, C, C++, VB, HTML,C#, etc.)?
4. When is the last time you coded in C/C++? What is the most lines of original C/C++ code you have personally written in one
project? How confident are you in your ability to write C or C++ without a reference?

Posted in: C++, General | Comments(1)

Interview questions for .NET

1. What is a static class?


2. What is static member?
3. What is static function?
4. What is static constructor?
5. How can we inherit a static variable?
6. How can we inherit a static member?
7. Can we use a static function with a non-static variable?
8. How can we access static variable?
9. Why main function is static?

1. What is a static class?


2. What is static member?
3. What is static function?
4. What is static constructor?
5. How can we inherit a static variable?
6. How can we inherit a static member?
7. Can we use a static function with a non-static variable?
8. How can we access static variable?
9. Why main function is static?
10. How will you load dynamic assembly? How will create assesblies at run time?
11. What is Reflection?
12. If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) in my
application?
13. How do you create threading in.NET? What is the namespace for that?
14. What do you mean by Serialize and MarshalByRef?
15. What is the difference between Array and LinkedList?
16. What is Asynchronous call and how it can be implemented using delegates?
17. How to create events for a control? What is custom events? How to create it?
18. If you want to write your own dot net language, what steps you will you take care?
19. Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?
20. How dot net compiled code will become platform independent?
21. Without modifying source code if we compile again, will it be generated MSIL again?
22. How does you handle this COM components developed in other programming languages in.NET?
23. How CCW (Com Callable Wrapper) and RCW (Runtime Callable Wrappers) works?
24. What are the new thee features of COM+ services, which are not there in COM (MTS)?
25. What are the differences between COM architecture and.NET architecture?
26. Can we copy a COM dll to GAC folder?
27. What is Shared and Repeatable Inheritance?
28. Can you explain what inheritance is and an example of when you might use it?
29. How can you write a class to restrict that only one object of this class can be created (Singleton class)?
30. What are virtual destructures?
31. What is close method? How its different from Finalize and Dispose?
32. What is Boxing and UnBoxing?
33. What is check/uncheck?
34. What is the use of base keyword? Tell me a practical example for base keyword’s usage?
35. What are the different.NET tools which you used in projects?
36. What will do to avoid prior case?
37. What happens when you try to update data in a dataset in.NET while the record is already deleted in SQL Server as backend?
38. What is concurrency? How will you avoid concurrency when dealing with dataset?
39. One user deleted one row after that another user through his dataset was trying to update same row. What will happen? How will
you avoid this problem?
40. How do you merge two datasets into the third dataset in a simple manner?
41. If you are executing these statements in commandObject. “Select * from Table1; Select * from Table2″ How you will deal result
set?
42. How do you sort a dataset.
43. If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?
44. What is the use of Parameter object?
45. How to generateXML from a dataset and vice versa?
46. How do you implement locking concept for dataset?
47. How will you do Redo and Undo in TextBox control?
48. How to implement DataGrid in.NET? How would you make a combo-box appear in one column of a DataGrid? What are the ways
to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods. what is the
access specifier used for that methods in the code behind file and why?
49. How can we create Tree control in asp.NET?
50. Write a program in C# to find the angle between the hours and minutes in a clock?
51. Write a program to create a user control with name and surname as data members and login as method and also the code to call
it.
52. How can you read 3rd line from a text file?
53. Explain the code behind wors and contrast that using the inline style.
54. Explain different types of HTML, Web and server controls.
55. What are the differences between user control and server control?
56. How server form post-back works?
57. Can the action attribute of a server-side

tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page?

58. How would ASP and ASP.NET apps run at the same time on the same server?
59. What are good ADO.NET object to replace to ADO Recordset object.
60. Explain the differences between Server-side code and Client-side code.
61. What type of code(server or client) is found in a Code-Behind class?
62. Should validation (did the user enter a real date) occur server-side or client-side? Why?
63. What does the “EnableViewState” property do? Why would I want it on or off?
64. What is the difference between Server.Transfer and response.Redirect? Why?
65. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced.NET component?
66. Let’s say I have an existing application written using VB6 and this application utilizes Windows 2000 COM+ transaction services.
How would you approach migrating this application to.NET?
67. If I am developing an application that must accomodate multiple security levels though secure login and my ASP.NET web
application is spanned across three web-servers (using round-robin load balancing). What would be the best approach to
maintain login-in state for the users?
68. What are ASP.NET web forms? How is this technology different than what is available though ASP(1.0-3.0)?
69. How does VB.NET achieve polymorphism?
70. How does C# achieve polymorphism?
71. Can you explain what is Inheritance and an example in VB.NET and C# of when you might use it?
72. Describe difference between inline and code-behind?
73. What is loosely coupled solution in.NET?
74. What is diffgram?
75. Where would you use an iHTTPModule and what are the limitations of any approach you might take in implementing one?
76. What are the Advantages and DisAdvantages of viewstate?
77. Describe session handling in a webform, how does it work and what are the limitations?
78. How would you get ASP.NET running in Apache web servers? Explain it’s limitations.
79. What is MSIL and why should my developers need an appreciation of it if at all?
80. Which methos do you invoke on the DataAdapter control to load your generated dataset with data?
81. Can you edit data in Repeater control? How?
82. Which template must you provide, in order to display data in a Repeater control?
83. How can you provide an alternating color scheme in a Repeater control?
84. 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?
85. What base class do all web forms inherit from?
86. What method do you use to explicitly kill a user’s session? How?
87. How do you turn off cookies for one page in your site? Give an example.
88. Which two properties are on every validation control?
89. What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.
90. How do you create a permanent cookie?
91. What tag do you use to add a hyperlink column to the dataGrid?
92. What is the standard you use to wrap up a call to a Web Service?
93. Which method do you use to redirect the user to another page without performing a round trip to the client? How?
94. What is the transport protocol you use to call a Seb Service SOAP?
95. What does WSDL stand for?
96. What property do you have to set to tell the grid which page to go to when using the Pager object?
97. Where on the Internet would you look for Web Services?
98. What tags do you need to add within the asp:datagrid tags to bind columns manually? How?
99. 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?
100. How is a property designated as read-only?
101. Which control would you use if you needed to make sure the values in two different controls matched?

Posted in: .NET |

15 Responses to “Interview questions for .NET”

1. ishaq Says:
October 26th, 2006 at 9:33 am

I want to know
what is multiple inheritance?
what is Virtual polymorphism?
how to fetch 5th and 15th record from the datagrid using c#.net?

2. vishal Says:
November 3rd, 2006 at 4:38 am

can we write c# code in web.config file?


can we bind datagrid with datareader?
can we add two web.config in one project?

3. Haris Habib Says:


November 30th, 2006 at 6:08 am

what is multiple inheritance?


The way to inherit a class from multiple classes.
In C++ that was possible but not in C# and Vb.Net.
Altough you can Inherit/Implement from multiple interfaces.

4. Ali Baba Says:


January 11th, 2007 at 12:10 am

to fetch the records from any row just use the following technique:

datagrid.rows[n].columns[m]
where n is the row number and m is the column number

to fetch from gridview:


gridview.rows[n].ItemArray[m]

5. Ahmed Says:
January 26th, 2007 at 8:47 am

1. What is a static class?


A static class is a class which can not be instantiated using the ‘new’ keyword. They also only contain static members, are
sealed and have a private constructor.
2. What is static member?
A static member is a method, field, property or event that can be called without creating an instance of its defining class. Static
members are particularly useful for representing calculations and data that are independent of object state.

3. What is static function?


A static function is another term for a static method. It allows you to execute the function without creating an instance of its
defining class. They are similar to global functions. An example of a static function could be: ConvertFromFarenheitToCelsius with
a signature as follows:

public static double ConvertFromFarenheitToCelsius (string valToConvert)


{
//add code here
}

4. What is static constructor?


A static constructor has a similar function as a normal constructor i.e. it is automatically called the first time a class is loaded. The
differences between a conventional constructor are that it cannot be overloaded, cannot have any parameters nor have any
access modifiers and must be preceded by the
keyword static. In addition, a class with a static constructor may only have static members.

5. How can we inherit a static variable?


6. How can we inherit a static member?
When inheriting static members there is no need to instantiate the defining class using the ‘new’ keyword.

public class MyBaseClass


{
MyBaseClass()
{
}
public static void PrintName()
{
}

public class MyDerivedClass : MyBaseClass


{
MyDerivedClass ()
{
}

public void DoSomething()


{
MyBaseClass.GetName();
}

7. Can we use a static function with a non-static variable?


No.

8. How can we access static variable?


By employing the use of a static member field as follows:
public class CashSales
{
//declare static member field
private static int maxUnitsAllowed = 50;

//declare method to return maximum number of units allowed

public static int GetMaxUnitsAllowed ()


{
Return maxUnitsAllowed;
}

}
The static field can now be accessed by simply doing CashSales.GetMaxUnitsAllowed(). No need to create an instance of the
class.

9. Why main function is static?


Because it is automatically loaded by the CLR and initialised by the runtime when the class is first loaded. If it wasn’t static an
instance of the class would first need to be created and initialised.
10. How will you load dynamic assembly? How will create assemblies at run time?

Load assembly:
By using classes from the System.Reflection namespace.
Assembly x = Assembly.LoadFrom( “LoadMe.dll” );

Create assembly;
Use classes from System.CodeDom.Compiler;

11. What is Reflection?


The System.Reflection namespace provides us with a series of classes that allow us to interrogate the codebase at run-time and
perform functions such as dynamically load assemblies, return property info e.t.c.

12. If I have more than one version of one assembly, then how will I use old version (how/where to specify version number?) in
my application?
The version number is stored in the following format: …. The assembly manifest can then contain a reference to which version
number we want to use.

13. How do you create threading in.NET? What is the namespace for that?

System.Threading;

//create new thread using the thread class’s constructor

Thread myThread = new Thread(new ThreadStart (someFunction));

14. What do you mean by Serialize and MarshalByRef?


Serialization is the act of saving the state of an object so that it can be recreated (i.e deserialized) at a later date.
The MarshalByRef class is part of the System.Runtime.Remoting namespace and enables us to access and use objects that
reside in different application domains. It is the base class for objects that need to communicate across application domains.
MarshalByRef objects are accessed directly within their own application domain by using a proxy to communicate. With
MarshalByValue the a copy of the entire object is passed across the application domain

15. What is the difference between Array and LinkedList?


An array is a collection of the same type. The size of the array is fixed in its declaration.
A linked list is similar to an array but it doesn’t have a limited size.

16. What is Asynchronous call and how it can be implemented using delegates?
A synchronous call will wait for a method to complete before program flow is resumed. With an asynchronous call the program
flow continues whilst the method executes.

//create object
SomeFunction objFunc = new SomeFunction();

//create delegate
SomeDelegate objDel = new SomeDelegate(objFunc.FunctionA);

//invoke the method asynchronously (use interface IAsyncResult)


IAsyncResult asynchCall = SomeDelegate.Invoke();

17. How to create events for a control? What is custom events? How to create it?
An event is a mechanism used in a class that can be used to provide a notification when something interesting happens. (typical
evens in a windows application include: change text in textbox, double click or click a button, select an item in dropdown box).

A custom event is an event created by the user that other developers can use. For example assuming that we have a
CashTransaction class and we have a bank balance property in that class. We may want to set-up an event that provides a
notification when the bank balance drops below a certain amount. In order to produce an event the process would be roughly as
follows:

Create the class for the event derived from EventArgs.


Create a delegate with a return type of void.
Create a class containing the method that will activate the event.
Create a class with methods to handle the event.

18. If you want to write your own dot net language, what steps you will you take care?
We will need to ensure that the high level code is compiled to MSIL (Microsoft intermediate language) so that it can be interpreted
by the CLR.

19. Describe the difference between inline and code behind - which is best in a loosely coupled solution?
The term ‘code behind’ refers to application code that is not embedded within the ASPX page and is separated out into a
separate file which is then referenced from the ASPX page. Inline code is the traditional ASP architectural model where business
logic code was embedded within the ASP page. Separating the business logic code from the presentation layer offers several
advantages:

1) It allows graphic designers and web developers to work on the presentation layer whilst the application developers concentrate
on the business logic.
2) The codebehind file is compiled as a single dll increasing the efficiency of the application,
3) The codebehind model offers a true OO development platform,
4) It speeds up development time as it allows developers to fully maximise the features of the .NET framework such as Cahing,
ViewState, Session, Smart Navigation etc.
5) Code is much easier to maintain and susceptible for change.
6) The compiler and VS.NET provides much better support for error checking, intellisense and debugging when using the code
behind model.

20. How dot net compiled code will become platform independent?
The raison d’etre for .NET was to cater for multiples languages on a single windows platform whereas the aim of Java was to
be a single language on multiple platforms. The only way that .NET can be platform independent is if there is a version of the
.NET framework installed on the target machine.

21. Without modifying source code if we compile again, will it be generated MSIL again?
No.

22. How does you handle this COM components developed in other programming languages in.NET?
use TlbImp.exe to import the COM types into your .NET project. If no type library for the COM component then use
System.Runtime.InteropServices

22. How does you handle this COM components developed in other programming languages in.NET?
use TlbImp.exe to import the COM types into your .NET project. If no type library for the COM component then use
System.Runtime.InteropServices
use RegAsm.exe to call a .NET developed component in a COM application.

23. How CCW (Com Callable Wrapper) and RCW (Runtime Callable Wrappers) works?
CCW: When a COM application calls a NET object the CLR creates the CCW as a proxy since the COM application is unable to
directly access the .NET object.
RCW: When a .NET application calls a COM object the CLR creates the RCW as a proxy since the .NET application is unable to
directly access the .COM object.

24. What are the new thee features of COM+ services, which are not there in COM (MTS)?
Role based security.
Neutral apartment threading.
New environment called context which defines the execution environment

25. What are the differences between COM architecture and.NET architecture?
.Net architecture has superseded the old COM architecture providing a flexible rapid application development environment which
can be used to create windows, web and console applications and web services. .NET provides a powerful development
environment that can be used to create objects in any .NET compliant language. .NET addresses the previous problems of dll hell
with COM by providing strongly named assemblies and side-by-side execution where two assemblies with the same name can
run on the same box.

26. Can we copy a COM dll to GAC folder?


No. It only stores .NET assemblies.

28. Can you explain what inheritance is and an example of when you might use it?
Inheritance is a fundamental feature of any OO language. It allows us to inherit the members and attributes from a base class to a
new derived class. This leads to increased code reusability and also makes applications easier to develop, maintain and extend
as the new derived class can contain new features not available in the base class whilst at the same time preserving the
attributes inherited from the base class.

29. How can you write a class to restrict that only one object of this class can be created (Singleton class)?
Use the singleton design pattern.
public sealed class Singleton
{
static readonly Singleton Instance=new Singleton();

static Singleton()
{
}

Singleton()
{
}

public static Singleton Instance


{
get
{
return Instance;
}
}
}

30. What are virtual destructors?


A constructor can not be virtual but a destructor may. Use virtual destructors when you want to implement polymorphic tearing
down of an object.

31. What is close method? How it different from Finalize and Dispose?
finalise is the process that allows the garbage collector to clean up any unmanaged resources before it is destroyed.
The finalise method can not be called directly; it is automatically called by the CLR. In order to allow more control over the release
of unmanaged resources the .NET framework provides a dispose method which unlike finalise can be called directly by code.
Close method is same as dispose. It was added as a convenience.

32. What is Boxing and UnBoxing?


Boxing is the process of converting a value type to a reference type. More specifically it involves encapsulating a copy of the
object and moving it from stack to heap. Unboxing is the reverse process.

33. What is check/uncheck?


checked: used to enable overflow checking for arithmetic and conversion functions.
unchecked: used to disable overflow checking for arithmetic and conversion functions.

6. Alex Says:
February 13th, 2007 at 3:45 pm

what is different between BCL and FCL in dot net?


The Base Class Library (BCL), sometimes incorrectly referred to as the Framework Class Library (FCL) (which is a superset
including the Microsoft.* namespaces), is a library of types available to all languages using the .NET Framework. The BCL
provides classes which encapsulate a number of common functions such as file reading and writing, graphic rendering, database
interaction, XML document manipulation, and so forth. The BCL is much larger than other libraries, but has much more
functionality in one package.

7. RajhaRajesuwari Says:
March 30th, 2007 at 1:56 am

What is a Delegate?
What is the purpose of autoeventwireup?

8. RajhaRajesuwari Says:
March 30th, 2007 at 2:02 am

What is difference between web.config and machine.config?


Web config file gives the configuration setting s of a particular application and machine .config contains the configuration setting
of a particular machine.the web.config settings of a particular application overwrites the machine.config

9. Muthu Says:
June 12th, 2007 at 2:31 am

What is delegate?
Delegate encapsulates a reference to a method.
It has two types,
1.Simple delegate
At a time Only one method can be invoked by single call.
e.g: del delname=new delname(obj.function_name)//To assign a method
delname()//To call that method

2.multicast delegate
At a time two or more methods can be invoked by single call.

10. Muthu Says:


June 12th, 2007 at 2:42 am

What is virtual polymorphism?


Polymorphism means ability to take more than one form.
It likes same name but different meanings.
virtual polymorphism means method name is same for base class and derived class. It is used for instead of “override” keyword.
11. Muthu Says:
June 12th, 2007 at 2:46 am

1.What is differ between panel & group box?


2.What operator performs pattern matchin?

12. Rehan Raza Says:


July 8th, 2007 at 11:17 am

diff. between static class and sealed class?


diff. between Server.Tansfer and Server.Execute?
diff. bet. abstract class and structure class?

13. Sanjeev Says:


August 16th, 2007 at 9:14 am

AutoEventWireup attribute is used to set whether the events needs to be automatically generated or not.

In the case where AutoEventWireup attribute is set to false (by default), event handlers are automatically required for Page_Load
or Page_Init.

However, when we set the value of the AutoEventWireup attribute to true, the ASP.NET runtime does not require events to specify
event handlers like Page_Load or Page_Init.

14. Sahithi Says:


August 27th, 2007 at 1:46 pm

Panel vs GroupBox

Both panel control and Groupbox Control are the famous Container Controls.Panel and groupbox are almost same but they got
minute differences

1. Panel don’t allow you to enter text in it where as you can enter the text in the Group Box.(i.e U cannot set the caption in
the panel you can do it in the groupbox)

2.Panel has Horizontal and vertical Scroll Bar, Groupbox dont support this Horizontal and vertical Scroll Bars.

3.Group box control has a visible border around it where as panel does n’t have any visible border.

15. Sahithi Says:


August 29th, 2007 at 10:27 pm

How does ASP.NET framework map client side events to server side?

10.

More interview questions »

Posted in: .NET | Comments(15)

Microsoft college recruitment questions

Reader Vinay Solanki faced these questions from Microsoft recruiter, who apparently was hiring straight out of college.

1. How did you first get interested in Computer Science?


2. What do you like to do best related to computers now (programming, administration, testing, manage projects, etc)? What is it
about that area that you specifically enjoy?
3. What is your strongest programming language (Java, ASP, C, C++, VB, HTML,C#, etc.)?
4. When is the last time you coded in C/C++? What is the most lines of original C/C++ code you have personally written in one
project? How confident are you in your ability to write C or C++ without a reference?

More interview questions »

Posted in: C++, General, Windows | Comments(8)

Microsoft ASP.NET interview questions


These questions are asked by Microsoft at one of their international locations.

1. What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why.
2. What is serialization, how it works in .NET?
3. What should one do to make class serializable?
4. What exactly is being serialized when you perform serialization?

More interview questions »

Posted in: .NET, Web dev | Comments(68)

.NET interview questions at Wipro

A reader recently interviewed for C# position at Wipro and sent the following questions:

1. Difference between directcast and ctype.


2. An example of a ctype and directcast.
3. ctype(123.34,integer) - should it throw an error? Why or why not?
4. directcast(123.34,integer) - should it throw an error? Why or why not?
5. Difference between a sub and a function.

More interview questions »

Posted in: .NET | Comments(46)

Basic .NET and ASP.NET interview questions

Submitter said questions were asked in a US company hiring a Web developer.

1. Explain the .NET architecture.


2. How many languages .NET is supporting now? - When .NET was introduced it came with several languages. VB.NET, C#,
COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
3. 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.

1. Explain the .NET architecture.


2. How many languages .NET is supporting now? - When .NET was introduced it came with several languages. VB.NET, C#,
COBOL and Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
3. 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.
4. 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.
5. Resource Files: How to use the resource files, how to know which language to use?
6. 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.
7. 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
8. Explain the life cycle of an ASP .NET page.
9. 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.
10. 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.
11. 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.
12. 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.

Posted in: .NET, Web dev |

40 Responses to “Basic .NET and ASP.NET interview questions”


1. Avinash GJ Says:
March 31st, 2005 at 7:44 am

I want a detailed answer for the question.

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


2)Explain the .NET architecture.

2. Elango Kumar Says:


April 5th, 2005 at 11:38 pm

When a page request is sent to the Web server, whether through a submission or location change, the page is run through a
series of events during its creation and disposal. When we try to build ASP.NET pages and this execution cycle is not taken into
account, we can cause a lot of headaches for ourselves. However, when used and manipulated correctly, a page’s execution
cycle can be an effective and powerful tool. Many developers are realizing that understanding what happens and when it happens
is crucial to effectively writing ASP.NET pages or user controls. So let’s examine in detail the ten events of an ASP.NET page,
from creation to disposal. We will also see how to tap into these events to implant our own custom code.

I’ll set the stage with a simple submission form written in ASP.NET with C#. The page is loaded for the first time and has several
server-side Web controls on it. When the Web server receives a request for the page, it will process our Web controls and we will
eventually get rendered HTML. The first step in processing our page is object initialization.

Download source code


View demo

1. Object Initialization

A page’s controls (and the page itself) are first initialized in their raw form. By declaring your objects within the constructor of your
C# code-behind file (see Figure 1), the page knows what types of objects and how many to create. Once you have declared your
objects within your constructor, you may then access them from any sub class, method, event, or property. However, if any of
your objects are controls specified within your ASPX file, at this point the controls have no attributes or properties. It is dangerous
to access them through code, as there is no guarantee of what order the control instances will be created (if they are created at
all). The initialization event can be overridden using the OnInit method.

Figure 1 - Controls are initialized based on their declaration.

2. Load Viewstate Data

After the Init event, controls can be referenced using their IDs only (no DOM is established yet for relative references). At
LoadViewState event, the initialized controls receive their first properties: viewstate information that was persisted back to the
server on the last submission. The page viewstate is managed by ASP.NET and is used to persist information over a page
roundtrip to the server. Viewstate information is saved as a string of name/value pairs and contains information such as control
text or value. The viewstate is held in the value property of a hidden control that is passed from page request to page request. As
you can see, this is a giant leap forward from the old ASP 3.0 techniques of maintaining state. This event can be overridden using
the LoadViewState method and is commonly used to customize the data received by the control at the time it is populated. Figure
2 shows an example of overriding and setting viewstate at the LoadViewState event.

Figure 2 - When LoadViewState is fired, controls are populated with the appropriate viewstate data.

3. LoadPostData Processes Postback Data

During this phase of the page creation, form data that was posted to the server (termed postback data in ASP.NET) is processed
against each control that requires it. When a page submits a form, the framework will implement the IPostBackDataHandler
interface on each control that submitted data. The page then fires the LoadPostData event and parses through the page to find
each control that implements this interface and updates the control state with the correct postback data. ASP.NET updates the
correct control by matching the control’s unique ID with the name/value pair in the NameValueCollection. This is one reason that
ASP.NET requires unique IDs for each control on any given page. Extra steps are taken by the framework to ensure each ID is
unique in situations, such as several custom user controls existing on a single page. After the LoadPostData event triggers, the
RaisePostDataChanged event is free to execute (see below).

4. Object Load

Objects take true form during the Load event. All object are first arranged in the page DOM (called the Control Tree in ASP.NET)
and can be referenced easily through code or relative position (crawling the DOM). Objects are then free to retrieve the client-side
properties set in the HTML, such as width, value, or visibility. During Load, coded logic, such as arithmetic, setting control
properties programmatically, and using the StringBuilder to assemble a string for output, is also executed. This stage is where the
majority of work happens. The Load event can be overridden by calling OnLoad as shown in Figure 3.

Figure 3 - The OnLoad event is an ideal location to place logic.

5. Raise PostBack Change Events


As stated earlier, this occurs after all controls that implement the IPostBackDataHandler interface have been updated with the
correct postback data. During this operation, each control is flagged with a Boolean on whether its data was actually changed or
remains the same since the previous submit. ASP.NET then sweeps through the page looking for flags indicating that any object’s
data has been updated and fires RaisePostDataChanged. The RaisePostDataChanged event does not fire until all controls are
updated and after the Load event has occurred. This ensures data in another control is not manually altered during the
RaisePostDataChanged event before it is updated with postback data.

6. Process Client-Side PostBack Event

After the server-side events fire on data that was changed due to postback updates, the object which caused the postback is
handled at the RaisePostBackEvent event. The offending object is usually a control that posted the page back to the server due
to a state change (with autopostback enabled) or a form submit button that was clicked. There is often code that will execute in
this event, as this is an ideal location to handle event-driven logic. The RaisePostBackEvent event fires last in the series of
postback events due to the accuracy of the data that is rendered to the browser.

Controls that are changed during postback should not be updated after the executing function is called due to the consistency
factor. That is, data that is changed by an anticipated event should always be reflected in the resulting page. The
RaisePostBackEvent can be trapped by catching RaisePostBackEvent, as in Figure 4.

Figure 4 - The RaisePostDataChanged and RaisePostBackEvent events are defined by the IPostBackDataHandler interface.

7. Prerender the Objects

The point at which the objects are prerendered is the last time changes to the objects can be saved or persisted to viewstate. This
makes the PreRender step a good place to make final modifications, such as changing properties of controls or changing Control
Tree structure, without having to worry about ASP.NET making changes to objects based off of database calls or viewstate
updates. After the PreRender phase those changes to objects are locked in and can no longer be saved to the page viewstate.
The PreRender step can be overridden using OnPreRender

8. ViewState Saved

The viewstate is saved after all changes to the page objects have occurred. Object state data is persisted in the hidden object
and this is also where object state data is prepared to be rendered to HTML. At the SaveViewState event, values can be saved to
the ViewState object, but changes to page controls are not. You can override this step by using SaveViewState, as shown in
Figure 5.

Figure 5 - Values are set for controls in OnPreRender. During the SaveViewState event, values are set for the ViewState object.

9. Render To HTML

The Render event commences the building of the page by assembling the HTML for output to the browser. During the Render
event, the page calls on the objects to render themselves into HTML. The page then collects the HTML for delivery. When the
Render event is overridden, the developer can write custom HTML to the browser that nullifies all the HTML the page has created
thus far. The Render method takes an HtmlTextWriter object as a parameter and uses that to output HTML to be streamed to the
browser. Changes can still be made at this point, but they are reflected to the client only. The Render event can be overridden, as
shown in Figure 6 (below).

10. Disposal

After the page’s HTML is rendered, the objects are disposed of. During the Dispose event, you should destroy any objects or
references you have created in building the page. At this point, all processing has occurred and it is safe to dispose of any
remaining objects, including the Page object. You can override Dispose, as shown in Figure 6.

Figure 6 - The Render event will output custom HTML to the browser through the HtmlTextWriter object.

Conclusion

Each time we request an ASP.NET page, we run through the same process from initialization to disposal. By understanding the
inner workings of the ASP.NET page process, writing and debugging our code will be much easier and effective (not to mention
less frustrating).

Interview questions for Web application developers

The following set was set in by a reader of the site:

Following are the questions from an interview I attended for in C#, ASP.NET, XML and Sql Server. I will try to add some
more as soon as I recollect. Hope these questions will be useful for people attending interviews in this area.

1. What is the maximum length of a varchar field in SQL Server?


2. How do you define an integer in SQL Server?
3. How do you separate business logic while creating an ASP.NET application?
1. What is the maximum length of a varchar field in SQL Server?
2. How do you define an integer in SQL Server?
3. How do you separate business logic while creating an ASP.NET application?
4. If there is a calendar control to be included in each page of your application, and we do not intend to use the Microsoft-provided
calendar control, how do you develop it? Do you copy and paste the code into each and very page of your application?
5. How do you debug an ASP.NET application?
6. How do you deploy an ASP.NET application?
7. Name a few differences between .NET application and a Java application?
8. Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?
9. What are the XML files that are important in developing an ASP.NET application?
10. What is XSLT and what is its use?

Posted in: .NET, Java |

14 Responses to “Interview questions for Web application developers”

1. Observer Says:
March 17th, 2005 at 10:56 am

q1. 8000 (nvarchar = 4000)


q2. int
q3. use code behind (general answer)
q4. write your own user control and either register the control page level, or load it at runtime
q5. use vs.net to debug with breakpoints and localwatch; enable page tracing
q6. use web setup project, or use vs.net to copy project, or just xcopy the files over
q7. languages, .net platform specific
q8. session, cache, application level, database, external files, viewstate, querystring
q9. web.config is used to store info on the webapp
q10.xslt lets you transform an xml document into a presentable format

just a quick post

observer*

2. Stephan Samuel Says:


March 18th, 2005 at 10:41 am

1:
It depends on what version of SQL Server. In 2K, it’s 8k. If you’re using nvarchars, it’s half that.

2:
Use the int keyword. I’m not sure what the question is asking: if you want to know what an int is defined as, it’s a 32-bit signed
integer, from -(2^31 - 1) to (2^31 - 1). Adding the unsigned keyword buys you one more bit.

3:
Many ways. A few: 1) create tiers, but the business logic in a different tier; 2) put it in a different assembly; 3) put it in SPs. There
are more, but the specific one you use should depend on your application. Each has pros and cons.

4:
Create a web control. If you’re using VS.NET, you’re only a few steps away from drag-and-drop into any ASP.NET page.

5:
VS.NET makes it easy, if you have it; just run in debug mode and you can step through your code. Otherwise, you’re doing a lot
of Response.Write statements or logging to a disk, or something of that sort.

6:
Assuming: 1) you’ve compiled in release mode, 2) you’ve satisfied all your other procedural requirements (those depend on the
group you’re working in) and, 3) there’s existing web space that’s set up correctly, copy the aspx files, then the dll files from the
bin directory into a bin directory. Don’t forget any ancillary files like web.config or other configuration files you may have referred
to in code. It’s really more complicated than that most of the time, but those are the general steps.

8:
It’s always best to assume that your target environment will one day be clustered. If it’s set up right, you should be able to use
application variables. It may not be, so it’s often wise to store them externally and write access wrappers. “Externally” could mean
in a DB or static files. If your application is big and hardcore, setting up a web service on a “cluster controller” to feed the cluster
machines isn’t a terrible idea, either.

9:
Web.config is the most important. Specific configuration determines which others might be important.

10:
XSLT transforms XML into XML. If you have an XML data file and you need to change the variable names (e.g. — if some part of
your data tier gives you XML, but in the wrong format), XSLT will give you the right XML listing. It can also be used to transform
XML data into XHTML for display to the user. Some browsers will do the XML-XHTML conversion automatically, but that’s a
dangerous assumption if you’re in a heterogenous environment.

I’m not going to answer #7. There are lots of differences from the ground up. For one, you can’t compare Java to .NET. You can
compare J2EE to .NET, or Java to C#. I don’t compare the languages; I just write in both. J2EE is a more defined environment,
but Microsoft covers a lot of the gaps with application software. There are entire books about this, and most of them get into the
religious questions.

3. Baki Says:
April 17th, 2005 at 4:11 am

Ans - Q.5: 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 Visual Basic .NET).

Using Visual Studio .NET1. 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.
7. Right-click the project and click Build to compile the project and generate symbols (.pdb files).

4. spandana kiran Says:


May 19th, 2005 at 5:27 am

1Q A. varchar maximum length=8000 (nvarchar=4000)

2Q A. We can declare an integer as int in SQL Server

5. vinodkumar Says:
July 1st, 2005 at 9:57 am

we can declare integer in sql

Declare a as int

6. Sameer Says:
July 22nd, 2005 at 5:07 am

Marvelous job.I m really impressed.I m quite sure that u update these Q/A’s time to time as techies like me depend upon these &
not only this, I cleared 5 interviews in various companies but they dont fix me up becoz i m fresher and they want experience.But i
will fight if your feed me with this type of help.

7. vipin Says:
July 25th, 2005 at 5:36 am

what is 5 th highest salary from employee table

8. Karthik Says:
September 22nd, 2005 at 12:44 am

what is 5th highest salary from employee table?

ops$tkyte@8i> select empno, sal from emp;

EMPNO SAL
———- ———-
7369 800
7499 1600
7521 1250
7566 2975
7654 1250
7698 2850
7782 2450
7788 3000
7839 5000
7844 1500
7876 1100
7900 950
7902 3000
7934 1300

14 rows selected.

ops$tkyte@8i>
ops$tkyte@8i> select empno, sal
2 from emp
3 where sal = ( select min(sal)
4 from ( select sal from emp order by sal desc )
5 where rownum

9. Karthik Says:
September 22nd, 2005 at 12:48 am

oops, the last part of prev question again

ops$tkyte@8i>
ops$tkyte@8i> select empno, sal
2 from emp
3 where sal = ( select min(sal)
4 from ( select sal from emp order by sal desc )
5 where rownum

10. Karthik Says:


September 22nd, 2005 at 12:57 am

I’m getting a problem while posting the solution for the following question, so please access the url directly for the solution

what is 5th highest salary from employee table?

http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:149212348066

11. Preethi Says:


October 30th, 2005 at 12:07 am

You can use rank function to find highest position/salary. like rank() over order by salary. The best approach as far as i see . i
learnt this in my DB class at the U
Preethi
MSU,Mankato.

12. Ayman Dabees Says:


December 31st, 2005 at 4:57 pm

what is 5th highest salary from employee table?

select min(salary)
from (
select top 5 salary
from employees
order by sal Desc
)

so simple!!! why make life complecated!!?


cheers

N.B using Transact-SQL

13. satheesh Says:


February 22nd, 2006 at 11:39 pm

General syntax for finding Nth maximum Salary…

Select * From Employee E1 Where


(N-1) = (Select Count(Distinct(E2.Salary)) From Employee E2 Where
E2.Salary > E1.Salary)
Here in this SQL N is the Nth position.

For example if we need to fing 5th Maximum salary,The SQL will be,

select * from Employee E1 where


5-1=(select count(distinct(E2.Salary)) from Employee E2 where E2.salary>E1.Salary) ;

Just try this SQL……

14. majid Says:


April 7th, 2007 at 3:40 am

I think this would be the complete solution,

Select top 1 from ( Select top 5 from employee group by salary order by salary)

As if we have 10 employees of the same highest salary even then this query will exactly return the fifth highest salary, another
thing here 5 could be replaced by n to find any nth highest salary. Here top 1 or top 5 is postfixex with salary

Cheers

More interview questions »

Posted in: .NET, Java | Comments(14) .

Interview questions for C# developers

Useful for preparation, but too specific to be used in the interview.

1. Is it possible to inline assembly or IL in C# code? - No.


2. Is it possible to have different access modifiers on the get/set methods of a property? - No. The access modifier on a
property applies to both its get and set accessors. What you need to do if you want them to be different is make the property
read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.

More interview questions »

Interview questions for C# developers

Useful for preparation, but too specific to be used in the interview.

1. Is it possible to inline assembly or IL in C# code? - No.


2. Is it possible to have different access modifiers on the get/set methods of a property? - No. The access modifier on a
property applies to both its get and set accessors. What you need to do if you want them to be different is make the property
read-only (by only providing a get accessor) and create a private/internal set method that is separate from the property.
3. Is it possible to have a static indexer in C#? - No. Static indexers are not allowed in C#.
4. If I return out of a try/finally in C#, does the code in the finally-clause run? - Yes. The code in the finally always runs. If you
return out of the try block, or even if you do a “goto” out of the try, the finally block always runs:
5. using System;
6.
7. class main
8. {
9. public static void Main()
10. {
11. try
12. {
13. Console.WriteLine("In Try block");
14. return;
15. }
16. finally
17. {
18. Console.WriteLine("In Finally block");
19. }
20. }
}

Both “In Try block” and “In Finally block” will be displayed. Whether the return is in the try block or after the try-finally block,
performance is not affected either way. The compiler treats it as if the return were outside the try block anyway. If it’s a return
without an expression (as it is above), the IL emitted is identical whether the return is inside or outside of the try. If the return has
an expression, there’s an extra store/load of the value of the expression (since it has to be computed within the try block).

21. I was trying to use an “out int” parameter in one of my functions. How should I declare the variable that I am passing to
it? - You should declare the variable as an int, but when you pass it in you must specify it as ‘out’, like the following: int i; foo(out
i); where foo is declared as follows: [return-type] foo(out int o) { }
22. How does one compare strings in C#? - In the past, you had to call .ToString() on the strings when using the == or != operators
to compare the strings’ values. That will still work, but the C# compiler now automatically compares the values instead of the
references when the == or != operators are used on string types. If you actually do want to compare references, it can be done as
follows: if ((object) str1 == (object) str2) { … } Here’s an example showing how string compares work:
23. using System;
24. public class StringTest
25. {
26. public static void Main(string[] args)
27. {
28. Object nullObj = null; Object realObj = new StringTest();
29. int i = 10;
30. Console.WriteLine("Null Object is [" + nullObj + "]\n"
31. + "Real Object is [" + realObj + "]\n"
32. + "i is [" + i + "]\n");
33. // Show string equality operators
34. string str1 = "foo";
35. string str2 = "bar";
36. string str3 = "bar";
37. Console.WriteLine("{0} == {1} ? {2}", str1, str2, str1 == str2 );
38. Console.WriteLine("{0} == {1} ? {2}", str2, str3, str2 == str3 );
39. }
40. }

Output:

Null Object is []
Real Object is [StringTest]
i is [10]
foo == bar ? False
bar == bar ? True

41. How do you specify a custom attribute for the entire assembly (rather than for a class)? - Global attributes must appear
after any top-level using clauses and before the first type or namespace declarations. An example of this is as follows:
42. using System;
43. [assembly : MyAttributeClass] class X {}

Note that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs.

44. How do you mark a method obsolete? -

[Obsolete] public int Foo() {...}

or

[Obsolete("This is a message describing why this method is obsolete")] public int Foo() {...}

Note: The O in Obsolete is always capitalized.

45. How do you implement thread synchronization (Object.Wait, Notify,and CriticalSection) in C#? - You want the lock
statement, which is the same as Monitor Enter/Exit:
46. lock(obj) { // code }

translates to

try {
CriticalSection.Enter(obj);
// code
}
finally
{
CriticalSection.Exit(obj);
}

47. How do you directly call a native function exported from a DLL? - Here’s a quick example of the DllImport attribute in action:
48. using System.Runtime.InteropServices; \
49. class C
50. {
51. [DllImport("user32.dll")]
52. public static extern int MessageBoxA(int h, string m, string c, int type);
53. public static int Main()
54. {
55. return MessageBoxA(0, "Hello World!", "Caption", 0);
56. }
57. }

This example shows the minimum requirements for declaring a C# method that is implemented in a native DLL. The method
C.MessageBoxA() is declared with the static and external modifiers, and has the DllImport attribute, which tells the compiler that
the implementation comes from the user32.dll, using the default name of MessageBoxA. For more information, look at the
Platform Invoke tutorial in the documentation.

58. How do I simulate optional parameters to COM calls? - You must use the Missing class and pass Missing.Value (in
System.Reflection) for any values that have optional parameters.
59. ……………

.NET Remoting Interview Questions

To Do: Comfirm these are correct answers. Many of these question I have obtained from other
sources and have found they are not entirely correct, or simply wrong.

1. What’s a Windows process?


It’s an application that’s running and had been allocated memory.

2. What’s typical about a Windows process in regards to memory allocation?


Each process is allocated its own block of available RAM space, no process can access
another process’ code or data. If the process crashes, it dies alone without taking the entire OS
or a bunch of other applications down.

3. Explain what relationship is between a Process, Application Domain, and Application?


A process is an instance of a running application. An application is an executable on the hard
drive or network. There can be numerous processes launched of the same application (5
copies of Word running), but 1 process can run just 1 application.

4. What are possible implementations of distributed applications in .NET?


.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library,
noteworthy classes are in System.Runtime.Remoting and System.Web.Services.

5. What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?
Remoting is a more efficient communication exchange when you can control both ends of the
application involved in the communication process. Web Services provide an open-protocol-
based exchange of informaion. Web Services are best when you need to communicate with an
external organization or another (non-.NET) technology.

6. What’s a proxy of the server object in .NET Remoting?


It’s a fake copy of the server object that resides on the client side and behaves as if it was the
server. It handles the communication between real server object and the client object. This
process is also known as marshaling.

7. What are remotable objects in .NET Remoting?


Remotable objects are the objects that can be marshaled across the application domains. You
can marshal by value, where a deep copy of the object is created and then passed to the
receiver. You can also marshal by reference, where just a reference to an existing object is
passed.

8. What are channels in .NET Remoting?


Channels represent the objects that transfer the other serialized objects from one application
domain to another and from one computer to another, as well as one process to another on the
same box. A channel must exist before an object can be transferred.

9. What security measures exist for .NET Remoting in System.Runtime.Remoting?


None. Security should be taken care of at the application level. Cryptography and other security
techniques can be applied at application or server level.

10. What is a formatter?


A formatter is an object that is responsible for encoding and serializing data into messages on
one end, and deserializing and decoding messages into data on the other end.
11. Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters,
what are the trade-offs?
Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.

12. What’s SingleCall activation mode used for?


If the server object is instantiated for responding to just one single request, the request should
be made in SingleCall mode.

13. What’s Singleton activation mode?


A single object is instantiated regardless of the number of clients accessing it. Lifetime of this
object is determined by lifetime lease.

14. How do you define the lease of the object?


By implementing ILease interface when writing the class code.

15. Can you configure a .NET Remoting object via XML file?
Yes, via machine.config and application level .config file (or web.config in ASP.NET).
Application-level XML settings take precedence over machine.config.

16. How can you automatically generate interface for the remotable object in .NET with
Microsoft tools?
Use the Soapsuds tool.

Basic .NET and ASP.NET interview questions

Submitter said questions were asked in a US company hiring a Web developer.

1. Explain the .NET architecture.


2. How many languages .NET is supporting now? - When .NET was introduced it came with several languages. VB.NET, C#, COBOL and
Perl, etc. The site DotNetLanguages.Net says 44 languages are supported.
3. 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.
4. 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.
5. Resource Files: How to use the resource files, how to know which language to use?
6. 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.
7. 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
8. Explain the life cycle of an ASP .NET page.
9. 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.
10. 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.
11. 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.
12. 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.

…………….
1. What is the .NET Framework?

.NET is a general-purpose software development platform, similar to Java. At its core is a virtual machine that turns intermediate language
(IL) into machine code. High-level language compilers for C#, VB.NET and C++ are provided to turn source code into IL. An extensive class
library is included, featuring all the functionality one might expect from a contempory development platform - windows GUI development
(Windows Forms), database access (ADO.NET), web development (ASP.NET), web services, XML etc.
2. Explain why tracing helps with exception handling.
Tracing allows you to record unusual events while your application is running, without users being aware of it. If an unanticipated exception
occurs, your application can write a message to the trace log, which helps you diagnose problems during testing and after deployment.

3. What is the common language runtime (CLR)?


The common language runtime manages memory, thread execution, code execution, code safety verification, compilation, and other system
services. These features are intrinsic to the managed code that runs on the common language runtime.
The runtime also accelerates developer productivity.
The runtime is designed to enhance performance.
The runtime can be hosted by high-performance, server-side applications, such as Microsoft® SQL Server™ and Internet Information
Services (IIS).
4. What is the Microsoft Intermediate Language (MSIL)?

5. 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.
6. What are private assemblies and shared assemblies?

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.
7. How can I produce an assembly?

The simplest way to produce an assembly is directly from a .NET compiler. 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.
8. What is managed code and managed data?
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.
Managed data: This is data that is allocated and freed by the .NET runtime's garbage collector.
Managed code is code that is written to target the services of the common language runtime. In order to target these services, the
code must provide a minimum level of information (metadata) to the runtime. All C#, Visual Basic .NET, and JScript .NET code is
managed by default. Visual Studio .NET C++ code is not managed by default, but the compiler can produce managed code by
specifying a command-line switch (/CLR).
Closely related to managed code is managed data—data that is allocated and de-allocated by the common language runtime's
garbage collector. C#, Visual Basic, and JScript .NET data is managed by default. C# data can, however, be marked as unmanaged
through the use of special keywords. Visual Studio .NET C++ data is unmanaged by default (even when using the /CLR switch),
but when using Managed Extensions for C++, a class can be marked as managed by using the __gc keyword. As the name
suggests, this means that the memory for instances of the class is managed by the garbage collector. In addition, the class
becomes a full participating member of the .NET Framework community, with the benefits and restrictions that brings. An
example of a benefit is proper interoperability with classes written in other languages (for example, a managed C++ class can
inherit from a Visual Basic class). An example of a restriction is that a managed class can only inherit from one base class.
9. 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.

10. What is garbage collection?


Garbage collection is a mechanism that allows the computer to detect when an object can no longer be accessed. It then
automatically releases the memory used by that object (as well as calling a clean-up routine, called a "finalizer," which is written
by the user). Some garbage collectors like the one used by .NET, compact memory and therefore decrease your program's
working set.

11. What operating systems does the .NET Framework run on?

The runtime supports Windows Server 2003, 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 XP and
Windows 2000/2003. 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
12. What is Namespace?
It gives you a way to organize your classes, so that related classes are bound together in a namespace.
It helps in large applications where different classes may be provided by different people, different teams, or even different
organizations. Avoiding name clashes in large applications can be quite a headache, and in the past, developers have resorted to
arcane naming conventions to ensure uniqueness for their class names.

13. Explain why exception handling is important to a completed application.


When an unhandled exception occurs in an application, the application stops—the user can't proceed, and any work he or she did
immediately prior to the exception is lost. Exception handling provides a way to intercept and correct unusual occurrences that
would otherwise cause these problems.
14. Describe the purpose of error pages and why they are needed.

Because Web applications run over the Internet, some exceptions occur outside the scope of the application. This means that
your application can't respond directly to these exceptions. These types of exceptions are identified by HTTP response codes,
which IIS can respond to by displaying custom error pages listed in your application's Web.config file.

15. Explain why tracing helps with exception handling.


Tracing allows you to record unusual events while your application is running, without users being aware of it. If an unanticipated
exception occurs, your application can write a message to the trace log, which helps you diagnose problems during testing and
after deployment.

16. What is a Repeater control?


Repeater control is a data-bound list control that allows custom layout by repeating a specified template for each item displayed
in the list. It does not have built-in layout or styles, developers are required to explicitly declare HTML layout, formatting and style
tags within the control's templates.

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 during development. The IL is then converted to machine code at the point where the
software is installed, or (more commonly) at run-time by a Just-In-Time (JIT) compiler. MSIL allows for true cross-language integration.
ASP.NET Web Matrix web server does run on XP Home. The .NET Compact Framework is a version of the .NET Framework for mobile
devices, running Windows CE or Windows Mobile.

You might also like