Programming Index Cards

March 31, 2009

ASP.Net Interview Q’s

Filed under: ASP.Net — Tags: , — apcig @ 3:11 am

<!–[if !mso]> <! st1\:*{behavior:url(#ieooui) } –>

Taken from TechSvr Blog

Is it possible to debug JavaScript in .NET IDE? If yes, how?
Ans. Yes, simply write “debugger” statement at the point where the breakpoint needs to be set within the JavaScript code and also enable JavaScript debugging in the browser property settings.

How many ways can we maintain the state of a page?
Ans. 1. Client Side – Query string, hidden variables, ViewState, cookies
2. Server side – application, cache, context, session, database

What is the use of Singleton pattern?
Ans. A Singleton pattern is used to make sure that only one instance of a class exists.

What is an .ashx file?
Ans. It is a web handler file that produces output to be consumed by an xml consumer client (rather than a browser).

What is encapsulation?
Ans. Encapsulation is the process of hiding all of the details of an object that do not contribute to its essential characteristics.

What is a Delegate?
Ans. A delegate is a strongly typed function pointer object that encapsulates a reference to a method, and so the function that needs to be invoked may be called at runtime.

What is the base class of all web forms?
Ans. System.Web.UI.Page

How to add a client side event to a server control?
Ans. BtnSubmit.Attributes.Add(“onclick”,”javascript:fnSomeFunctionInJavascript()”);

How to register a client side script from code-behind?
Ans. Use the Page.RegisterClientScriptBlock method in the server side code to register the script that may be built using a StringBuilder.

Can we put a break statement in a finally block?
Ans. The finally block cannot have the break, continue, return and goto statements.

How to instruct the garbage collector to collect unreferenced data?
Ans. We may call the garbage collector to collect unreferenced data by executing the System.GC.Collect() method.

What are Partial Classes in Asp.Net 2.0?
Ans. In .NET 2.0, a class definition may be split into multiple physical files but partial classes do not make any difference to the compiler as during compile time, the compiler groups all the partial classes and treats them as a single class.

What is Boxing and Unboxing?
Ans. Boxing is the process where any value type can be implicitly converted to a reference type object while Unboxing is the opposite of boxing process where the reference type is converted to a value type.

What does AddressOf in VB.NET operator do?
Ans. The AddressOf operator is used in VB.NET to create a delegate object to a method in order to point to it.

What is XmlHttpRequest in Ajax?
Ans. It is an object in JavaScript that allows the browser to communicate to a web server asynchronously without making a postback.

What does the virtual keyword in C# mean?
Ans. The virtual keyword signifies that the method and property may be overridden.

How to create a new unique ID for a control?
Ans. ControlName.ID = “ControlName” + Guid.NewGuid().ToString(); //Make use of the Guid class

What is the use of the dispose() method in .NET?
Ans. The Dispose method in .NET belongs to IDisposable interface and it is best used to release unmanaged objects like File objects, Windows API objects, Database connection objects, COM objects etc from the memory. Its performance is better than the finalize() method.

What is the difference between a session object and an application object?
Ans. A session object can persist information between HTTP requests for a particular user, whereas an application object can be used globally for all the users.

Controls in order of has performance, DataGrid, Repeater, DataList?
Ans. Repeater, Datalist, DataGrid.

Is it possible to perform forms authentication with cookies disabled on a browser?
Ans. No, it is not possible.

What is difference between dataset and datareader in ADO.NET?
Ans. A DataReader provides a forward-only and read-only access to data, while the DataSet object can carry more than one table and at the same time hold the relationships between the tables. Also note that a DataReader is used in a connected architecture whereas a Dataset is used in a disconnected architecture.

March 12, 2009

Notes – Headhunter Trade Secrets for Finding a New Job During a Recession

Filed under: career — apcig @ 2:43 am

From Stephen Viscusi’s blog entry Headhunter Trade Secrets for Finding a New Job During a Recession:

It’s important to humanize who you are…have your boss know you as “a person,” not just an employee.

It is easier to fire an employee who you know nothing about personally, or who you can’t relate to as a person.

“Bulletproofing” yourself requires being a bit Mommy and a bit Machiavelli.

If your boss does approach you about letting you go, and they always use these same line, “It’s not personal, it is a numbers thing,” you should definitely call his/her bluff! Ask your boss, “What’s the numbers thing, boss? What is the number?” Tell your boss that you’re willing to take a pay cut of 20 percent less for a year, or you’ll work three days instead of five…It really works!

Employers hire people who they like personally, and they fire people they don’t know or don’t like, regardless of performance. During a recession, they can get away with this.

Blog at WordPress.com.