You are on page 1of 8

Microsoft interview question 1

Microsoft at one of their international locations asks these questions.

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?
5. Tell me about 6h4 methods you have used to perform serialization.
6. Did you work with XML and XSL Transformations?
7. What methods and what for did you use to work with XML?
8. What is the purpose of reserved word “using” in C#?
9. How does output caching work in ASP.NET?
10. What is connection pooling and how do you make your application use it?
11. What are different methods of session maintenance in ASP.NET?
12. What is Viewstate?
13. Can any object be stored in a Viewstate?
14. What should you do to store an object in a Viewstate?
15. Explain how Viewstate is being formed and how it’s stored on client.
16. Explain control life cycle, mind event order.
17. What do you know about ADO.NET’s objects and methods?
18. Explain DataSet.AcceptChanges and DataAdapter.Update methods.
19. Assume you want to update a record in the database using ADO.NET. What
necessary steps you should perform to accomplish this?
20. How to retreive the value of last identity has been updated in a database (SQL
Server)?

Answers :

1. Answers:

1)In a interface class, all methods are abstract without implementation where as in
an abstract class some methods we can define concrete. In interface, no
accessibility modifiers are allowed. An abstract class may have accessibility
modifiers. Interface and abstract class are basically a set of rules which u have to
follow in case u r using them(inheriting them).

2. 1)what is the use of Web.configure in ASP.net,Give one example
2)please tell me how to code fo updating & downloading the file,Give one
example code

1
Microsoft interview question 2

3. This link might help to solve 2nd and 3rd question
9) How does output caching work in ASP.NET?
Output caching is a powerful technique that increases request/response throughput
by caching the content generated from dynamic pages. Output caching is enabled
by default, but output from any given response is not cached unless explicit action
is taken to make the response cacheable.

To make a response eligible for output caching, it must have a valid
expiration/validation policy and public cache visibility. This can be done using
either the low-level OutputCache API or the high-level @ OutputCache directive.
When output caching is enabled, an output cache entry is created on the first GET
request to the page. Subsequent GET or HEAD requests are served from the
output cache entry until the cached request expires.

The output cache also supports variations of cached GET or POST name/value
pairs.

The output cache respects the expiration and validation policies for pages. If a
page is in the output cache and has been marked with an expiration policy that
indicates that the page expires 60 minutes from the time it is cached, the page is
removed from the output cache after 60 minutes. If another request is received
after that time, the page code is executed and the page can be cached again. This
type of expiration policy is called absolute expiration - a page is valid until a
certain time.

4. Question 1:
What is an interface and what is an abstract class? Please, expand by examples of
using both. Explain why.

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

5. Hi,
I want to know that how can we conver a report file into a Acrobat(PDF file), or
Word file for transport purpose over the internet.

2
Microsoft interview question 3

6. What is connection pooling and how do you make your application use it?
Opening database connection is a time consuming operation.
Connection pooling increases the performance of the applications by reusing the
active database connections instead of create new connection for every request.
Connection pooling Behaviour is controlled by the connection string parameters.
Follwing the the 4 parameters that control most of the connection pooling
behaviour.
1. Connect Timeout
2. Max Pool Size
3. Min Pool Size
4. Pooling
Please go through the following link as well
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q169470

7. what is the difference between the comple time and runteime

8. Abstract vs Interface.
All abstract methods are virtual by default. They have to be overriden.
Interface methods are not virtual by default. When you are implementing an
interface method you can decide whether you want it to be virtual or not.

9. What is serialization, how it works in .NET?

Serialization is when you persist the state of an object to a storage medium so an
exact copy can be re-created at a later stage.

Serialization is used to save session state in ASP.NET.
Serialization is to copy objects to the Clipboard in Windows Forms
Serialization is used by remoting to pass objects by value from one application
domain to another

What should one do to make class serializable?

To make a class serializable is to mark it with the Serializable attribute as follows.

[Serializable]
public class MyObject {
public int n1 = 0;
public int n2 = 0;

3
Microsoft interview question 4

public String str = null;
}

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

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

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

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

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

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

What do you know about ADO.NET’s objects and methods?

ADO.NET provides consistent access to data sources such as Microsoft SQL
Server, as well as data sources exposed through OLE DB and XML.

Data-sharing consumer applications can use ADO.NET to connect to these
different data sources and retrieve, manipulate, and update data.

ADO.NET provides first-class support for the disconnected, n-tier programming
environment for which many new applications are written.

Explain DataSet.AcceptChanges and DataAdapter.Update methods.

DataAdapter.Update method Calls the respective INSERT, UPDATE, or DELETE
statements for each inserted, updated, or deleted row in the DataSet.

4
Microsoft interview question 5

DataSet.AcceptChanges method Commits all the changes made to this row since
the last time AcceptChanges was called.

Tech Interviews comment by Akantos

10. WILL U PLS TELL ME ALL OBJECTS IN ASP.NET

URGENT

Tech Interviews comment by Gyan

11. Question 1: in C# you can’t multiple inheritence so you have to use interfaces to
accomplish it.

12. Can anyone tell me that which language to use(VB.NET OR C# ) when all
languages are equal in .NET world?

13. Hi Harshad,

Regarding your question about which language to use. According to me you can
go ahead with any language, both C# and vb.net are same in functionality
( though they have differences also but which are not so important and what i
think we need not be worried about it). Following are few differences between c#
and vb.net (as mentioned in MSDN):
Case sensitivity
Variable declaration and assignment
Data types
Statement termination
Statement blocks
Use of () vs. []
Operators
Conditional statements
Error handling
Overflow checking
Parameter passing
Late binding
Handling unmanaged code
Keywords

What i feel is it all depends on the project’s requirement which to use. In one
company i was using only C# and in another only vb.net. One more thing many of

5
Microsoft interview question 6

our friends will have different opinion about it, so lets wait for their replies.This is
what i can tell you.

Regards
Manish

Tech Interviews comment by manish

14. Hi gyan,

Every thing in .Net is an object. If you can be more exact i think more people can
help you.

15. One more question which troubles me a lot that reflection is used by the
framework transparently but when do we have to use it?

16. I am using a Mozilla Fire fox browser. I found few things listed are not working.
Can anyone give me a solution?

1. When the asp:panel is used in the aspx Page firefox browser doesn’t support
instead the layout is getting distorted. Can any one suggest a solution?
2. When the onMouseout of javascript do not work.
3. Many properties of the IE browser seems not working in Mozilla.

Tech Interviews comment by Chandini

17. i never used smart navigation in my pages .I just gone through the comments
before using that, now i am not enough dare to use that in my application pages.

Tech Interviews comment by ManojNair

18. Q. If base class is abstract class and derived class inherits the base class and
derives class has it own function which is not abstract so how we use the derived
class functions. Actually does not instantiated

Tech Interviews comment by rajesh

19. ViewState is the mechanism by which page information is maintained between
the post backs.

Object can be stored in viewstate as long as the object is serializable. you can
store string, arraylist etc in Viewstate.

6
Microsoft interview question 7

20. Viewstate is stored in the hidden field __VIEWSTATE.

we can disable the viewstate in application, page, control levels.

21. @@IDENTITY is used to retrieve the the last-inserted identity value in Sql
Server.

22. Downloading and uploading

For downloading a file, use a hyperlink and specify the URL of the file as the
link.
For uploading a file, use the File Field control, from the HTML controls, to select
the file. Change it to run at server and use the upload or save(or something
similar) method associated with it.

Tech Interviews comment by Thomas

23. How to pass datatable as a parameter to a stored procedure in oracle.Kindly let me
know and is an urgent requirement

24. What is the purpose of reserved word “using” in C#?

A keyword that specifies that types in a particular namespace can be referred to
without requiring their full qualified type names.

25. What is Passport security? and how it works?
26.

.What is the use of reflections class in .NET?
2.Root class in .NET?

27. How to handle date problem if application server and database server has diffirent
date format?
DateTime FromDate=new DateTime(2000,1,1);
DateTime ToDate=DateTime.Now;
_whereClause=”";

string
_frmdate=FromDate.Year.ToString()+FromDate.Month.ToString()+FromDate.Da
y.ToString();

7
Microsoft interview question 8

string
_todate=ToDate.Year.ToString()+ToDate.Month.ToString()+(ToDate.Day+1).ToSt
ring();

_whereClause=_whereClause + ” and ” + “createDate between cast(’” + _frmdate
+ “‘ as DateTime) and cast(’” + _todate + “‘ as DateTime)”;

8