Interview Question

WebApp | StateManagement | WebService |SQL | ASP.NET| IIS Authentication|Cookies

Web Application

1. Describe the role of inetinfo.exe, aspnet_isapi.dll and aspnet_wp.exe in the page loading process.

* Inetinfo.exe is the Microsoft IIS Server running, handling ASP.NET requests among other things. When

an ASP.NET is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes

care of it by passing the request to the working process aspnet_wp.exe.

2. What's the difference between Response.Write() and Response.Output.Write()?

Response.Output.Write() allows you to write formmated output

3. What methods are fired duing the page laod?

Init() - when the page is instantiated

Load() -When the page is loaded into server memory

PreRender() - the brief moment before the page is displayed to the user as HMTL

Unload() - When the page finish loading.

4. When during the page processing cycle is ViewState available?

After the Init() and before the Page_Load(), or Onload() for a control.

5. What namespace does the webpage belong in the .NET framework class hierarchy?

System.Web.UI.Page.

6 Where do you store the Information about the user's locale?

System.Web.UI.Page.Culture

7. What's the difference between codebehind ="MyCode.aspx.cs" and src="MyCode.aspx.cs"

CodeBehind is relevant to Visual Studio.NET only

8.What is the bubbled events?

When you have a complex control , like datagrid, writting an event processing routine for each object(cell, button , row, etc)

is quite tedious. The controls can bubble up their eventhandlers, allowing the main datagrid event handler to take care of its

consituents.

9. Supopse you want a certain ASP.NET function executed on MouseOVer for a certain button. Where do you add an event handler?

Add an OnMouseOver attribute to the button. Example:

btnSubmit.Attributes.Add("OnMouseOver", " someClientcodeHere();");

10 What datatypes do the RangeValidator controls supports?

Integer , string and date

11. Exaplain the difference between Server-side and client-Side Code?

Server-side code executes on the Server. Client-side code executes in the clients's browser

12. What type of code is found in a code behind Class?

The answer is server side code since code-behind is executed on the server. However,

during the code-behind execution on the server, it can render client side code such as javascript

to be processed in the client browser. But just to be clear, code-behind executes on the server, thus making it server side code.

13. Should user input data validation occur server side or client side? why?

All user input data validation should occur on the server at a minumum. Additionally,

client side validation can be performed where deemed approprite and feasable to provide a rich, more

responsive experience for the user.

14. Difference between Server.Transfer() and Response.Redirect() why should choose one over other?

Server.Transfer() tranfers the page processing from one page directly to next apge without makinga round trip back to client's browser. This provides faster response with a little less overhead on the

server. Server.Transfer does not update the client URL historylist .

Response.Redirect() is used to redirect the user's browser to another page. This performs a trip back to client where client's browser is redirected to new page. The user's browser history is updated to reflect the new address

15.what is the global.asax used for ?

This file is used to implement application and session level events.

16. What are the application_Start and Session_Start subroutines used for?

This is where you can set the specific variables for the application and session object.

17. Can you explain what inheritance is and an example of where you might use it?

When you want to inherit another class. Vehicle as base class, car inherits vehicles

18. What's assembly

building block of .NET framework. MSIL

19. how many classes can a single .NET Dll contains ?

many classes

20. What base class do all web forms inherits from ?

system.web.UI.Page

21. Boxing vs Unboxing
Boxing (implicit): The mechanism of converting value type to reference type

int i = 101;
object obj = (object)i; // Boxing

unboxing (explicit) : Convert reference type to value type

obj = 101;
i = (int)obj; // Unboxing

22.Early Binding vs Late Binding


Early Binding
Properties and method can be identified by compile time.

Eg . dim myval as object

Late Binding
Properties and method can be identified by Run time.

Eg

At compile time
Dim myval as new classname ( known type at design time)

At Compile time
dim myval as classname
At run time
Myval=new classname

23. Data type conversion (cast)
- Converting a variable of one datatype to another datatype.

A) Explicit Conversion.
*require a cast operator.
*The source and destination of variable are compatible.
eg. double d=999.11
int i=(int)d;
Car c2= (Car) V;

B) Implicit Conversion. (automatic, small -> large)
*No special syntax required, type safe, no data loss.
* integer -> double , derived object-> based object.
eg Car c1=new Car();
Vehicle V =c1;

24. AutoEventWire ?

AutoEventWire=True (C# by default)

Page_load event fires up only AutoEventWire=True ,
If AutoEventWire = False, it never fires up
Naming is restricted to Page_Load NOT Page_Loading.


AutoEventWire=false (VB by default)

page_load() handles me.load is NOT affected by attribute AutoEventWire regardless true or false.
It will fire up with Handles keyword on Me.Load
It can be renamed such as page_loading if Handles Me.Load always appended

25. Debug vs Release build

Debug build : project.PDB file containing debug informaiton is created while compiling.
Release build: no .pdb file is created and we can't debug the code.
It run faster, used in final release.

26. Serialization? (used for transmiting data typically over the network)

Serialization is a process of converting an object into stream of bytes (XML , Binary).
.NET has 2 serializer ( xmlserializer, binaryserializer ). It often used in .NET remoting

27. .NET framework Component?
- CLR (execution engine converts mmsil to machine code) : help application execution, memory allocation and release.
- Base Class Library: a hhugh collection of class for development logic usage


28. Garbage collection .NET?

- GC is a memory release on object runningg at background.
- System.GC.Collect()> force GC to run.

29. Debug vs Trace ( both are class under System.Diagnostics)
- both shares static methods: WriteLine , Assert , Flush and Indent.
- both are used to monitor the execution oof application.
- In a Debug Solution Configuration projecct, The output of Trace and Debug are active.
- However, a Release Solution Configuratioon (release mode) project only generates output from a Trace class.
The Release Solution Configuration project ignores any Debug class method invocations.
*If the solution configuration type is Release, the Debug class output is ignored.

30.How to get authentication mode from web.config programmatically? ( System.web.Configuration)
- AuthenticaionSection section=(AuthenticationSection) WebConfigurationManager.GetSection("system.web/authentication");
section.Mode.ToString()

31Dispose vs Finalize (clean unmanaged resources)
- Dispose() is the method to release resource of object beyond scope explicitly in code. (conn.Dispose())
- Finalize() is called by GC implicitly to clean up memory of object

Back


Web Service

1. What's the transport protocol you use to call a web service?

SOAP (simple object access protocol) is the prefered protocol.

2. Web Service only written in .NET?

False

3. What's WSDL stand for ?

Web Service Descriptive language

4. Where on the Internet would you look for web service?

www.uddi.org

5. To test web service, you must create winapp or webapp to consume web service?

false, web service comes with test page with http get method to test.

http://www.localhost/service.asmx?wsdl

Back

State Management

1. What's ViewState?

ViewState allows the state of object(serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. viewState is used to retain the state of server-side objects between postbacks.

2. What's the lifespan for items stored in ViewState?

Item stored in ViewState exist for the life of the current page. This includes multiple postbacks (on same page)

3. What does the "EnableViewState" property do? Why would i want it on or off?

It allow the page to save the users input on a form across postback. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the pagebefore sending the page to the clients browser. When the page is posted back to the server , the server control is recreated with the state in viewstate.

4. What's difference type of session stat management option available with ASP.NET ?

ASP.NET provides In-process and out of process state management. In process stores the session in memory on the web server. This requires the a sticky-server . so that the user is always reconnected to the same web server.

Out of process Session State Management Stores data in an external data source. The external data sourcemay be either a SQL Server or a State Server Service. Out of process state management requires that all objects stored in session are serializable

5. What's diff between unit testing, integration testing and regression testing?

Unit testing - ensure piece of code work correctly.
Integration - ensure each module work correctly.
Regression - ensure new code didn't break previous working code.

6. Web Farm (>1 web server)
- allows you to expand web application witth same content/configuration
across multiple server at different location in the world.
eg. www.yahoo.in, www.yahoo.uk

<sessionState
mode InProc [Off | InProc | StateServer | SQLServer | Custom]
>

-router decides which web server handle the request.
-allow the web app to run if a server is down cos request can always be served by active server.

7. Web Garden (multiple processors in a server)
- allows you to expand web application across multple CPU within single server.
eg. www.mail.yahoo.com www.chat.yahoo.com

8. What's Secure Socket Layer(SSL) Security?
-SSL protects data exchanged between cliennt and web app by encrypting before sending across internet.

Back

SQL

 

SQL Sever 05 vs 00
1. SSIS replace DTS as ETL tool

2. Common language runtime, allow SQL Server taking advantage of .NET functionalities. ( create database object using .NET code)

3. Service broker – Handle messaging between sender and receiver.

4. DDL Trigger - The trigger same as DML trigger except they tied to database or server instead of table, view.

5. For XML Path – Create XML from relational data.

6. Rank functionalities – RANK , DENSE_RANK , ROW_NUMBER

7. Top – extra Top n records

8. PIVOT-/UNPIVOT- Convert row of data into column

9. OUTPUT – Immediately return data after Update/Insert

 

Automatic Variables

1. @@ERROR
Return 0 if last TSQL Statement is executed sucessfully, otherwise 1

2. @@ROWCOUNT
Return the number of row affected in last TSQL Statement

3. @@TRANCOUNT
Return the number of active transaction in current connection

Transaction

1. Begin Transaction
Mark a starting point of transaction , increment @@TRANCOUNT by 1

2. Commit Transaction
Making all modification be permanent and a part of databse since last transaction. Free all resource held by this transaction.
Commit transaction will decrement @@TRANCOUNT by 1 and Start next transaction

3. RollBack Transaction
Rollback Transaction to begining , Reset @@TRANCOUNT to 0

4. Save Transaction
if Rollback to Save point, @@TRANCOUNT will NOT be affected

Option Strict vs Option Explicit

Option Strict ON (Default=OFF)
- Avoid data type conversion which will cause data loss especially one datatype converted to a datatype with less precision.
- Compile time error notification will be ensured.

Option Explicit

-Ensure explicitly declare the datatype for variable before it can be used.

Back

ASP.NET (interview Q)

Software Development Life Cycle
1. Requirement gathering
2. System Analysis
3. Develop/Build
4. Testing
5. Deployment /Installation
6. Documentation


ASP.NET 2.0 Vs 1.1
1. Master Page
2. Built- in web server. (needless virtual directory)
3. Theme & Skin
4. Validator control at server side
5. Reusable User control .ascx
6. Code Behind introduces partial class.
7. Precompilation

AUTHENTICATION IIS

Authentication method applied : Default website| virtual directory | Sub-Folders | Files |

3 Authentication levels
-----------------------
A. Window Auth (def)
- Anonymous Access (A) (enabled) : everyone with IUSR_Machinename, IIS controls password.
- Basic : User provides u/p, to be sent over network.
- Digest: same as above, just u/p encrypted.
- Integrated Window Authentication (W) (enabled): if A unchecked, u/p are required.

Internet { A , W } : If he is anonymous user, no authentication needed.
If he is domain user, window authenticaion performed in AD (domain)

Internet { A } : Allow everyone to access. ( A is checked , W is unchecked)


Intranet { W } : Allow domain user within AD group without typing username/password.


B. Form Auth
- This authentication relies on the code written by a develoepr, where username/password
are matched against database or Ad. Credential are entered at web form, and are matched with
database table that contains info.

C. Passport
-Provided by Microsoft.

 

COOKIES
1. Create Cookie.
HttpCookie CookieObject = new HttpCookie("UserPreference");

2. Use the Values property to assign new values to the cookie dictionary
CookieObject.Values.Add("UserName", "David");
CookieObject.Values.Add("Country", "USA");
CookieObject.Values.Add("PreviousVisit", DateTime.Now.ToString());
CookieObject.Expires = DateTime.MaxValue;

3.Write Cookie
Response.Cookies.Add(CookieObject);

4. Read Cookie
HttpCookie ObjectCookie = Request.Cookies["UserPreference"];
string UserName = ObjectCookie.Values["UserName"];
string Country = ObjectCookie.Values["Country"];
string PreviousVisit = ObjectCookie.Values["PreviousVisit"];

What are the advantages of Using Cookies?
1. Cookies do not require any server resources since they are stored on the client.
2. Cookies are easy to implement.
3. You can configure cookies to expire when the browser session ends (session cookies) or they can exist for a specified length of time on the client computer (persistent cookies).

What are the disadvantages of Using Cookies?
1. Users can delete a cookies.
2. Users browser can refuse cookies,so your code has to anticipate that possibility.


Back

@Copy right of Soon Lim 2006. All Right Reserved