Sunday, December 6, 2009

ASP.Net Web.Config File

ASP.Net Web.Config File

What is Web.Config File?
Web.config file, as it sounds like is a configuration file for the Asp .net web application. An Asp .net application has one web.config file which keeps the configurations required for the corresponding application. Web.config file is written in XML with specific tags having specific meanings.
What is Machine.config File?
As web.config file is used to configure one asp .net web application, same way Machine.config file is used to configure the application according to a particular machine. That is, configuration done in machine.config file is affected on any application that runs on a particular machine. Usually, this file is not altered and only web.config is used which configuring applications.
What can be stored in Web.config file?
There are number of important settings that can be stored in the configuration file. Here are some of the most frequently used configurations, stored conveniently inside Web.config file.
  • Database connections

  • Session States

  • Error Handling

  • Security
Database Connections:
The most important configuration data that can be stored inside the web.config file is the database connection string. Storing the connection string in the web.config file makes sense, since any modifications to the database configurations can be maintained at a single location. As otherwise we'll have to keep it either as a class level variable in all the associated source files or probably keep it in another class as a public static variable.
But if this is stored in the Web.config file, it can be read and used anywhere in the program. This will certainly save us a lot of alteration in different files where we used the old connection.
Lets see a small example of the connection string which is stored in the web.config file.





As you can see it is really simple to store the connection string in the web.config file. The connection string is referenced by a key which in this case is "ConnectionString". The value attribute of the configuration file denotes the information about the database. Here we can see that if has database name, userid and password. You can define more options if you want.
There is a very good website that deals with all sorts of connection strings. Its called http://www.connectionstrings.com/ , in the website you will find the connection strings for most of the databases.

Lets see how we access the connection string from our Asp .net web application.
using System.Configuration;
string connectionString = (string )ConfigurationSettings.AppSettings["ConnectionString"];

The small code snippet above is all that is needed to access the value stored inside the Web.config file.

ASP.Net Web Services

ASP.Net Web Services

  • A programming model that provides the ability to exchange messages in a scalable, loosely coupled and platform neutral environment using standard protocols such as HTTP,XML,XSD,SOAP and WSDL.

  • The SOAP based XML messages exchanged between a XML web service and its clients can be structured and typed or loosely defined.

  • The flexibility of using a text format such as XML enables the message exchange to evolve over time in a loosely coupled way.

Web Services - are a group of closely related, emerging technologies that describe a service oriented, component based application architecture that is based on an open, internet centric infrastructure.

XML,SOAP - a simple XML based protocol for exchanging structured and typed information as the web. The protocol contains no application or transport semantics which makes it highly modular and extensible.

WSDL - Web services Definition Language (similar to method signature). It is an XML based language used to define web services and describe how to access them. It is SOAP's interface definition language.

DISCO - (Discovery file) Holds reference to all the web services hosted on a server.

UDDI (Universal Description, Discovery and Integration)

Client Machine ---- URI of web service ----> IIS (port 80) ------> ASP.Net run time-----

----> Web services Handler ------> creates an instance of MyWebService and invokes the called method.Any parameters required by method are deserialized from SOAP packet and passed to method as .Net objects.


MyWebService ---------returns---> Computed value -----serializes---> data to XML document wrapped in SOAP packet ------>ASP.Net runtime ----response---->IIS----respond --->Client

ASP.NET Session State

ASP.NET Session State

ASP.NET session state enables you to store and retrieve values for a user as the user navigates to different ASP.NET pages that make up a Web application. HTTP is a stateless protocol, meaning that your Web server treats each HTTP request for a page as an independent request; by default, the server retains no knowledge of variable values used during previous requests. As a result, building Web applications that need to maintain some cross-request state information (applications that implement shopping carts, data scrolling, and so on) can be a challenge. ASP.NET session state identifies requests received from the same browser during a limited period of time as a session, and provides the ability to persist variable values for the duration of that session.
ASP.NET session state is enabled by default for all ASP.NET applications. ASP.NET session-state variables are easily set and retrieved using the Session property, which stores session variable values as a collection indexed by name. For example, you can create create the session variables FirstName and LastName to represent the first name and last name of a user, and sets them to values retrieved from TextBox controls.
Basic use of Session in ASP.NET (C#):
STORE: Session["mydataset")=ds;
RETRIEVE: DataSet ds = (DataSet)Session["mydataset"];
Storage location
InProc - session kept as live objects in web server (aspnet_wp.exe).
StateServer - session serialized and stored in memory in a separate process (aspnet_state.exe). State Server can run on another machine
SQLServer - session serialized and stored in SQL server
Performance
InProc
- Fastest, but the more session data, the more memory is consumed on the web server, and that can affect performance.
StateServer - When storing data of basic types (e.g. string, integer, etc), in one test environment it's 15% slower than InProc. However, the cost of serialization/deserialization can affect performance if you're storing lots of objects. You have to do performance testing for your own scenario.
SQLServer - When storing data of basic types (e.g. string, integer, etc), in one test environment it's 25% slower than InProc. Same warning about serialization as in StateServer.

ASP.Net Application state, difference between application, viewstate & session state

What is ASP.NET Application State?

Application state is a data repository available to all classes in an ASP.NET application. Application state is stored in memory on the server and is faster than storing and retrieving information in a database. Unlike session state, which is specific to a single user session, application state applies to all users and all sessions. Therefore, application state is a useful place to store small amounts of often-used data that does not change from one user to another.
What is Postback?
When an action occurs (like button click), the page containing all the controls within the tag performs an HTTP POST, while having itself as the target URL. This is called Postback.
ASP.NET View State
ASP.NET Web pages provide view state, which is a way for you to store information directly in the page that you want to persist between postbacks.
ASP.NET Cookies
A cookie is a small bit of text that accompanies requests and pages as they go between the Web server and browser. The cookie contains information the Web application can read whenever the user visits the site. Creating CookiesResponse.Cookies["userName"].Value = "patrick";Response.Cookies["userName"].Expires = DateTime.Now.AddDays(1); HttpCookie aCookie = new HttpCookie("lastVisit");aCookie.Value = DateTime.Now.ToString();aCookie.Expires = DateTime.Now.AddDays(1);Response.Cookies.Add(aCookie);
Getting Cookiesif(Request.Cookies["userInfo"] != null){ System.Collections.Specialized.NameValueCollection UserInfoCookieCollection; UserInfoCookieCollection = Request.Cookies["userInfo"].Values; Label1.Text = Server.HtmlEncode(UserInfoCookieCollection["userName"]); Label2.Text = Server.HtmlEncode(UserInfoCookieCollection["lastVisit"]);}

Differences between Session and ViewStates
"Session" is data stored per user session. "Viewstate" is an ASP.NET thing. It's a way for the application to maintain state about a particular form and its child controls. Your ASP.NET application might consist of several pages/forms. There might be a piece of data that you want to access across all pages. You could place that in a Session variable. However, you rarely need to worry about ViewState, ASP.NET manages that itself.

Viewstate variables are stored in the HTML of your page. They are encoded so they are not easily readable, but they are not encrypted. This is generally the best scope to use when you have a variable that is valid for a particular page and you want to store the value between postbacks. Once theuser navigates to another page the value is lost.Session variables are stored on the server (in RAM by default) and are persisted between all pages.

Different between application and session state
The difference is in the length of their existance.An application variable exists from when the application is first 'run' (The first time a page in the app is used) and exists until the application is stopped on the server, either through IIS or the actual machine being turned off or rebooted.A session variable is created for the instance of the browser accessing the site and will only be available until that browser is closed or the session times out.

ISS Diploma Black and White

Monday, July 13, 2009

Industrial Attachment Presentation Pictures

Hi ISS SA29 Classmates

You can view the photos from this link:

URL: http://michael-wee-issphotos.fotopic.net
Password: XXX

Please do not reveal the password to anyone except our ISS SA29 classmates. Your cooperation is much appreciated. Thanks.

Hope you enjoy viewing the ISS photos (please bear with my photography skills - some photos are blur)!

Regards
Michael Wee

PS. If you some of your ISS SA29 classmates did not received this mail, do forward this mail to them. Thanks.

Temp Visa Application

I have given a detailed procedure for applying PR using Pr offer letter.I hope this will be useful to my other friends.
  • Need Job offer letter from company.
  • Fill Form4a( download from ICA website),in that Annexure A has tobe filled by Company.
  • Marksheets of 2 Sem results and AD projects result + i had a letter given by ISS stating im currently doing intrenship presentation,i will be graduted based on my result.
  • All the required documents.
  • Go to ICA and get Q ticket and can submit the application only 3 days before joining date.
  • ICA staff will ask to sign in a letter stating "I finished my course,my result is still pending and i will produce the required certificate/letter with 3 months.If not my PR application will be closed and i need to apply for EP".
  • Once we signed,they will issue a Temp EP to start our Job,which will be valid for 3 months.

We need to produce a letter personally by going to ICA stating "Im graduated from ISS and im waiting for my graduation day".This is the letter from ISS they actually looking for.

It will be helpful to all,if we get a letter like this from ISS,along with our IA result,so that we can go to ICA and submit asap.

Pls let us know when can we get this letter,i hope there wont be any problem in getting this letter from ISS.

Thanks

karthik

Monday, July 6, 2009

GDipSA ISS NUS fees


Be caution about charges and fees and everything else about ISS. Be prepare to lose money :-)..in a way..u have been warned

Graduate Diploma in System Analysis 2009

Graduate Diploma in Systems Analysis - August 2009 Intake

Programme Synopsis
The Graduate Diploma in Systems Analysis programme is designed for graduates
who recognise the need to equip themselves with the latest IT knowledge and skills,
and wish to advance their careers in their current field. It also provides an
opportunity for non-IT graduates in crafting a new career path in the IT industry.

In this eleven-month FULL-TIME programme, students are taught how to built IT solutions through lectures, workshops, laboratory sessions, projects and industrial attachments. Students will also learn and practise the techniques taught to gather user requirements, systematically analyse and design feasible solutions; they will then move on to code, test and implement these solutions. The numerous projects in this programme give students many hands-on practices to deliver IT solutions covering client/server, internet/intranet and wireless platforms.

The programme emphasises building and enhancing essential soft skills such as project management qualities, independent/co-operative team working attitudes and effective team leader techniques. Students will be assigned to work in "Project teams" learning through "on the job training".

By the end of the programme, students will have a good grasp of Object-Oriented analysis and design based on Rational Unified Process (RUP) and Unified Modelling Language (UML). They will also be introduced to Object-Oriented programming using C# .Net with Visual Studio IDE, Java. JSP (Java Server Script), EJB (Enterprise Java Bean) on J2EE. In addition, they will be proficient in building internet solutions using ASP.NET and Web Services and mobile solutions using WML and J2ME.

Having graduated twenty-seven batches of students, this programme is going into its 28th year. Many of our graduates are now prominent senior IT professionals, who have benefited from this programme. The curriculum is frequently reviewed and revamped to ensure that the skills taught are those crucially needed by the IT industry.

Our graduates are employed in IT positions such as:
  1. IT Auditor
  2. IT Security Administrator
  3. Systems Analyst
  4. Systems Programmer
  5. IT Consultants
  6. IT Marketing Executive
  7. Web Developer
  8. Project Leader
  9. Application Engineer
  10. System Specialist
  11. IT Engineer

Many of the graduates from this programme further upgrade their skills after a few years in the IT industry. They are fully eligible to take up Master programmes with NTU, NUS and other universities. A number of them enrolled into ISS' "Master of Technology (Software Engineering)" : a part-time programme designed for working IT professionals and managers who wish to upgrade their knowledge and skills while pursuing their careers.

Methodology

Application Development Life Cycle
In this unit, students are guided, step by step, to perform the tasks and produce the deliverables in the various stages/phases of an application development life cycle. The unit focuses on Business Modeling, Requirement Gathering, Analysis, Design, Testing and Implementation. The life cycle adopts the Object Oriented approach using Unified Modelling Language (UML) as a standard notation and is based on the Rational Unified Process (RUP).

A real life business scenario is created to allow students practise every stage of the development life cycle through 'on-the-job-training' in an IT Project Team.

Technology

Distributed Computing Infrastructure
This unit introduces the various hardware and software components that make up a distributed computing infrastructure. The purpose and functions of these components and their roles in the implementation of a distributed enterprise IT solution are explored.

Databases

Databases
Students will learn the functions and purposes of databases in IT applications. This unit will explain Database Management System (DBMS) concepts and the architecture components of a typical DBMS.

SQL Programming
To teach students the role and importance of SQL as a database manipulation, definition and control language. SQL concepts, components, capabilities and usages will be introduced. In addition, students will learn to develop stored procedures on SQL server. They will also learn fundamental database administration tasks with the aid of developer tools.

Programming: C# Suite

Fundamentals of Programming using C#
This unit lays the foundations for programming. Programming logic development using flow charts and pseudo codes will be covered in detail. The module uses C# language constructs for demonstrating programming concepts. Emphasis will be laid on structured programming approach for software development. The unit will be supported by workshops that would illustrate programming situations in the Business Environment.

Object Oriented Programming using C#
This unit focuses on building a strong Object Oriented Programming (OOP) foundation for the students. It emphasises best practices of OOP and provides in-depth knowledge on software development using Object-Oriented techniques. Concepts such as classes, inheritance, polymorphism, and interfaces are taught with numerous examples. Students are given ample workshops to implement these OOP concepts using the C# language.

User Interface Development with Visual Studio.NET and C#
This unit teaches students to effectively develop Graphical User Interface (GUI) using Visual Studio.NET Integrated Development Environment (IDE) and C#. Through examples and workshops, the students will learn the features and functionalities of a typical IDE for GUI Application development. Upon completion, students will be well versed in the development of function rich clients and will be able to carry out programming using Visual control with clear understanding of their properties, methods and events.

Developing Enterprise Systems with .NET Framework
This unit covers the development of IT solutions for a distributed infrastructure. Student will learn to develop different types of software components to run on client machines and server machines. Microsoft .NET will be used for the client side development with SQL Server as the database. The unit will expose students to advanced concepts such as creating user-defined objects with ADO.NET and transaction management. Development of MIS reports with the aid of reporting tools and integration of the Client Server model will also be taught.

Programming: Java Suite

Java Programming
This unit provides a clear understanding of Object Oriented Programming (OOP) with Java as the vehicle. Apart from preparing the students on OOP, the unit will provide extensive coverage on the features of the Java language. Data structures and algorithm development will be taught. The unit includes File Input/Output handling and Multi-threading models.

Advanced Java
Students will learn Java Database Connectivity (JDBC) architectures and Java Data Objects (JDO) to obtain persistence objects. They will use these knowledge to develop Java-based solutions accessing database information.

Building Enterprise Application using J2EE
This module provides concepts of J2EE platform. Students will learn to develop programs using JSP, Servlets and EJBs and will deploy them in an enterprise architecture. Internet based development will also be covered.

Internet Application Development

Multimedia And Internet Technology
The unit covers the Web page development using HTML programming. It also introduces Web publishing tools for Web page development. The unit focuses on the design and development of multimedia elements for the Web environment. The multimedia elements will include graphics, audio, video and animation. The tools used for the Multimedia content creation include Macromedia Director, Adobe Photoshop, Adobe Premiere, Creative Wave Studio and etc. The students will also be using equipment such as the Digital Camera, Scanner and Video Capturing Tool.

Internet Programming With Microsoft .NET Framework
This unit provides an insight to the Back Office integration on Web platform. It covers the advanced internet programming on both the client and server sides. The client side technology discussed in this module includes JAVASCRIPT, ACTIVE X control and Java Applets. The server side technology will include ASP.NET and ADO.NET. The unit will also include integrating the Web application with the Back Office database management system using the different server side technologies.

Project Management

Roles and Responsibilities
This unit introduces students to the various types of IT professions and the organisation structure of a typical IT department in a company. Students will be able to understand the roles and responsibilities of various state holders in an IT project.

Project Planning and Control
This unit prepares students to meet the challenge of managing IS projects. Students will get an appreciation of the discipline through an introduction to the nature of project management, management areas, common difficulties in managing IS projects, human factors in project management, and the project management methodology. Project planning techniques such as work breakdown structure, cost estimation, precedence analysis, scheduling and cost benefit analysis are covered.

Change Management and Control
In this unit, students will learn to expect the many changes that will surface in the life cycle of an IT project. Students will learn to evaluate and prioritise these change requests and to manage risk in delay in project delivery.

Business Communication
Effective business communication is one of the critical factors in the success of an IT project. In this unit, students will learn and practise good interviewing techniques to derive requirements from 'End Users'. They will learn to prepare and deliver quality presentations to End Users, Management and other IT stakeholders.

Mobile Solution

Mobile Application Development
In this unit, we will cover technology aspects in mobile wireless technology development. It includes wireless network infrastructure (2.5G, 3G, bluetooth), mobile application architecture, mobile user interface design and mobile application development.
It introduces J2ME architecture, CDLC and MIDP API. Students are required to understand the role of J2ME in wireless development and are expected to do an assignment which covers the design and development of a mobile wireless application using J2ME (Java 2 Micro Edition). In addition, development of enterprise application using SMS (Short Messaging Services) is also covered.

Projects

Object Oriented Application Project
This project starts after the completion of the Application Development Life Cycle. In the life cycle module, students have extensively analysed and designed an IT solution using Object Oriented approach and the end result is a set of well-defined design specifications. In this module, they are required to use an OO programming language (C# or Java) to code and deliver the IT solution based on their design specifications.

Internet Project with Multimedia, ASP.NET and Web Services
In this unit, students are required to design and develop a virtual shopping cart application.The purpose of the project is to evaluate students' abilities to design and build a user-friendly and effective Web application using the E-commerce Application Life Cycle and the internet programming techniques taught. It will also evaluate the students' ability to enhance the product presentation using appropriate multimedia technology.

Web Project with J2EE
Students are to apply their knowledge gained from Java Programming, Advanced Java and Building Enterprise Application using J2EE to code a J2EE-based application. They have to design the system to show how the application processes each request. At the end of this project, students are to present their application and submit the design report. During the demonstration, students have to prove that the system meets all required functionalities and caters for error handling.

Application Development Project
This is a 160 manday-sized project. Students are organised into project teams. Each team is required to work independently to deliver the working solution at the end of the timeframe.

Each team will organise its own internal structure taking on roles of project leader, team members etc. They will work together and apply the project management, analysis, design, business communications and programming skills learnt earlier in the course on this project.

Based on a Project Objective Document (User Requirement Statement), the teams will go through a complete application development life cycle to propose, develop and deliver an IT solution. The students will capture requirements through user interviews, produce a feasible design, code, test and implement the solution on a distributed platform. This project provides a simulation of the real-life IT working environment and tests their strengths in working closely as a project team.

Industrial Attachment

Industrial Attachment (IA) is a very crucial component in the Graduate Diploma in Systems Analysis Programme. This is where students are sent to work in a real-life setting. They have to quickly adapt to companies' working culture, pick up new technical skills and domain knowledge if required, propose feasible IT solutions, develop and deliver the solution to the satisfaction of their users.

The life cycle of an IA Project can be very unpredictable. User requirements, project schedules and end product expectations change as the project progresses. Students have to be versatile and flexible to handle these challenges to complete the IA project.

Our past students have found IA experience very rewarding and a necessary transition stage to prepare them for an IT career life.

Sunday, June 21, 2009

ISS internship Company Appraisal Form

Ge it here.

C# .NET & ASP .NET Interview Questions

C# .NET & ASP .NET Interview Questions 15 June 2009

.NET Interview Questions
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.



Tough ASP.NET interview questions
1. Describe the difference between a Thread and a Process?
2. What is a Windows Service and how does its lifecycle differ from a .standard. EXE?
3. What is the maximum amount of memory any single process on Windows can address? Is this different than the maximum virtual memory for the system? How would this affect a system design?
4. What is the difference between an EXE and a DLL?
5. What is strong-typing versus weak-typing? Which is preferred? Why?
6. What.s wrong with a line like this? DateTime.Parse(myString
7. What are PDBs? Where must they be located for debugging to work?
8. What is cyclomatic complexity and why is it important?
9. Write a standard lock() plus double check to create a critical section around a variable access.
10. What is FullTrust? Do GAC’ed assemblies have FullTrust?
11. What benefit does your code receive if you decorate it with attributes demanding specific Security permissions?
12. What does this do? gacutil /l | find /i “about”
13. What does this do? sn -t foo.dll
14. What ports must be open for DCOM over a firewall? What is the purpose of Port 135?
15. Contrast OOP and SOA. What are tenets of each
16. How does the XmlSerializer work? What ACL permissions does a process using it require?
17. Why is catch(Exception) almost always a bad idea?
18. What is the difference between Debug.Write and Trace.Write? When should each be used?
19. What is the difference between a Debug and Release build? Is there a significant speed difference? Why or why not?
20. Does JITting occur per-assembly or per-method? How does this affect the working set?
21. Contrast the use of an abstract base class against an interface?
22. What is the difference between a.Equals(b) and a == b?
23. In the context of a comparison, what is object identity versus object equivalence?
24. How would one do a deep copy in .NET?
25. Explain current thinking around IClonable.
26. What is boxing?
27. Is string a value type or a reference type?

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?
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?
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 a static indexer in C#? -
No. Static indexers are not allowed in C#.

3. 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:
using System;

class main
{
public static void Main()
{
try
{
Console.WriteLine(\"In Try block\");
return;
}
finally
{
Console.WriteLine(\"In Finally block\");
}
}
}
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).
4. 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) { }

5. 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:
using System;
public class StringTest
{
public static void Main(string[] args)
{
Object nullObj = null; Object realObj = new StringTest();
int i = 10;
Console.WriteLine(\"Null Object is [\" + nullObj + \"]\n\"
+ \"Real Object is [\" + realObj + \"]\n\"
+ \"i is [\" + i + \"]\n\");
// Show string equality operators
string str1 = \"foo\";
string str2 = \"bar\";
string str3 = \"bar\";
Console.WriteLine(\"{0} == {1} ? {2}\", str1, str2, str1 == str2 );
Console.WriteLine(\"{0} == {1} ? {2}\", str2, str3, str2 == str3 );
}
}
Output:
Null Object is []
Real Object is [StringTest]
i is [10]
foo == bar ? False
bar == bar ? True
6. 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:
using System;
[assembly : MyAttributeClass] class X {}
Note that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs.
7. 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.
8. 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:
lock(obj) { // code }
translates to
try {
CriticalSection.Enter(obj);
// code
}
finally
{
CriticalSection.Exit(obj);
}
9. How do you directly call a native function exported from a DLL? -
Here’s a quick example of the DllImport attribute in action:

using System.Runtime.InteropServices; \
class C
{
[DllImport(\"user32.dll\")]
public static extern int MessageBoxA(int h, string m, string c, int type);
public static int Main()
{
return MessageBoxA(0, \"Hello World!\", \"Caption\", 0);
}
}

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.
10. 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.

C# developer interview questions
A representative of a high-tech company in United Kingdom sent this in today noting that the list was used for interviewing a C# .NET developer. Any corrections and suggestions would be forwarded to the author. I won’t disclose the name of the company, since as far as I know they might still be using this test for prospective employees. Correct answers are in green color.
1) The C# keyword .int. maps to which .NET type?
1. System.Int16
2. System.Int32
3. System.Int64
4. System.Int128

2) Which of these string definitions will prevent escaping on backslashes in C#?
1. string s = #.n Test string.;
2. string s = ..n Test string.;
3. string s = @.n Test string.;
4. string s = .n Test string.;
3) Which of these statements correctly declares a two-dimensional array in C#?
1. int[,] myArray;
2. int[][] myArray;
3. int[2] myArray;
4. System.Array[2] myArray;
4) If a method is marked as protected internal who can access it?
1. Classes that are both in the same assembly and derived from the declaring class.
2. Only methods that are in the same class as the method in question.
3. Internal methods can be only be called using reflection.
4. Classes within the same assembly, and classes derived from the declaring class.
5) What is boxing?
a) Encapsulating an object in a value type.
b) Encapsulating a copy of an object in a value type.
c) Encapsulating a value type in an object.
d) Encapsulating a copy of a value type in an object.
6) What compiler switch creates an xml file from the xml comments in the files in an assembly?
1. /text
2. /doc
3. /xml
4. /help
7) What is a satellite Assembly?
1. A peripheral assembly designed to monitor permissions requests from an application.
2. Any DLL file used by an EXE file.
3. An assembly containing localized resources for another assembly.
4. An assembly designed to alter the appearance or .skin. of an application.
8) What is a delegate?
1. A strongly typed function pointer.
2. A light weight thread or process that can call a single method.
3. A reference to an object in a different process.
4. An inter-process message channel.
9) How does assembly versioning in .NET prevent DLL Hell?
1. The runtime checks to see that only one version of an assembly is on the machine at any one time.
2. .NET allows assemblies to specify the name AND the version of any assemblies they need to run.
3. The compiler offers compile time checking for backward compatibility.
4. It doesn.t.
10) Which .Gang of Four. design pattern is shown below?
public class A {
private A instance;
private A() { }
public
static A Instance {
get {
if ( A == null )
A = new A();
return instance;
}
}
}
1. Factory
2. Abstract Factory
3. Singleton
4. Builder
11) In the NUnit test framework, which attribute must adorn a test class in order for it to be picked up by the NUnit GUI?
1. TestAttribute
2. TestClassAttribute
3. TestFixtureAttribute
4. NUnitTestClassAttribute
12) Which of the following operations can you NOT perform on an ADO.NET DataSet?
1. A DataSet can be synchronised with the database.
2. A DataSet can be synchronised with a RecordSet.
3. A DataSet can be converted to XML.
4. You can infer the schema from a DataSet.
13) In Object Oriented Programming, how would you describe encapsulation?
1. The conversion of one type of object to another.
2. The runtime resolution of method calls.
3. The exposition of data.
4. The separation of interface and implementation.

.NET deployment questions
1. What do you know about .NET assemblies?
Assemblies are the smallest units of versioning and deployment in the .NET application. Assemblies are also the building blocks for programs such as Web services, Windows services, serviced components, and .NET remoting applications.

2. What’s the difference between private and shared assembly?
Private assembly is used inside an application only and does not have to be identified by a strong name. Shared assembly can be used by multiple applications and has to have a strong name.

3. What’s a strong name?
A strong name includes the name of the assembly, version number, culture identity, and a public key token.

4. How can you tell the application to look for assemblies at the locations other than its own install?
Use the
directive in the XML .config file for a given application.

should do the trick. Or you can add additional search paths in the Properties box of the deployed application.

5. How can you debug failed assembly binds?
Use the Assembly Binding Log Viewer (fuslogvw.exe) to find out the paths searched.

6. Where are shared assemblies stored?
Global assembly cache.
7. How can you create a strong name for a .NET assembly?
With the help of Strong Name tool (sn.exe).

8. Where’s global assembly cache located on the system?
Usually C:\winnt\assembly or C:\windows\assembly.

9. Can you have two files with the same file name in GAC?
Yes, remember that GAC is a very special folder, and while normally you would not be able to place two files with the same name into a Windows folder, GAC differentiates by version number as well, so it’s possible for MyApp.dll and MyApp.dll to co-exist in GAC if the first one is version 1.0.0.0 and the second one is 1.1.0.0.

10. So let’s say I have an application that uses MyApp.dll assembly, version 1.0.0.0. There is a security bug in that assembly, and I publish the patch, issuing it under name MyApp.dll 1.1.0.0. How do I tell the client applications that are already installed to start using this new MyApp.dll?
Use publisher policy. To configure a publisher policy, use the publisher policy configuration file, which uses a format similar app .config file. But unlike the app .config file, a publisher policy file needs to be compiled into an assembly and placed in the GAC.

11. What is delay signing?
Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key. This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.
------ ----------------------- -------------------- ---------------------- -------------- ------------
.NET Interview Questions
Process
The operating system creates a process for the purpose of running a program. Every process has at least one thread

Thread
A thread is the "lightest" unit of kernel scheduling. At least one thread exists within each process. If multiple threads can exist within a process, then they share the same memory and file resources. Threads allow a program to do multiple things concurrently.

Virtual and non-virtual method.
The distinction between virtual and not virtual is:
If the function is "virtual" then the derived class's function would be called (if it exists).
If it is not virtual, the base class's function would be called.

Virtual Function
A virtual function allows a derived class to override functions in classes it inherits from.

A pure virtual function or pure virtual method
A pure virtual function or pure virtual method is a virtual function that has a declaration (signature), but no definition (implementation).

Multiple inheritances
Multiple inheritances refer to a feature of object-oriented programming languages in which a class can inherit behaviors and features from more than one super-class.

Polymorphism
Polymorphism is the ability of objects belonging to different types to respond, to calls methods of the same name, each one according to an appropriate type-specific behavior.

Copy constructor
• A constructor function with the same name as the class.
• Used to make deep copy of objects.
There are 3 important places where a copy constructor is called.
• When an object is created from another object of the same type
• When an object is passed by value as a parameter to a function
• When an object is returned from a function

Why we use Interface?
An interface allows somebody to start from scratch to implement your interface or implement your interface in some other code whose original or primary purpose was quite different from your interface. To them, your interface is only incidental, something that have to add on to the their code to be able to use your package.
Why we use abstract?
An abstract class, in contrast, provides more structure. It usually defines some default implementations and provides some tools useful for a full implementation. The catch is, code using it must use your class as the base. That may be highly inconvenient if the other programmers wanting to use your package have already developed their own class hierarchy independently. In Java, a class can inherit from only one base class.

Shallow copy
A shallow copy of an object copies all of the member field values. This works well if the fields are values, but may not be what you want for fields that point to dynamically allocated memory. The pointer will be copied. But the memory it points to will not be copied -- the field in both the original object and the copy will then point to the same dynamically allocated memory, which is not usually what you want. The default copy constructor and assignment operator make shallow copies.

Deep copy
A deep copy copies all fields, and makes copies of dynamically allocated memory pointed to by the fields. To make a deep copy, you must write a copy constructor and overload the assignment operator; otherwise the copy will point to the original, with disastrous consequences.

ICloneable Interface
Supports cloning, which creates a new instance of a class with the same value as an existing instance.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

Syntax C#
public interface ICloneable

Delegate
A delegate in C# is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked.

Boxing
Converting a value type to reference type is called Boxing and is an implicit operation
e.g; int i =123
object obj = i ; // Boxing operation


UnBoxing
Converting a reference type to value type is called UnBoxing and is an explicit operation.
e.g
int j = (int) obj ; // UnBoxing Operation

DiffGrams
The XML format used for DataSet serialization is known as DiffGram. Like Updategrams, DiffGrams also contains the tags that specify the original and new state of data.

Serialization
Serialization allows programms to persist objects by storing then in files. In the case of this tutorial, into XML files. XML has become the standard for storage in the recent years


Global Assembly Cache
Each computer wherein the common language runtime is installed has a machine-wide code cache called the Global Assembly Cache. This Global Assembly Cache stores .NET assemblies specifically designated to be shared by several applications on that computer.

What is an assembly?
• An Assembly is a logical unit of code
• Assembly physically exist as DLLs or EXEs
• One assembly can contain one or more files
• The constituent files can include any file types like image files, text files etc. along with DLLs or EXEs
When you compile your source code by default the exe/dll generated is actually an assembly.
Every assembly file contains information about itself. This information is called as Assembly Manifest.

What is assembly manifest?
• Assembly manifest is a data structure which stores information about an assembly
• This information is stored within the assembly file(DLL/EXE) itself
• The information includes version information, list of constituent files etc.
What is private and shared assembly?

Private assembly.
The assembly, which is used only by a single application, is called as private assembly.

Suppose you DLL will be used by your client application only and not by any other application. Private assembly must reside in the same folder in which the client application is installed.

Shared assemblies.
The assembly, which is used for more than one application, is called as shared assembly.

Suppose that you are creating a general purpose DLL that provides functionality, which will be used by variety of applications. Such assemblies are called as shared assemblies.
Shared assemblies can place in 'global assembly cache'.

What is Global Assembly Cache?
Global assembly cache is nothing but a special disk folder where all the shared assemblies will be kept. It is located under :\WinNT\Assembly folder.
How assemblies avoid DLL Hell?
As stated earlier most of the assemblies are private. Hence each client application refers assemblies from its own installation folder. So, even though there are multiple versions of same assembly they will not conflict with each other. Consider following example :

How do I create shared assemblies?
• Create your DLL/EXE source code
• Generate unique assembly name using SN utility
• Sign your DLL/EXE with the private key by modifying AssemblyInfo file
• Compile your DLL/EXE
• Place the resultant DLL/EXE in global assembly cache using AL utility

Strong vs. Weak Type Checking
A language is said to be strongly typed mean if it enforces type abstractions. That is, operations may be applied only to objects of the appropriate type.

The language is said to be weakly typed means :
For example, if the boolean constants are represented by 0 and 1 and the language permits a boolean to occur in arithmetic expressions, then the language is not enforcing the boolean type abstraction.

Most languages are strongly typed with respect to the primitive types supported by the language.
Strong typing helps to insure the security and portability of the code and it often requires the programmer to explicitly define the types of each object in a program.
Weak type checking has the advantage of providing representation independence.
Early Binding vs Late Binding

Advantages of Early Binding
• Your code will run considerably faster, because it can all be compiled up front. With late binding, the code relating to an application you declared, as an object has to, in effect, be compiled as it runs.

• Because your code can all be compiled up front, debugging is far easier and the compiler will be able to spot syntax errors, which would have been missed, had you used late binding.

Advantages of Late Binding
The main advantage is that code which uses late binding is more certain to be version-independent.

Disadvantages of Late Binding
The more references your project contains, the larger the file size and the longer it takes to compile.

---------- ----------------------------- -------------------- ----------------------------- ---------------------------------

Interview questions for .NET 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:
using System;
class main
{
public static void Main()
{
try
{
Console.WriteLine("In Try block");
return;
}
finally
{
Console.WriteLine("In Finally block");
}
}
}
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).
5. 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) { }

6. 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:

using System;
public class StringTest
{
public static void Main(string[] args)
{
Object nullObj = null; Object realObj = new StringTest();
int i = 10;
Console.WriteLine("Null Object is [" + nullObj + "]\n"
+ "Real Object is [" + realObj + "]\n"
+ "i is [" + i + "]\n");
// Show string equality operators
string str1 = "foo";
string str2 = "bar";
string str3 = "bar";
Console.WriteLine("{0} == {1} ? {2}", str1, str2, str1 == str2 );
Console.WriteLine("{0} == {1} ? {2}", str2, str3, str2 == str3 );
}
}
Output:
Null Object is []
Real Object is [StringTest]
i is [10]
foo == bar ? False
bar == bar ? True
7. 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:
using System;
[assembly : MyAttributeClass] class X {}
Note that in an IDE-created project, by convention, these attributes are placed in AssemblyInfo.cs.
8. 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.

9. 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:
lock(obj) { // code }
translates to
try {
CriticalSection.Enter(obj);
// code
}
finally
{
CriticalSection.Exit(obj);
}
10. How do you directly call a native function exported from a DLL? -
Here’s a quick example of the DllImport attribute in action:

using System.Runtime.InteropServices; \
class C
{
[DllImport("user32.dll")]
public static extern int MessageBoxA(int h, string m, string c, int type);
public static int Main()
{
return MessageBoxA(0, "Hello World!", "Caption", 0);
}
}
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.
11. 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.

----------- ------------------------- ---------------------------------- --------------------------- ------------------------
1. What are the new Data Controls in Asp.net 2.0?
Data access in ASP.NET 2.0 can be accomplished completely declaratively (no code) using the new data-bound and data source controls. There are new data source controls to represent different data backends such as SQL database, business objects, and XML, and there are new data-bound controls for rendering common UI for data, such as gridview, detailsview, and formview.
2. What are the new Navigation Controls in Asp.net 2.0?
The navigation controls provide common UI for navigating between pages in your site, such as treeview, menu, and sitemappath. These controls use the site navigation service in ASP.NET 2.0 to retrieve the custom structure you have defined for your site.
3. What are the new Login Controlsin Asp.net 2.0?
The new login controls provide the building blocks to add authentication and authorization-based UI to your site, such as login forms, create user forms, password retrieval, and custom UI for logged in users or roles. These controls use the built-in membership and role services in ASP.NET 2.0 to interact with the user and role information defined for your site.
4. What are the new Web Part Controls in Asp.net 2.0 ?
Web parts are an exciting new family of controls that enable you to add rich, personalized content and layout to your site, as well as the ability to edit that content and layout directly from your application pages. These controls rely on the personalization services in ASP.NET 2.0 to provide a unique experience for each user in your application.
5. What are Master Pages?
This feature provides the ability to define common structure and interface elements for your site, such as a page header, footer, or navigation bar, in a common location called a "master page", to be shared by many pages in your site. In one simple place you can control the look, feel, and much of functionality for an entire Web site. This improves the maintainability of your site and avoids unnecessary duplication of code for shared site structure or behavior.
6. What are Themes and Skins in 2.0, explain usgae scenario?
The themes and skins features in ASP.NET 2.0 allow for easy customization of your site's look-and-feel. You can define style information in a common location called a "theme", and apply that style information globally to pages or controls in your site. Like Master Pages, this improves the maintainability of your site and avoid unnecessary duplication of code for shared styles.
7. What is a profile object, why is it used?
Using the new personalization services in ASP.NET 2.0 you can easily create customized experiences within Web applications. The Profile object enables developers to easily build strongly-typed, sticky data stores for user accounts and build highly customized, relationship based experiences. At the same time, a developer can leverage Web Parts and the personalization service to enable Web site visitors to completely control the layout and behavior of the site, with the knowledge that the site is completely customized for them. Personalizaton scenarios are now easier to build than ever before and require significantly less code and effort to implement.
8. What is Configuration API?
ASP.NET 2.0 contains new configuration management APIs, enabling users to programmatically build programs or scripts that create, read, and update Web.config and machine.config configuration files.
9. What is MMC Admin Tool?
ASP.NET 2.0 provides a new comprehensive admin tool that plugs into the existing IIS Administration MMC, enabling an administrator to graphically read or change common settings within our XML configuration files.
10. Explain the use of Pre-compilation Tool?
ASP.NET 2.0 delivers a new application deployment utility that enables both developers and administrators to precompile a dynamic ASP.NET application prior to deployment. This precompilation automatically identifies any compilation issues anywhere within the site, as well as enables ASP.NET applications to be deployed without any source being stored on the server (one can optionally remove the content of .aspx files as part of the compile phase), further protecting your intellectual property.
11. How is application management and maintenance improved in Asp.net 2.0?
ASP.NET 2.0 also provides new health-monitoring support to enable administrators to be automatically notified when an application on a server starts to experience problems. New tracing features will enable administrators to capture run-time and request data from a production server to better diagnose issues. ASP.NET 2.0 is delivering features that will enable developers and administrators to simplify the day-to-day management and maintenance of their Web applications.
12. What are Provider-driven Application Services? explain in detail?
ASP.NET 2.0 now includes built-in support for membership (user name/password credential storage) and role management services out of the box. The new personalization service enables quick storage/retrieval of user settings and preferences, facilitating rich customization with minimal code. The new site navigation system enables developers to quickly build link structures consistently across a site. As all of these services are provider-driven, they can be easily swapped out and replaced with your own custom implementation. With this extensibility option, you have complete control over the data store and schema that drives these rich application services.

13. Explain Server Control Extensibility with reference to Asp.net 2.0 ?
ASP.NET 2.0 includes improved support for control extensibility, such as more base classes that encapsulate common behaviors, improved designer support, more APIs for interacting with client-side script, metadata-driven support for new features like themes and accessibility verification, better state management, and more.

14. What are the Data Source Controls?
Data access in ASP.NET 2.0 is now performed declaratively using data source controls on a page. In this model, support for new data backend storage providers can be easily added by implementing custom data source controls. Additionally, the SqlDataSource control that ships in the box has built-in support for any ADO.NET managed provider that implements the new provider factory model in ADO.NET.

15. What are Compilation Build Providers?
Dynamic compilation in ASP.NET 2.0 is now handled by extensible compilation build providers, which associate a particular file extension with a handler that knows how to compile that extension dynamically at runtime. For example, .resx files can be dynamically compiled to resources, .wsdl files to web service proxies, and .xsd files to typed DataSet objects. In addition to the built-in support, it is easy to add support for additional extensions by implementing a custom build provider and registering it in Web.config.

16. What is Expression Builders, why would you use it?
ASP.NET 2.0 introduces a declarative new syntax for referencing code to substitute values into the page, called Expression Builders. ASP.NET 2.0 includes expression builders for referencing string resources for localization, connection strings, application settings, and profile values. You can also write your own expression builders to create your own custom syntax to substitute values in a page rendering.

17. Is ASP.NET 64-Bit enabled? how?
ASP.NET 2.0 is now 64-bit enabled, meaning it can take advantage of the full memory address space of new 64-bit processors and servers. Developers can simply copy existing 32-bit ASP.NET applications onto a 64-bit ASP.NET 2.0 server and have them automatically be JIT compiled and executed as native 64-bit applications (no source code changes or manual re-compile are required).

18. Explain how Caching in Asp.net 2.0 is different from Caching in Asp.net 1.1?
ASP.NET 2.0 also now includes automatic database server cache invalidation. This powerful and easy-to-use feature allows developers to aggressively output cache database-driven page and partial page content within a site and have ASP.NET automatically invalidate these cache entries and refresh the content whenever the back-end database changes. Developers can now safely cache time-critical content for long periods without worrying about serving visitors stale data.
----------- ------------------------------ ------------------------------- --------------------------- ----------------------
C# Interview Questions
This is a list of questions I have gathered from other sources and created myself over a period of time from my experience, many of which I felt where incomplete or simply wrong. I have finally taken the time to go through each question and correct them to the best of my ability. However, please feel free to post feedback to challenge, improve, or suggest new questions. I want to thank those of you that have contributed quality questions and corrections thus far.
There are some question in this list that I do not consider to be good questions for an interview. However, they do exist on other lists available on the Internet so I felt compelled to keep them easy access.
General Questions
1. Does C# support multiple-inheritance?
No.

2. Who is a protected class-level variable available to?
It is available to any sub-class (a class inheriting this class).

3. Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.

4. Describe the accessibility modifier “protected internal”.
It is available to classes that are within the same assembly and derived from the specified base class.

5. What’s the top .NET class that everything is derived from?
System.Object.

6. What does the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory.

7. What’s the difference between System.String and System.Text.StringBuilder classes?
System.String is immutable. System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.

8. What’s the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.

9. Can you store multiple data types in System.Array?
No.

10. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The Clone() method returns a new array (a shallow copy) object containing all the elements in the original array. The CopyTo() method copies the elements into another existing array. Both perform a shallow copy. A shallow copy means the contents (each array element) contains references to the same object as the elements in the original array. A deep copy (which neither of these methods performs) would create a new instance of each element's object, resulting in a different, yet identacle object.

11. How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.

12. What’s the .NET collection class that allows an element to be accessed using a unique key?
HashTable.

13. What class is underneath the SortedList class?
A sorted HashTable.

14. Will the finally block get executed if an exception has not occurred?¬
Yes.

15. What’s the C# syntax to catch any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.

16. Can multiple catch blocks be executed for a single try statement?
No. Once the proper catch block processed, control is transferred to the finally block (if there are any).

17. Explain the three services model commonly know as a three-tier application.
Presentation (UI), Business (logic and underlying code) and Data (from storage or other sources).

Class Questions
1. What is the syntax to inherit from a class in C#?
Place a colon and then the name of the base class.
Example: class MyNewClass : MyBaseClass

2. Can you prevent your class from being inherited by another class?
Yes. The keyword “sealed” will prevent the class from being inherited.

3. Can you allow a class to be inherited, but prevent the method from being over-ridden?
Yes. Just leave the class public and make the method sealed.

4. What’s an abstract class?
A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.

5. When do you absolutely have to declare a class as abstract?
1. When the class itself is inherited from an abstract class, but not all base abstract methods have been overridden.
2. When at least one of the methods in the class is abstract.

6. What is an interface class?
Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.

7. Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public, and are therefore public by default.

8. Can you inherit multiple interfaces?
Yes. .NET does support multiple interfaces.

9. What happens if you inherit multiple interfaces and they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.
To Do: Investigate

10. What’s the difference between an interface and abstract class?
In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.

11. What is the difference between a Struct and a Class?
Structs are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that structs cannot inherit.

Method and Property Questions
1. What’s the implicit name of the parameter that gets passed into the set method/property of a class?
Value. The data type of the value parameter is defined by whatever data type the property is declared as.

2. What does the keyword “virtual” declare for a method or property?
The method or property can be overridden.

3. How is method overriding different from method overloading?
When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.

4. Can you declare an override method to be static if the original method is not static?
No. The signature of the virtual method must remain the same. (Note: Only the keyword virtual is changed to keyword override)

5. What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters.

6. If a base class has a number of overloaded constructors, and an inheriting class has a number of overloaded constructors; can you enforce a call from an inherited constructor to a specific base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

Events and Delegates
1. What’s a delegate?
A delegate object encapsulates a reference to a method.

2. What’s a multicast delegate?
A delegate that has multiple handlers assigned to it. Each assigned handler (method) is called.

XML Documentation Questions
1. Is XML case-sensitive?
Yes.

2. What’s the difference between // comments, /* */ comments and /// comments?
Single-line comments, multi-line comments, and XML documentation comments.

3. How do you generate documentation from the C# file commented properly with a command-line compiler?
Compile it with the /doc switch.

Debugging and Testing Questions
1. What debugging tools come with the .NET SDK?
1. CorDBG – command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch.
2. DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR.

2. What does assert() method do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

3. What’s the difference between the Debug class and Trace class?
Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.

4. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose. For applications that are constantly running you run the risk of overloading the machine and the hard drive. Five levels range from None to Verbose, allowing you to fine-tune the tracing activities.

5. Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.

6. How do you debug an ASP.NET Web application?
Attach the aspnet_wp.exe process to the DbgClr debugger.

7. What are three test cases you should go through in unit testing?
1. Positive test cases (correct data, correct output).
2. Negative test cases (broken or missing data, proper handling).
3. Exception test cases (exceptions are thrown and caught properly).

8. Can you change the value of a variable while debugging a C# application?
Yes. If you are debugging via Visual Studio.NET, just go to Immediate window.

ADO.NET and Database Questions
1. What is the role of the DataReader class in ADO.NET connections?
It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed.

2. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix. OLE-DB.NET is a .NET layer on top of the OLE layer, so it’s not as fastest and efficient as SqlServer.NET.

3. What is the wildcard character in SQL?
Let’s say you want to query database with LIKE for all employees whose name starts with La. The wildcard character is %, the proper query with LIKE would involve ‘La%’.

4. Explain ACID rule of thumb for transactions.
A transaction must be:
1. Atomic - it is one unit of work and does not dependent on previous and following transactions.
2. Consistent - data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t.
3. Isolated - no transaction sees the intermediate results of the current transaction).
4. Durable - the values persist if the data had been committed even if the system crashes right after.

5. What connections does Microsoft SQL Server support?
Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and password).

6. Between Windows Authentication and SQL Server Authentication, which one is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.

7. What does the Initial Catalog parameter define in the connection string?
The database name to connect to.

8. What does the Dispose method do with the connection object?
Deletes it from the memory.
To Do: answer better. The current answer is not entirely correct.

9. What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings. The connection string must be identical.

Assembly Questions
1. How is the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

2. What are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.

3. What is a satellite assembly?
When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.

4. What namespaces are necessary to create a localized application?
System.Globalization and System.Resources.

5. What is the smallest unit of execution in .NET?
an Assembly.

6. When should you call the garbage collector in .NET?
As a good rule, you should not call the garbage collector. However, you could call the garbage collector when you are done using a large object (or set of objects) to force the garbage collector to dispose of those very large objects from memory. However, this is usually not a good practice.

7. How do you convert a value-type to a reference-type?
Use Boxing.
8. What happens in memory when you Box and Unbox a value-type?
Boxing converts a value-type to a reference-type, thus storing the object on the heap. Unboxing converts a reference-type to a value-type, thus storing the value on the stack.
Interfaces vs Abstract Classes
feature interface abstract class
multiple inheritance A class may implement several interfaces. A class may extend only one abstract class.
default implementation An interface cannot provide any code at all, much less default code. An abstract class can provide complete code, default code, and/or just stubs that have to be overridden.
constants Static final constants only, can use them without qualification in classes that implement the interface. On the other paw, these unqualified names pollute the namespace. You can use them and it is not obvious where they are coming from since the qualification is optional. Both instance and static constants are possible. Both static and instance intialiser code are also possible to compute the constants.
third party convenience An interface implementation may be added to any existing third party class. A third party class must be rewritten to extend only from the abstract class.
is-a vs -able or can-do Interfaces are often used to describe the peripheral abilities of a class, not its central identity, e.g. an Automobile class might implement the Recyclable interface, which could apply to many otherwise totally unrelated objects. An abstract class defines the core identity of its descendants. If you defined a Dog abstract class then Damamation descendants are Dogs, they are not merely dogable. Implemented interfaces enumerate the general things a class can do, not the things a class is.
In a Java context, users should typically implement the Runnable interface rather than extending Thread, because they're not really interested in providing some new Thread functionality, they normally just want some code to have the capability of running independently. They want to create something that can be run in a thread, not a new kind of thread.The similar is-a vs has-a debate comes up when you decide to inherit or delegate.
multiple inheritance for further discussion of is-a vs has-a
plug-in You can write a new replacement module for an interface that contains not one stick of code in common with the existing implementations. When you implement the inteface, you start from scratch without any default implementation. You have to obtain your tools from other classes; nothing comes with the interface other than a few constants. This gives you freedom to implement a radically different internal design. You must use the abstract class as-is for the code base, with all its attendant baggage, good or bad. The abstract class author has imposed structure on you. Depending on the cleverness of the author of the abstract class, this may be good or bad.
homogeneity If all the various implementaions share is the method signatures, then an interface works best. If the various implementations are all of a kind and share a common status and behaviour, usually an abstract class works best. Another issue that's important is what I call "heterogeneous vs. homogeneous." If implementors/subclasses are homogeneous, tend towards an abstract base class. If they are heterogeneous, use an interface. (Now all I have to do is come up with a good definition of hetero/homo-geneous in this context.) If the various objects are all of-a-kind, and share a common state and behavior, then tend towards a common base class. If all they share is a set of method signatures, then tend towards an interface.
maintenance If your client code talks only in terms of an interface, you can easily change the concrete implementation behind it, using a factory method.
Just like an interface, if your client code talks only in terms of an abstract class, you can easily change the concrete implementation behind it, using a factory method.

speed Slow, requires extra indirection to find the corresponding method in the actual class. Modern JVMs are discovering ways to reduce this speed penalty. Fast
terseness The constant declarations in an interface are all presumed public static final, so you may leave that part out. You can't call any methods to compute the initial values of your constants. You need not declare individual methods of an interface abstract. They are all presumed so. You can put shared code into an abstract class, where you cannot into an interface. If interfaces want to share code, you will have to write other bubblegum to arrange that. You may use methods to compute the initial values of your constants and variables, both instance and static. You must declare all the individual methods of an abstract class abstract.
adding functionality If you add a new method to an interface, you must track down all implementations of that interface in the universe and provide them with a concrete implementation of that method. If you add a new method to an abstract class, you have the option of providing a default implementation of it. Then all existing code will continue to work without change.

Common Interview Questions
Q: Tell me about yourself.
(The interviewer is really saying "I want to hear you talk")
A: This is a commonly asked question designed to break the ice. Spend a maximum of five minutes to describe your qualifications, career history and your range of skills. Emphasise those skills that are relevant to the job on offer.
Q: What have been your achievements to date?
(The interviewer is saying, "Are you an achiever?")
A: Again this is a common question so be prepared. Select an achievement that is recent. Identify skills you used in the achievement and quantify the benefit.
Q: Are you happy with your career to date?
(The interviewer is really asking about your self-confidence, your career aspirations and whether you are a positive person)
A: The answer must be 'yes' but if you have hit a career plateau or you feel you are moving too slowly, then you must qualify the answer.
Q: Tell me the most difficult situation you have had to face and how you tackled it? (The interviewer is really trying to find out your definition of "difficult" and whether you can show a logical approach to problem solving)
A: Select a difficult work situation that was not caused by you. Explain how you defined the problem and what solution you applied to overcome the problem.

Q: What do you dislike about your current role?
(The interviewer is trying to find out whether the job on offer has responsibilities you will dislike)
A: Be careful with this one. Don't be too specific as you may draw attention to weaknesses. One approach is to choose a characteristic of your present company such as its size, its slow decision making process etc. Give your answer with the air of someone who takes problems and frustrations in your stride, as part of the job.

Q: What are your strengths?
(The interviewer wants a straightforward answer as to what you are good at and how it is going to add value)
A: This is one question you will certainly be asked, so there's no excuse for being unprepared. Concentrate on discussing your main strengths. List three or four explanations of how they could benefit the employer. Strengths to consider include technical proficiency; ability to learn quickly; determination to succeed; positive attitude; team focus and your ability to work autonomously.

Q: What are your greatest weaknesses?
(The interviewer is asking about your self-perception and self-awareness)
A: This is another standard question for which you can be well prepared. Don't say you don't have any. We all have weaknesses. Either use a professional weakness such as a lack of experience (not ability) on your part in one area that is not vital for the job, or use a personal weakness and show the steps that you have taken to combat it. An example would be," I'm not very good at delegating but I'm learning to pass work on to colleagues by sitting down on a weekly basis and splitting the workload".

Q: What kind of decision do you find most difficult?
(The interviewer is really saying, "I need someone who is strong and decisive but who has a human side")
A: Try to focus on decisions you have made without sufficient information. This will show your positive side. For example, "I like to make decisions based on sufficient information and having alternatives. When you have to make quick decisions you have to rely on "gut feeling" and experience.

Q: Why do you want to leave your current employer?
(The interviewer is trying to understand and evaluate your motives for moving)
A: This should be straightforward. State how you are looking for more challenge, responsibility, experience and a change of environment and explain why you feel you are no longer receiving these things from your current role. For example, " I have been with my company for four years and feel I have learnt as much about their x function as possible and there is no opportunity for a more senior role at present".
________________________________________
Other questions to consider
• How does your last/current job fit into your department and company? (Gives an idea of level of responsibility)
• How do you respond to working under pressure? (Meaning - can you?). Give examples.
• How have you coped when your work has been criticised? (Give an example including the outcome).
• How have you coped when you have had to face a conflict of interest at work? (Testing interpersonal skills, team and leadership opportunities).
• What are your preferred working conditions, working alone or in a group and why?
• How do you think you are going to fit in here especially as this organisation is very different to your current employer? (You may not be able to answer until you have established what your interviewer perceives as the differences).
• What are you looking for in a company?
• How do you measure your own performance?
• Which part of this role is least attractive to you?
• Why should I give this position to you instead of the other people on the shortlist? (Strengths).
• What would your previous employers say about you and what would they consider your weaknesses?
________________________________________
Interview Questions That You Can Use
Before your interview, prepare questions you want to ask the interviewer. 'Open' questions that begin with 'What?', 'How?', 'Where?', 'Will?' or 'Who?' should encourage your interviewer to talk and provide you with additional information.
We recommend that you consider some of the following questions:
• What will my responsibilities be?
• How has the position become vacant?
• How will you assess my performance?
• How does the role fit into the structure of the department?
• How does the department fit into the organisation as a whole?
• Who will I report to and are there persons reporting to me?
• Where does my line manager fit into the structure?
• What encouragement is given to undertake further training?
• Who are your customers?
• Where is the company going? Expansion plans?
• Where is the specific location of the position?
• Will the position entail travelling?
• How soon will you decide on the appointment?
• What is the next step?
Interview Questions .NET
1. What’s the implicit name of the parameter that gets passed into the class’ set method?
Value, and its datatype depends on whatever variable we’re changing.

2. How do you inherit from a class in C#?
Place a colon and then the name of the base class. Notice that it’s double colon in C++.

3. Does C# support multiple inheritance?
No, use interfaces instead.

4. When you inherit a protected class-level variable, who is it available to? Classes in the same namespace.

5. Are private class-level variables inherited?
Yes, but they are not accessible, so looking at it you can honestly say that they are not inherited. But they are.

6. Describe the accessibility modifier protected internal.
It’s available to derived classes and classes within the same Assembly (and naturally from the base class it’s declared in).

7. C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?
Two. Once you write at least one constructor, C# cancels the freebie constructor, and now you have to write one yourself, even if there’s no implementation in it.

8. What’s the top .NET class that everything is derived from?
System.Object.

9. How’s method overriding different from overloading?
When overriding, you change the method behavior for a derived class. Overloading simply involves having a method with the same name within the class.

10. What does the keyword virtual mean in the method definition?
The method can be over-ridden.

11. Can you declare the override method static while the original method is non-static?
No, you can’t, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.

12. Can you override private virtual methods?
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access.

13. Can you prevent your class from being inherited and becoming a base class for some other classes?
Yes, that’s what keyword sealed in the class definition is for. The developer trying to derive from your class will get a message: cannot inherit from Sealed class WhateverBaseClassName. It’s the same concept as final class in Java.


14. Can you allow class to be inherited, but prevent the method from being over-ridden?
Yes, just leave the class public and make the method sealed.

15. What’s an abstract class?
A class that cannot be instantiated. A concept in C++ known as pure virtual method. A class that must be inherited and have the methods over-ridden. Essentially, it’s a blueprint for a class without any implementation.

16. When do you absolutely have to declare a class as abstract (as opposed to free-willed educated choice or decision based on UML diagram)?
When at least one of the methods in the class is abstract. When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.

17. What’s an interface class?
It’s an abstract class with public abstract methods all of which must be implemented in the inherited classes.

18. Why can’t you specify the accessibility modifier for methods inside the interface?
They all must be public. Therefore, to prevent you from getting the false impression that you have any freedom of choice, you are not allowed to specify any accessibility, it’s public by default.

19. Can you inherit multiple interfaces?
Yes, why not.

20. And if they have conflicting method names?
It’s up to you to implement the method inside your own class, so implementation is left entirely up to you. This might cause a problem on a higher-level scale if similarly named methods from different interfaces expect different data, but as far as compiler cares you’re okay.

21. What’s the difference between an interface and abstract class?
In the interface all methods must be abstract; in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.

22. How can you overload a method?
Different parameter data types, different number of parameters, different order of parameters.

23. If a base class has a bunch of overloaded constructors, and an inherited class has another bunch of overloaded constructors, can you enforce a call from an inherited constructor to an arbitrary base constructor?
Yes, just place a colon, and then keyword base (parameter list to invoke the appropriate constructor) in the overloaded constructor definition inside the inherited class.

24. What’s the difference between System.String and System.StringBuilder classes?
System.String is immutable; System.StringBuilder was designed with the purpose of having a mutable string where a variety of operations can be performed.


25. What’s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each time it’s being operated on, a new instance is created.

26. Can you store multiple data types in System.Array?
No.

27. What’s the difference between the System.Array.CopyTo() and System.Array.Clone()?
The first one performs a deep copy of the array, the second one is shallow.

28. How can you sort the elements of the array in descending order?
By calling Sort() and then Reverse() methods.

29. What’s the .NET datatype that allows the retrieval of data by a unique key? HashTable.

30. What’s class SortedList underneath?
A sorted HashTable.

31. Will finally block get executed if the exception had not occurred?
Yes.

32. What’s the C# equivalent of C++ catch (…), which was a catch-all statement for any possible exception?
A catch block that catches the exception of type System.Exception. You can also omit the parameter data type in this case and just write catch {}.

33. Can multiple catch blocks be executed?
No, once the proper catch code fires off, the control is transferred to the finally block (if there are any), and then whatever follows the finally block.

34. Why is it a bad idea to throw your own exceptions?
Well, if at that point you know that an error has occurred, then why not write the proper code to handle that error instead of passing a new Exception object to the catch block? Throwing your own exceptions signifies some design flaws in the project.

35. What’s a delegate?
A delegate object encapsulates a reference to a method. In C++ they were referred to as function pointers.

36. What’s a multicast delegate?
It’s a delegate that points to and eventually fires off several methods.

37. How’s the DLL Hell problem solved in .NET?
Assembly versioning allows the application to specify not only the library it needs to run (which was available under Win32), but also the version of the assembly.

38. What are the ways to deploy an assembly?
An MSI installer, a CAB archive, and XCOPY command.

39. What’s a satellite assembly?
When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
40. What namespaces are necessary to create a localized application? System.Globalization, System.Resources.

41. What’s the difference between // comments, /* */ comments and /// comments?
Single-line, multi-line and XML documentation comments.

42. How do you generate documentation from the C# file commented properly with a command-line compiler?
Compile it with a /doc switch.

43. What’s the difference between and XML documentation tag? Single line code example and multiple-line code example.

44. Is XML case-sensitive?
Yes, so and are different elements.

45. What debugging tools come with the .NET SDK?
CorDBG – command-line debugger, and DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR. To use CorDbg, you must compile the original C# file using the /debug switch.

46. What does the This window show in the debugger?
It points to the object that’s pointed to by this reference. Object’s instance data is shown.

47. What does assert() do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.

48. What’s the difference between the Debug class and Trace class? Documentation looks the same.
Use Debug class for debug builds, use Trace class for both debug and release builds.

49. Why are there five tracing levels in System.Diagnostics.TraceSwitcher?
The tracing dumps can be quite verbose and for some applications that are constantly running you run the risk of overloading the machine and the hard drive there. Five levels range from None to Verbose, allowing to fine-tune the tracing activities.

50. Where is the output of TextWriterTraceListener redirected?
To the Console or a text file depending on the parameter passed to the constructor.

51. How do you debug an ASP.NET Web application? Attach the aspnet_wp.exe process to the DbgClr debugger.


52. What are three test cases you should go through in unit testing?
Positive test cases (correct data, correct output), negative test cases (broken or missing data, proper handling), exception test cases (exceptions are thrown and caught properly).

53. Can you change the value of a variable while debugging a C# application?
Yes, if you are debugging via Visual Studio.NET, just go to Immediate window.

54. Explain the three services model (three-tier application).
Presentation (UI), business (logic and underlying code) and data (from storage or other sources).

55. What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET?
SQLServer.NET data provider is high-speed and robust, but requires SQL Server license purchased from Microsoft. OLE-DB.NET is universal for accessing other sources, like Oracle, DB2, Microsoft Access and Informix, but it’s a .NET layer on top of OLE layer, so not the fastest thing in the world. ODBC.NET is a deprecated layer provided for backward compatibility to ODBC engines.

56. What’s the role of the DataReader class in ADO.NET connections?
It returns a read-only dataset from the data source when the command is executed.

57. What is the wildcard character in SQL? Let’s say you want to query database with LIKE for all employees whose name starts with La.
The wildcard character is %, the proper query with LIKE would involve ‘La%’.

58. Explain ACID rule of thumb for transactions.
Transaction must be Atomic (it is one unit of work and does not dependent on previous and following transactions), Consistent (data is either committed or roll back, no “in-between” case where something has been updated and something hasn’t), Isolated (no transaction sees the intermediate results of the current transaction), Durable (the values persist if the data had been committed even if the system crashes right after).

59. What connections does Microsoft SQL Server support? Windows Authentication (via Active Directory) and SQL Server authentication (via Microsoft SQL Server username and passwords).

60. Which one is trusted and which one is untrusted?
Windows Authentication is trusted because the username and password are checked with the Active Directory, the SQL Server authentication is untrusted, since SQL Server is the only verifier participating in the transaction.

61. Why would you use un-trusted verification?
Web Services might use it, as well as non-Windows applications.

62. What does the parameter Initial Catalog define inside Connection String? The database name to connect to.

63. What’s the data provider name to connect to Access database?
Microsoft.Access.

64. What does Dispose method do with the connection object?
Deletes it from the memory.

65. What is a pre-requisite for connection pooling?
Multiple processes must agree that they will share the same connection, where every parameter is the same, including the security settings.
------------------------ ------------------ -------------------------- ------------------ --------------
ASP.NET Interview Questions
This is a list of questions I have gathered and created over a period of time from my experience, many of which I felt where incomplete or simply wrong. I have finally taken the time to go through each question and correct them to the best of my ability. However, please feel free to post feedback to challenge, improve, or suggest new questions. I want to thank those of you that have contributed quality questions and corrections thus far.
There are some questions in this list that I do not consider to be good questions for an interview. However, they do exist on other lists available on the Internet so I felt compelled to keep them here for easy access.
1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.

2. What’s the difference between Response.Write() andResponse.Output.Write()?
Response.Output.Write() allows you to write formatted output.

3. What methods are fired during the page load?
Init() - when the page is instantiated
Load() - when the page is loaded into server memory
PreRender() - the brief moment before the page is displayed to the user as HTML
Unload() - when page finishes loading.

4. When during the page processing cycle is ViewState available?
After the Init() and before the Page_Load(), or OnLoad() for a control.

5. What namespace does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

6. Where do you store the information about the user’s locale?
System.Web.UI.Page.Culture

7. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
CodeBehind is relevant to Visual Studio.NET only.

8. What’s a bubbled event?
When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.

9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");

10. What data types do the RangeValidator control support?
Integer, String, and Date.

11. Explain the differences between Server-side and Client-side code?
Server-side code executes on the server. Client-side code executes in the client's browser.

12. What type of code (server or client) is found in a Code-Behind class?
The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.

13. Should user input data validation occur server-side or client-side? Why?
All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.

14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.

15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
Valid answers are:
• A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
• A DataSet is designed to work without any continuing connection to the original data source.
• Data in a DataSet is bulk-loaded, rather than being loaded on demand.
• There's no concept of cursor types in a DataSet.
• DataSets have no current record pointer You can use For Each loops to move through the data.
• You can store many edits in a DataSet, and write them to the original data source in a single operation.
• Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.

16. What is the Global.asax used for?
The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.

17. What are the Application_Start and Session_Start subroutines used for?
This is where you can set the specific variables for the Application and Session objects.

18. Can you explain what inheritance is and an example of when you might use it?
When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.

19. Whats an assembly?
Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN

20. Describe the difference between inline and code behind.
Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.

21. Explain what a diffgram is, and a good use for one?
The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.

22. Whats MSIL, and why should my developers need an appreciation of it if at all?
MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.

23. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
The Fill() method.

24. Can you edit data in the Repeater control?
No, it just reads the information from its data source.

25. Which template must you provide, in order to display data in a Repeater control?
ItemTemplate.

26. How can you provide an alternating color scheme in a Repeater control?
Use the AlternatingItemTemplate.

27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
You must set the DataSource property and call the DataBind method.

28. What base class do all Web Forms inherit from?
The Page class.

29. Name two properties common in every validation control?
ControlToValidate property and Text property.

30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
DataTextField property.

31. Which control would you use if you needed to make sure the values in two different controls matched?
CompareValidator control.

32. How many classes can a single .NET DLL contain?
It can contain many classes.

Web Service Questions
1. What is the transport protocol you use to call a Web service?
SOAP (Simple Object Access Protocol) is the preferred protocol.

2. True or False: A Web service can only be written in .NET?
False

3. What does WSDL stand for?
Web Services Description Language.

4. Where on the Internet would you look for Web services?
http://www.uddi.org

5. True or False: To test a Web service you must create a Windows application or Web application to consume this service?
False, the web service comes with a test page and it provides HTTP-GET method to test.


State Management Questions
1. What is ViewState?
ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.

2. What is the lifespan for items stored in ViewState?
Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).

3. What does the "EnableViewState" property do? Why would I want it on or off?
It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.

4. What are the different types of Session state management options available with ASP.NET?
ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.
HI … ALL OF MY ISS FRIENDS,
G O O D L U C K ! ! ! C H E E R S ! !