Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger

Search Your Question

Saturday, April 26, 2008

Can you name different software development life cycles ?

Major SDLC are - waterfall, fountain, spiral, build and fix, rapid prototyping, incremental, and synchronize and stabilize

What is Microsoft Analysis Service?

SQL Server 2005 Analysis Services provides a unified and integrated view of all your business data as the foundation for all of your traditional reporting, online analytical processing (OLAP) analysis, Key Performance Indicator (KPI) scorecards, and data mining.

For more Information see -

http://www.microsoft.com/sql/technologies/analysis/overview.mspx

Explain what is “AutoPostBack” feature in ASP.NET ?

AutoPostback specifies whether the Web Form is automatically submitted (as if any of the button-like controls were clicked) when the content of the control is changed.

Note that the control will "fire" a postback (if AutoPostback is set to True) only when the user leaves the control, NOT while editing the content (typing into the control).

Can you explain what is DCOM ?

Distributed Component Object Model (DCOM) is a set of Microsoft concepts and program interfaces in which client program objects can request services from server program objects on other computers in a network

What do you understand by Data mining and Data Warehousing?

Data mining (sometimes called data or knowledge discovery) is the process of analyzing data from different perspectives and summarizing it into useful information.

Data warehousing is defined as a process of centralized data management and retrieval. Data warehousing, like data mining, is a relatively new term although the concept itself has been around for years.

Data warehousing represents an ideal vision of maintaining a central repository of all organizational data. Centralization of data is needed to maximize user access and analysis.

How can we find out what the garbage collector is doing?

Lots of interesting statistics are exported from the .NET runtime via the '.NET CLR xxx' performance counters.

We can use Performance Monitor to view them.

How can we stop our code being reverse-engineered from IL?

We can buy an IL obfuscation tool. These tools work by 'optimising' the IL in such a way that reverse-engineering becomes much more difficult. Of course if we are writing web services then reverse-engineering is not a problem as clients do not have access to our IL.

How do you stop a running thread?

There are several options.
First, we can use our own communication mechanism to tell the ThreadStart method to finish. Alternatively the Thread class has in-built support for instructing the thread to stop.

The two principle methods are Thread.Interrupt() and Thread.Abort(). The former will cause a ThreadInterruptedException to be thrown on the thread when it next goes into a WaitJoinSleep state. In other words, Thread.Interrupt is a polite way of asking the thread to stop when it is no longer doing any useful work.

In contrast, Thread.Abort() throws a ThreadAbortException regardless of what the thread is doing. Furthermore, the ThreadAbortException cannot normally be caught (though the ThreadStart's finally method will be executed). Thread.Abort() is a heavy-handed mechanism which should not normally be required.

How does an AppDomain get created?

AppDomains are usually created by hosts. Examples of hosts are the Windows Shell, ASP.NET and IE. When you run a .NET application from the command-line, the host is the Shell. The Shell creates a new AppDomain for every application.

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.

Is COM+ dead? Is COM+ is not needed anymore?

Not immediately. The approach for .NET 1.0 was to provide access to the existing COM+ services (through an interop layer) rather than replace the services with native .NET ones. Various tools and attributes were provided to make this as painless as possible. Over time it is expected that interop will become more seamless - this may mean that some services become a core part of the CLR, and/or it may mean that some services will be rewritten as managed code which runs on top of the CLR.

Is DCOM dead? not needed anymore?

To a great extent yes for .NET developers. The .NET Framework has a new remoting model which is not based on DCOM. DCOM was pretty much dead anyway, once firewalls became widespread and Microsoft got SOAP fever. Of course DCOM will still be used in interop scenarios

Should you use ReaderWriterLock instead of Monitor.Enter/Exit?

Maybe, carefully.

ReaderWriterLock is used to allow multiple threads to read from a data source, while still granting exclusive access to a single writer thread. This makes sense for data access that is mostly read-only, but there are some caveats.

First, ReaderWriterLock is relatively poor performing compared to Monitor.Enter/Exit, which offsets some of the benefits.

Second, you need to be very sure that the data structures you are accessing fully support multithreaded read access.

Finally, there is apparently a bug in the v1.1 ReaderWriterLock that can cause starvation for writers when there are a large number of readers.

What are different types of caching in ASP.Net?

Caching is a technique widely used in computing to increase performance by keeping frequently accessed or expensive data in memory.

In context of ASP.Net web application, caching is used to retain the pages or data across HTTP requests and reuse them without the expense of recreating them.

ASP.NET has 3 kinds of caching strategies
1) Output Caching: Caches the dynamic output generated by a request. Some times it is useful to cache the output of a website even for a minute, which will result in a better performance.
2) Fragment Caching: Caches the portion of the page generated by the request.
3) Data Caching: Caches the objects programmatically.

What are the validation controls?

A set of server controls included with ASP.NET that test user input in HTML and Web server controls for programmer-defined requirements.

Validation controls perform input checking in server code. If the user is working with a browser that supports DHTML, the validation controls can also perform validation using client script.

What are user controls and custom controls?

Custom controls: A control authored by a user or a third-party software vendor that does not belong to the .NET Framework class library. This is a generic term that includes user controls. A custom server control is used in Web Forms (ASP.NET pages).


User Controls:In ASP.NET: A user-authored server control that enables an ASP.NET page to be re-used as a server control. An ASP.NET user control is authored declaratively and persisted as a text file with an .ascx extension. The ASP.NET page framework compiles a user control on the fly to a class that derives from the System.Web.UI.UserControl class.

What does aspnet_regiis -i do ?

Aspnet_regiis.exe is The ASP.NET IIS Registration tool allows an administrator or installation program to easily update the script maps for an ASP.NET application to point to the ASP.NET ISAPI version associated with the tool.

The tool can also be used to display the status of all installed versions of ASP. NET, register the ASP.NET version coupled with the tool, create client-script directories, and perform other configuration operations.

What is Regression Testing?

Regression testing is the practice of running tests for previously tested code following modification to ensure that faults have not been introduced or uncovered as a result of the changes made

What is the difference between an event and a delegate?

An event is just a wrapper for a multicast delegate. Adding a public event to a class is almost the same as adding a public multicast delegate field. In both cases, subscriber objects can register for notifications, and in both cases the publisher object can send notifications to the subscribers.

However, a public multicast delegate has the undesirable property that external objects can invoke the delegate, something we'd normally want to restrict to the publisher. Hence events - an event adds public methods to the containing class to add and remove receivers, but does not make the invocation mechanism public.

What is view state and use of it?

The current property settings of an ASP.NET page and those of any ASP.NET server controls contained within the page. ASP.NET can detect when a form is requested for the first time versus when the form is posted (sent to the server), which allows you to program accordingly.

What's a bubbled event?

When you have a complex control, likeDataGrid, 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.Suppose you want a certain ASP.NET function executed on MouseOver over a certain button.

Why do we get errors when we try to serialize a Hashtable?

XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.

Why is XmlSerializer so slow?

There is a once-per-process-per-type overhead with XmlSerializer. So the first time you serialize or deserialize an object of a given type in an application, there is a significant delay.

This normally doesn't matter, but it may mean, for example, that XmlSerializer is a poor choice for loading configuration settings during startup of a GUI application

How can I load the icons provided by .NET dynamically?

By using System.Drawing.SystemIcons class

for example: System.Drawing.SystemIcons.Warning produces an Icon with a warning sign in it.

In windows forms what class does Icon derive from?

Icon derives from System.Drawing namespace. It's not a Bitmap by default, and is treated separately by .NET.


However, you can use ToBitmap method to get a valid Bitmap object from a valid Icon object

How's anchoring different from docking in windows forms?

Anchoring treats the component as having the absolute size and adjusts its location relative to the parent form. Docking treats the component location as absolute and disregards the component size.

So if a status bar must always be at the bottom no matter what, use docking. If a button should be on the top right, but change its position with the form being resized, use anchoring.

Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio?

If we insert any code into InitializeComponent method the designer will through it away, because most of the code inside InitializeComponent is auto-generated.

Why is it not a good idea to insert code into InitializeComponent method when working with Visual Studio?

If we insert any code into InitializeComponent method the designer will through it away, because most of the code inside InitializeComponent is auto-generated.

What is ErrorProvider control? When would you use it?

ErrorProvider control is used in Windows Forms application. It is like Validation Control for ASP.NET pages.
ErrorProvider control is used to provide validations in Windows forms and display user friendly messages to the user if the validation fails.

Can you debug a Windows Service? How ?

Yes we can debug a Windows Service by attaching the WinDbg debugger to a service after the service starts.
This method is similar to the method that you can use to attach a debugger to a process and then debug a process.
Use the process ID of the process that hosts the service that you want to debug

How can a win service developed in .NET be installed or used in Win98?

Windows service cannot be installed on Win9x machines even though the .NET framework can be run and installed on win9x machine

What is a Windows Service and how does its lifecycle differ from a "standard" EXE?

Windows service is a application that runs in the background. It is equivalent to a NT service. The executable created is not a Windows application, and hence you can't just click and run it .
It needs to be installed as a service, VB.Net has a facility where we can add an installer to our program and then use a utility to install the service.
Where as this is not the case with standard exe

What does AspCompat="true" mean and when should it be used?

AspCompat is an aid in migrating ASP pages to ASPX pages. It defaults to false but should be set to true in any ASPX file that creates apartment-threaded COM objects--that is, COM objects registered ThreadingModel=Apartment.
That includes all COM objects written with Visual Basic 6.0. AspCompat should also be set to true (regardless of threading model) if the page creates COM ob
jects that access intrinsic ASP objects such as Request and Response.

The following directive sets AspCompat to true:
<%@ Page AspCompat="true" %>

Setting AspCompat to true does two things.

First, it makes intrinsic ASP objects available to the COM components by placing unmanaged wrappers around the equivalent ASP.NET objects.

Second, it improves the performance of calls that the page places to apartment- threaded COM objects by ensuring that the page (actually, the thread that processes the request for the page) and the COM objects it creates share an apartment.

Is it possible to prevent a browser from caching an ASPX page?

Yes. You have to call SetNoStore on the HttpCachePolicy object exposed through the Response object's Cache property,

example :

Response.Cache.SetNoStore ();
Response.Write (DateTime.Now.ToLongTimeString ());

SetNoStore works by returning a Cache-Control: private, no-store header in the HTTP response.

In this example, it prevents caching of a Web page that shows the current time.

Is it possible to prevent a browser from caching an ASPX page?

Yes. You have to call SetNoStore on the HttpCachePolicy object exposed through the Response object's Cache property,

example :

Response.Cache.SetNoStore ();
Response.Write (DateTime.Now.ToLongTimeString ());

SetNoStore works by returning a Cache-Control: private, no-store header in the HTTP response.

In this example, it prevents caching of a Web page that shows the current time.

What technology enables out-of-proc communication in .NET?

Most usually Remoting;.NET remoting enables client applications to use objects in other processes on the same computer or on any other computer available on its network.

What are some of the responsibilities of the CLR?

The CLR loads and verifies code, does garbage collection, protects applications from each other, enforces security, provides debugging and profiling services, supports versioning and deployment

Friday, April 25, 2008

What are some features of the CLR?

It has a language-neutral type system with support fo classes, inheritence, polymorphism, dynamic binding, memory management, garbage collection, exception handling, etc.

What are some features of the CLR?

It has a language-neutral type system with support fo classes, inheritence, polymorphism, dynamic binding, memory management, garbage collection, exception handling, etc.

What are namespaces used for in .NET?

They provide a convenient way to group logically related classes together. They also prevent name clashes where two or more classes have the same name, but reside in two different namespaces

How do class property members work in C#?

A property may have a get and/or a set associated with it. Within a set accessor block, C# automatically provides a variable called 'value' which holds the new value to which the property can be set.

A property with a get and set accessor for the int variable age would be defined as follows:

To set the value of age in object instance p to the new value of 34, :

public int Age

{
get { return age; }
set { age = value; }
}

What does a binding define in a WSDL document? What are some of the things that the SOAP binding defines?

A binding defines how to map between the abstract PortType and a real service format and protocol.SOAP binding defines the encoding style, the SOAPAction header, the namespace of the body (the targetURI), etc.

What are the main similarities and differences between WS-Inspection and UDDI?

Similarities:

They are both protocols designed to be used by clients to discover web services that can be invoked.

Differences:

WS-Inspection is site-centric. UDDI is not site-centric.

What information do you need to know in order to access a SOAP service?

Roughly the following are the most important to access a SOAP web service

  • URL of the host machine
  • The ID of the service to access
  • The name of the method you want to access
  • The parameters that the method takes, if any
  • The value of the SOAP action field(?)

True false questions - Set 1

These true false questions are very basic and most likely to be asked in a written examination rathar than in an interview.

A bank could provide a web service interface for downloading transaction information that can be used by financial software such as Quicken?
TRUE
All types must belong to a namespace?
TRUE
An assembly containing types in one language can be used by an application coded in another language?
TRUE
C# supports implementation inheritence using interfaces like in Java?
TRUE
C# supports mulitple inheritence?
FALSE
Deploying an application as a SOAP service usually requires making changes to the code?
FALSE
Each part of a message has a schema-defined type?
TRUE
Every C# program must contain at least one class?
TRUE
In C# A Struct can be nested in another struct? A Struct can inherit from another struct?
TRUE
In C# classes can be nested? Classes can inherit from other classes?
TRUE

True false questions - Set 2

These true false questions are very basic and most likely to be asked in a written examination rathar than in an interview.

In the WSDL specification Web service binding descriptions are extensions to the specification?
TRUE
Public assemblies are made to be used with more than one application?
TRUE
SOAP is based on XML?
TRUE
Structs are value types?
TRUE
Structs can contain methods?
TRUE
System.Text.RegularExpressions.Regex provides support for the same regular expressions as those in Perl 5.0?
TRUE
The functionality provided by a service can be exposed using another binding besides the SOAP binding?
TRUE
Under .NET everything is an object?
TRUE
Web services are end-user products?
FALSE
Web services can be used to develop prebuilt modules for developers?
TRUE

True false questions - Set 3

These true false questions are very basic and most likely to be asked in a written examination rathar than in an interview.


WSDL makes it possible to have multiple implementations of the same web service?
TRUE
.NET uses a virtual machine to execute programs?
FALSE
All .NET languages share common types?
TRUE
In .NET char and string types are 2-byte unicode?
TRUE
Ints longs and chars are value types?
TRUE
Most of the .NET primitive types are value types?
TRUE
MSIL is compiled before it is executed?
TRUE
Objects strings and arrays are reference types?
TRUE
Value types are stored on the stack at runtime?
TRUE
WSDL makes it possible for multiple Ports to share the same PortType?
TRUE
You can create your own value types?
TRUE

What are CAO's i.e. Client Activated Objects ?

Client-activated objects are objects whose lifetimes are controlled by the calling application domain, just as they would be if the object were local to the client. With client activation, a round trip to the server occurs when the client tries to create an instance of the server object, and the client proxy is created using an object reference (ObjRef) obtained on return from the creation of the remote object on the server.

Each time a client creates an instance of a client-activated type, that instance will service only that particular reference in that particular client until its lease expires and its memory is recycled. If a calling application domain creates two new instances of the remote type, each of the client references will invoke only the particular instance in the server application domain from which the reference was returned.

Can you configure a .NET Remoting object via XML file?

Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.

What does a Port define? What does the PortType define?

The Port defines the actual location (endpoint) of the available service.

The PortType defines the abstract interface offered by the service.
A PortType defines a set of Operations.

Thursday, April 24, 2008

What makes web services usable in almost any development scenario?

Web services are usable in almost any development scenario because they aren't tightly coupled to a specific technology for security, state management or transport.

When should a struct be used instead of a class?

They should be used for types that contain just a few data members..

How does the switch statement in C# differ from that of C/C++?

In C#, break statements are required for each case of the switch statement. C# does not allow fallthrough from one case to the next.

To allow multiple cases to execute the same statement blocks, use the 'goto case' or 'goto default' statements.
In C#, The default case is not required.

What are some similarities and differences between C# and VB.NET?

Both languages use the same .NET Framework Class Library and deal with the same .NET concepts including namespaces, classes, the CLR, etc.

Programs written in both languages are compiled into IL.

However C# is case sentive, VB.NET is not.

What is the main Difference between Managed code and unmanaged code ?

Code that runs undercommon language runtime. Managed code must supply the metadata necessary for the runtime to provide services such as memory management, cross-language integration, code access security, and automatic lifetime control of objects. All code based on Microsoft intermediate language (MSIL) executes as managed code.

Code that is created without regard for the conventions and requirements of the common language runtime. Unmanaged code executes in the common language runtime environment with minimal services (for example, no garbage collection, limited debugging etc).

In Dot Net What are different type of JIT ?

In .NET there are three types of JIT ( Just In Time ) compilers.

  • Pre-JIT (Compiles entire code into native code at one stretch)
  • Ecno-JIT (Compiles code part by part freeing when required)
  • Normal JIT (Compiles only that part of code when called and places in cache)

Is versioning applicable to private assemblies?

Yes It is, However, Since a private assembly can only be called by applications that reside in the same folder Version control in private assemblies is not necessary.

private assembly is only for one application and updating it won't unintentionally break other applications.

What is .Net Remoting

NET Remoting is a generic system for different applications to use to communicate with one another. .NET objects are exposed to remote processes, thus allowing interprocess communication. The applications can be located on the same computer, different computers on the same network, or even computers across separate networks.


.NET remoting provides an abstract approach to interprocess communication that separates the remotable object from a specific client or server application domain and from a specific mechanism of communication. As a result, it is flexible and easily customizable. You can replace one communication protocol with another, or one serialization format with another without recompiling the client or the server.

In addition, the remoting system assumes no particular application model. You can communicate from a Web application, a console application, a Windows Service – from almost anything you want to use. Remoting servers can also be any type of application domain. Any application can host remoting objects and provide its services to any client on its computer or network.

What was .net Framework 3.0 earlier known as?

.Net Framework 3.0 was earlier known as WinFX

What are the changes to the version of the .NET Framework 2.0 components included in the .NET Framework 3.0?

There are no changes to the version of the .NET Framework 2.0 components included in the .NET Framework 3.0. This means that the developers who use .NET today can use the skills they already have to start building .NET Framework 3.0 applications.

It also means that applications that run on the .NET Framework 2.0 today will continue to run on the .NET Framework 3.0 without any problem

Can DotNet Framework 3 be installed over Framework 2?

Yes.

When you install the .NET Framework 3.0, the installer will check to see whether you already have the .NET Framework 2.0 (released version) installed. If not, the .NET Framework 3.0 installer will install the .NET Framework 2.0 for you, and then install the new .NET Framework 3.0 components.

If you do have the .NET Framework 2.0 installed, the .NET Framework 3.0 installer will only install the new components of the .NET Framework 3.0.

What is the version of C# In .net Framework 3.0?

C# Version 2.0. Version 3.0 is still not included in Framework 3.0

What Operating system are supported by Framework 3.0?

The .NET Framework 3.0 will be available for and supported on Windows Vista, Windows Server 2003 (SP1), and Windows XP (SP2).

Also The .NET Framework 3.0 is a core component of the Windows Vista operating system, and is installed by default on Windows Vista

What are the 4 basic new technologies included in Framework 3.0?

Windows Presentation Foundation (WPF),
Windows Communication Foundation (WCF),
Windows Workflow Foundation (WF),
and
Windows CardSpace.

What is a workflow? How does Windows workflow foundation WWF helps in simplifying any process?

A workflow is a sequence of activities performed in a specific order.

WWF provides a common workflow technology for Windows, through which each step in a process can be explicitly defined (rather than intertwining its logic in code) and then executed by a workflow engine.

Each activity can be represented by a class, and can per se contain any work that the workflow's creator wants. Activities can thus also be reused across different workflows, making it easier to create automated solutions to new problems.

What are the components found in Windows workflow foundation?

WWF comprises of the following main components:

Activity: A unit of work.

Workflow: A group of activities that partially or completely implements a business process.

WF Designers: The graphical tools to create and modify workflows.

WF Base Activity Library: A fundamental group of activities (IfElse, While, Listen etc. design constructs) used to create workflows. Quite similar to the BizTalk Orchestration shapes.

WF Runtime Engine: A library that executes workflows.

Host process: A Windows application that hosts the Windows Workflow Foundation runtime engine, workflows, and runtime services for persisting a workflow's state, handling transactions, etc.

What tool is available for creating workflows in dot net 3?

WWF provides the Workflow Designer, a Visual Studio-hosted graphical tool for creating workflows. The activities in a workflow can be drawn using the Base Activity Library (BAL) provided with WWF.

What Improvements does WCF offers over its earlier counterparts?

A lot of communication approaches exist in the .NET Framework 2.0 such as ASP.NET Web Services, .NET Remoting, System.Messaging supporting queued messaging through MSMQ, Web Services Enhancements (WSE) - an extension to ASP.NET Web Services that supports WS-Security etc.

However, instead of requiring developers to use a different technology with a different application programming interface for each kind of communication, WCF provides a common approach and API.

What contemporary computing problems WCS solves?

WCS provides an entirely new approach to managing digital identities. It helps people keep track of their digital identities as distinct information cards.

If a Web site accepts WCS logins, users attempting to log in to that site will see a WCS selection. By choosing a card, users also choose a digital identity that will be used to access this site. Rather than remembering a plethora of usernames and passwords, users need only recognize the card they wish to use.

The identities represented by these cards are created by one or more identity providers. These identities will typically use stronger cryptographic mechanisms to allow users to prove their identity. With this provider, users can create their own identities that don't rely on passwords for authentication.

What are WCF features and what communication problems it solves?

WCF provides strong support for interoperable communication through SOAP. This includes support for several specifications, including WS-Security, WS-ReliableMessaging, and WS-AtomicTransaction. WCF doesn't itself require SOAP, so other approaches can also be used, including optimized binary protocol and queued messaging using MSMQ.

WCF also takes an explicit service-oriented approach to communication, and loosens some of the tight couplings that can exist in distributed object systems, making interaction less error-prone and easier to change.

Thus, WCF addresses a range of communication problems for applications. Three of its most important aspects that clearly stand out are:

  • Unification of Microsoft’s communication technologies.
  • Support for cross-vendor interoperability, including reliability, security, and transactions.
  • Rich support for service orientation development.

What is High assurance certificate?

High assurance certificate is like SSL certificats but unlike today's simple SSL certificates, acquiring this new kind of certificate involves a much more rigorous process, including stronger proof that the organization applying for it actually is who it claims to be.

A high-assurance certificate can also carry a company's logo and other information to help the user correctly determine whether a site using this certificate is legitimate.

What contemporary computing problems WPF solves?

User interfaces needs to display video, run animations, use 2/3D graphics, and work with different document formats. So far, all of these aspects of the user interface have been provided in different ways on Windows.

For example, a developer needs to use Windows Forms to build a Windows GUI, or HTML/ASPX/Applets/JavaScript etc. to build a web interface, Windows Media Player or software such as Adobe's Flash Player for displaying video etc. The challenge for developers is to build a coherent user interface for different kinds of clients using diverse technologies isn't a simple job.

A primary goal of WPF is to address this challenge! By offering a consistent platform for these entire user interface aspects, WPF makes life simpler for developers. By providing a common foundation for desktop clients and browser clients, WPF makes it easier to build applications.

What is XAML ?

WPF relies on the eXtensible Application Markup Language (XAML). An XML-based language, XAML allows specifying a user interface declaratively rather than in code. This makes it much easier for user interface design tools like MS Expression Blend to generate and work with an interface specification based on the visual representation created by a designer.

Designers will be able to use such tools to create the look of an interface and then have a XAML definition of that interface generated for them. The developer imports this definition into Visual Studio, then creates the logic the interface requires.

What is XBAP?

XAML browser application (XBAP) can be used to create a remote client that runs inside a Web browser. Built on the same foundation as a stand-alone WPF application, an XBAP allows presenting the same style of user interface within a downloadable browser application.

The best part is that the same code can potentially be used for both kinds of applications, which means that developers no longer need different skill sets for desktop and browser clients.

The downloaded XBAP from the Internet runs in a secure sandbox (like Java applets), and thus it limits what the downloaded application can do.

What is a service contract ( In WCF) ?

In every service oriented architecture, services share schemas and contracts, not classes and types. What this means is that you don't share class definitions neither any implementation details about your service to consumers.

Everything your consumer has to know is your service interface, and how to talk to it. In order to know this, both parts (service and consumer) have to share something that is called a Contract.

In WCF, there are 3 kinds of contracts: Service Contract, Data Contract and Message Contract.

A Service Contract describes what the service can do. It defines some properties about the service, and a set of actions called Operation Contracts. Operation Contracts are equivalent to web methods in ASMX technology

In terms of WCF, What is a message?

A message is a self-contained unit of data that may consist of several parts, including a body and headers.

In terms of WCF, What is a service?

A service is a construct that exposes one or more endpoints, with each endpoint exposing one or more service operations.

In terms of WCF, What is an endpoint?

An endpoint is a construct at which messages are sent or received (or both). It comprises a location (an address) that defines where messages can be sent, a specification of the communication mechanism (a binding) that described how messages should be sent, and a definition for a set of messages that can be sent or received (or both) at that location (a service contract) that describes what message can be sent.

An WCF service is exposed to the world as a collection of endpoints.

In terms of WCF, What is an application endpoint?

An endpoint exposed by the application and that corresponds to a service contract implemented by the application.

In terms of WCF, What is an infrastructure endpoint?

An endpoint that is exposed by the infrastructure to facilitate functionality that is needed or provided by the service that does not relate to a service contract.

For example, a service might have an infrastructure endpoint that provides metadata information.

In terms of WCF, What is an address?

An address specifies the location where messages are received. It is specified as a Uniform Resource Identifier (URI).

The schema part of the URI names the transport mechanism to be used to reach the address, such as "HTTP" and "TCP", and the hierarchical part of the URI contains a unique location whose format is dependent on the transport mechanism.

In terms of WCF, What is binding?

A binding defines how an endpoint communicates to the world. It is constructed of a set of components called binding elements that "stack" one on top of the other to create the communication infrastructure.

At the very least, a binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary). A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint.

What is a message contract?

A message contact describes the format of a message. For example, it declares whether message elements should go in headers versus the body, what level of security should be applied to what elements of the message, and so on.

IN WCF, what do you understand by metadata of a service?

The metadata of a service describes the characteristics of the service that an external entity needs to understand to communicate with the service.

Metadata can be consumed by the Service Model Metadata Utility Tool (Svcutil.exe) to generate a WCF client and accompanying configuration that a client application can use to interact with the service.

The metadata exposed by the service includes XML schema documents, which define the data contract of the service, and WSDL documents, which describe the methods of the service.

What are activities in Windows Workflow Foundation?

Activities are the elemental unit of a workflow. They are added to a workflow programmatically in a manner similar to adding XML DOM child nodes to a root node. When all the activities in a given flow path are finished running, the workflow instance is completed.

An activity can perform a single action, such as writing a value to a database, or it can be a composite activity and consist of a set of activities. Activities have two types of behavior: runtime and design time.

The runtime behavior specifies the actions upon execution. The design time behavior controls the appearance of the activity and its interaction while being displayed within the designer.

What do you mean by Code Refactoring?

Its a feature of Visual Web Express & Visual Studio 2005. Code Refactoring Code Refactoring enables you to easily and systematically make changes to your code. Code Refactoring is supported everywhere that you can

write code including both code-behind and single-file ASP.NET pages. For example, you can use Code Refactoring to automatically promote a public field to a full property.

What is ASP.Net Web Matrix?

ASP.Net Web Matrix is a free ASP.NET development environment from Microsoft. As well as a GUI development environment, download includes simple web server that can be used instead of IIS to host ASP.NET apps. This opens up ASP.NET development to users of Windows XP Home Edition, which cannot run IIS.

What do you mean by shipping in terms of sql server ?

In Log Shipping the transactional log file from one server is automatically updated in backup database on the other server and in the case when one server fails the other server will have the same DB and we can use this as the DDR(disaster recovery) plan.

What is 'Write-ahead log' in Sql Server 2000 ?

Before understanding it we must have an idea about transaction log files. These files are files which holds data for change in database .
Now we explain when we are doing some Sql Server 2000 query or any Sql query like Sql insert query,delete sql query,update sql query and change the data in sql server database it cannot change the database directly to table .Sql server extracts the data that is modified by sql server 2000 query or by sql query and places it in
memory.

Once data is stores in memory user can make changes to that a log file is gernated this log file is gernated in every five mintues of transaction is done. After this sql server writes changes to database with the help of transaction log files. This is called Write-ahead log.

What is DOM?

DOM(Document Object Model) is a W3C specification that defines a standard programming API to build, navigate and update XML documents. It is a "tree-structure-based" interface. As per the DOM specification, the XML parsers (such as MSXML or Xerces), load the entire XML document into memory, before it can be processed.

XPath is used to navigate randomly in the document, and various DOM methods are used to create and update (add elements, delete elements, add/remove attributes, etc.) the XML documents.

What is XPATH?

XML Path Language is a W3C specification that defines syntax for addressing parts of XML document. XML document is considered as a logical tree structure, and syntax based on this consideration is used to address elements and attributes at any level in the XML document.

For example, considering the XML document described above in answer to question 2, /abc:Employees/abc:Emp/@EmpID XPath expression can be used to access the EmpID attribute under the Emp element under the Employees document element.

XPath is used in various other specifications such as XSLT.

What is the difference between abstract class and an interface?

An abstract class and Interface both have method only but not have body of method.The difference between Abstract class and An Interface is that if u call Abstract class then u have to call all method of that particular Abstract class but if u call an Interface then it is not necessary that u call all method of that particular interface.Method Over Loading:-Return type, Parameter type, parameter and body of method number may be different.Method Overriding:- Return type, Parameter type, Parameter Number all must be same . Only body of method can change.

Note : This is one of the most commonly asked question in Interviews

What is a Satellite Assembly ?

This assembly is used to get language specific resources for an application.These language-specific assemblies work in side-by-side execution because the application has a separate product ID for each language and installs satellite assemblies in a language-specific subdirectory for each language.

What is late binding ?

When code interacts with an object dynamically at runtime .because our code literally doesnot care what type of object it is interacting and with the methods thats are supported by object and with the methods thats are supported by object .The type of object is not known by the IDE or compiler ,no Intellisense nor
compile-time syntax checking is possible but we get unprecedented flexibilty in exchange.if we enable strict type checking by using option strict on at the top of our code modules ,then IDE and compiler will enforce early binding behaviour .By default Late binding is done.

What do you understand by the term "immutable"?

Immutable means you can't change the currrent data,but if you perform some operation on that data, a new copy is created. The operation doesn't change the data itself.

For example let's say you have a string object having "hello" value. Now if you say
temp = temp + "new value" new object is created, and values is saved in that. The temp object is immutable, can't be changed. An object qualifies as being called immutable if its value cannot be modified once it has been created.

For example, methods that appear to modify a String actually return a new String containing the modification. Developers are modifying strings all the time in their code. This may appear to the developer as mutable - but it is not.

What actually happens is your string variable/object has been changed to reference a new string value containing the results of your new string value. For this very reason .NET has the System.Text.StringBuilder class.

If you find it necessary to modify the actual contents of a string-like object heavily, such as in a for or foreach loop, use the System.Text.StringBuilder class.

enforce a call from an inherited constructor to an arbitrary base constructor?

Q) 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.

How do you make sure that your code runs when the security system is stopping it?

Security exceptions occur when code attempts to perform actions for which it has not been granted permission. Permissions are granted based on what is known about code; especially its location. For example, code run from the Internet is given fewer permissions than that run from the local machine because experience has proven that it is generally less reliable.

So, to allow code to run that is failing due to security exceptions, you must increase the permissions granted to it. One simple way to do so is to move the code to a more trusted location (such as the local file system). But this won't work in all cases (web applications are a good example, and intranet applications on a corporate network are another).

So, instead of changing the code's location, you can also change security policy to grant more permissions to that location. This is done using either the .NET Framework Configuration tool or the code access security policy utility (caspol.exe).

If you are the code's developer or publisher, you may also digitally sign it and then modify security policy to grant more permissions to code bearing that signature. When taking any of these actions, however, remember that code is given fewer permissions because it is not from an identifiably trustworthy source—before you move code to your local machine or change security policy, you should be sure that you trust the code to not perform malicious or damaging actions.

Why does code get a security exception when its run from a network shared drive?

Default security policy gives only a restricted set of permissions to code that comes from the local intranet zone. This zone is defined by the Internet Explorer security settings, and should be configured to match the local network within an enterprise. Since files named by UNC or by a mapped drive (such as with the NET USE command) are being sent over this local network, they too are in the local intranet zone.

The default is set for the worst case of an unsecured intranet. If your intranet is more secure you can modify security policy (with the .NET Framework Configuration tool or the CASPol tool) to grant more permissions to the local intranet, or to portions of it (such as specific machine share names).

Can you use the Win32 API from a .NET Framework program? How?

Yes. Using platform invoke, .NET Framework programs can access native code libraries by means of static DLL entry points.


Here is an example of C# calling the Win32 MessageBox function:

using System;
using System.Runtime.InteropServices;

class MainApp
{
[DllImport("user32.dll", EntryPoint="MessageBox")]
public static extern int MessageBox(int hWnd, String strMessage, String strCaption, uint uiType);

public static void Main()
{
MessageBox( 0, "Hello, this is PInvoke in operation!", ".NET", 0 );
}
}

How do in-process and cross-process communication work in the Common Language Runtime?

There are two aspects to in-process communication: between contexts within a single application domain, or across application domains. Between contexts in the same application domain, proxies are used as an interception mechanism. No marshaling/serialization is involved. When crossing application domains, we do marshaling/serialization using the runtime binary protocol.
Cross-process communication uses a pluggable channel and formatter protocol, each suited to a specific purpose.

· If the developer specifies an endpoint using the tool soapsuds.exe to generate a metadata proxy, HTTP channel with SOAP formatter is the default.

· If a developer is doing explicit remoting in the managed world, it is necessary to be explicit about what channel and formatter to use. This may be expressed administratively, through configuration files, or with API calls to load specific channels. Options are:
HTTP channel w/ SOAP formatter (HTTP works well on the Internet, or anytime traffic must travel through firewalls) TCP channel w/ binary formatter (TCP is a higher performance option for local-area networks (LANs))

When making transitions between managed and unmanaged code, the COM infrastructure (specifically, DCOM) is used for remoting. In interim releases of the CLR, this applies also to serviced components (components that use COM+ services). Upon final release, it should be possible to configure any remotable component.Distributed garbage collection of objects is managed by a system called "leased based lifetime."

Each object has a lease time, and when that time expires, the object is disconnected from the remoting infrastructure of the CLR. Objects have a default renew time-the lease is renewed when a successful call is made from the client to the object. The client can also explicitly renew the lease.

Can you avoid using the garbage collected heap?

All languages that target the runtime allow you to allocate class objects from the garbage-collected heap. This brings benefits in terms of fast allocation, and avoids the need for programmers to work out when they should explicitly 'free' each object.

The CLR also provides what are called ValueTypes—these are like classes, except that ValueType objects are allocated on the runtime stack (rather than the heap), and therefore reclaimed automatically when your code exits the procedure in which they are defined. This is how "structs" in C# operate.

Managed Extensions to C++ lets you choose where class objects are allocated. If declared as managed Classes, with the __gc keyword, then they are allocated from the garbage-collected heap. If they don't include the __gc keyword, they behave like regular C++ objects, allocated from the C++ heap, and freed explicitly with the "free" method.

Tuesday, April 22, 2008

You've written an assembly that you want to use in more than one application. Where deploy it?and how you will

Assemblies that are to be used by multiple applications (for example, shared assemblies) are deployed to the global assembly cache. In the prerelease and Beta builds, use the /i option to the GACUtil SDK tool to install an assembly into the cache:


gacutil /i myDll.dll

Windows Installer 2.0, which ships with Windows XP and Visual Studio .NET will be able to install assemblies into the global assembly cache.

When will you use web services and when .Net remoting with HTTP and SOAP?

When making this decision we will keep a couple factors in mind. These are:

1. Development time – Developing a web service is fast and easy, , write your function, done! Remoting is more involved, and takes more time.

2. Where and who is the client – Even though we can do remoting over HTTP using SOAP, our client won’t have the benefit of a WSDL file. If we expect our components will be consumed by third parties across the web, we will use web services.

3. The level of flexibility needed – There is a constant trade off between ease of programming and flexibility. This is the case here too. Although web services are highly configurable, remoting allows you to customize the underpinnings to no end.

What are Delegates? Give a short answer.

Delegates are just like function pointers in C++, except that they are much safer to use due to their type safety. A delegate defines a function without implementing it and another class then provides the implementation. Events in C# are based on delegates, with the originator defining one or more callback functions.

How can you save the desired properties of Windows Forms application?

config files in .NET are supported through the API to allow storing and retrieving information. They are nothing more than simple XML files, sort of like what .ini files were before for Win32 apps.

How do you retrieve the customized properties of a .NET application from XML .config file?

Initialize an instance of AppSettingsReader class. Call the GetValue method of AppSettingsReader class, passing in the name of the property and the type expected. Assign the result to the appropriate variable.

My progress bar freezes up and dialog window shows blank, when an intensive background process takes over

Yes, you should’ve multi-threaded your GUI, with taskbar and main form being one thread, and the background process being the other.

or Application.DoEvents can be used also

What’s the difference between WindowsDefaultLocation and WindowsDefaultBounds?

WindowsDefaultLocation tells the form to start up at a location selected by OS, but with internally specified size. WindowsDefaultBounds delegates both size and starting position choices to the OS.

How would you create a non-rectangular window, let’s say an ellipse?

Create a rectangular form, set the TransparencyKey property to the same value as BackColor, which will effectively make the background of the form transparent. Then set the FormBorderStyle to FormBorderStyle.None, which will remove the contour and contents of the form.

Can you create a native Image of ASP.NET assembly ... does this work ... is it possible ?

Native Image generator creates a local image of an .NET Assembly and installs that image in the native cache on the local machine. But when you create a Native Image of an ASP.NET assembly the .NET Runtime ignores that assembly and reverts back to JIT.

This is because CLR cannot load native images in a shared application domain and all ASP.NET applications run in a shared application domain. Hence although the native image of the assembly will be created it will not be installed in the image cache

Must prepare questions before any interview

A technical interview is not always technical, there are a lot of questions you should prepare which can reflect your aptitude towards you work, and sometimes your problem solving and general intelligence.

Here are some sample Questions which you must prepare when going for an Interview ::

1) How do you try to make your programs easier to debug, maintain, and modify?
2) How do you decide upon and describe the architecture for a large program?
3) What publications do you read?
4) What news groups do you read?
5) How do maintain and improve your skill level?
6) How do you evalute the solutions to your solution? How do you know if they are good or bad?
7) Do you often make mistakes? If so, tell me one you particularly remember.
8) According to you, what are the keys to project success?
9) What is your ideal programming process? Don't give me what you have done before. What is your ideal?
10) What is your favorite web site? Why? How can you improve it?
11) Explain the Internet to your grandparents?
12) Explain a database to a young child?
13) Steve Jobs calls and asks you to improve the iPod. How would you go about it?
14) Why are manhole covers round?
15) What was your greatest development challenge?
16) What technology did you learn in the last six months and why?
17) Draw the architechtural diagram of the past project you were in?

There are a lot of other questions which involves puzzles, lateral thinking and general intelligence. There is no one resource to practice these questions, puzzle books, newspapers and normal day to day resources contains these ..

Basic interview questions with answers - 1

Here is a list of most common Interview Question asked in a job interview. Interviewer ask these question generally to gauge your communication skills, to meke yourself comfortable or even to test your clarity and wittiness in answering questions :

1.Please tell me something about yourself

One of the very basic things that any company would ask a job applicant is her or his personal information. The main problem in this question is the start. With what information you should start to tell about yourself. One possible strategy is to ask the interviewer : So what should I start with ? Education, Family or experience ?

2. Why are you leaving your presnet job?

Answer this question truthfully but be careful not to badmouth your superiors or co-workers. Do not say negative things about the management of your previous company. You can state that you left your previous company in hope for a better career opportunity.

3. What experience do you have in this field?
Talk about your specific experiences that relate to the work you are applying for. Let them know the activities and contributions that you have done for your chosen industry.

4. Do you consider yourself successful?

Answer this question positively. Stay humble. Let them know that you set your own personal goals and reaching these goals is what makes you a successful person.

5. What do you know about this organization?

Your answer to this question should be backed up with basic research. You should know the latest news, issues and updates about the company you are applying to so that they would get the impression that you are indeed very interested in becoming part of their organization.

6. What have you done to improve your knowledge / skills in the last year?

Share some activities that you have done in the past that relates to the job you are applying for. If you have been to seminars and other self-improvement activities, share these experiences as well.

7. Are you applying for other jobs?

Keep your answer to this question quick and honest.

8. Why do you want to work for this organization?

This is a question you need to dwell on. You should come out sincere. Talk about your goals as a career person and how much you think the organization can help you in achieving your goals.

9. What kind of salary do you need?

This is actually a tricky question. Do not give a quick answer and give a figure right away. You can ask something like “What is the salary range for this job?” Most interviewers might just answer your question. If not, tell them that your rate depends on the nature of the job. This is the right time when you can give an estimate figure of how much you wanted your salary to be. Give a wide range.

10. Are you a team player?

Say yes. It would also be a good idea to state some situations where you have showed that you are indeed a team player. Let them know that they you can work with other people for the betterment of the company.

11. How long would you expect to work for us if hired?

Do not give out a specific length of time. Say something like, “I’d like to stay with this company for a long time”. Or something like “As long as the company feel that I am giving them good service”.

12. Have you ever had to fire anyone? How did you feel about that?

Answer this question honestly. You should convey the idea that you know how that you should put the company on top of your priority list than personal favors.

13. What is your philosophy towards work?

You should keep your answer to this question short and precise. Convey that you always put your work first. Let them know how your work philosophy can help their organization improve.

14. Have you ever been asked to leave a position?

Answer this question truthfully. Do not explain why you were asked to leave unless they questioned you about that. Be brief and honest. Again, do not talk about negative things about your previous company, superiors or co-workers.

15. Why should we hire you?


In answering this question, state what you have to offer to the company. Show them that you can be a real asset to them. It is not a good idea to compare yourself to other applicants who are vying for the same position.

Basic interview questions with answers - 2

1. What is your greatest strength?

You can say that your strengths are your skills, your ability to solve problems and how you prioritize your work. It would be impressive to say that you can work under pressure and you have the uncanny ability to focus.

2. Why do you think you would do well at this job?

Answer this in a positive manner. State the reason why you think you would be a good contender for the job – be it your skills, talents, past experience and your keen interest in your chosen industry.

3. What kind of person would you refuse to work with?

Give out an honest answer but give them the impression that you are a team player and can work with any type of person.

4. What is more important to you: the money or the work?

Money is a necessity but work is more important. The achievement at work cannot be compared to any amount of compensation.

5. Tell me about your ability to work under pressure.

This question is best answered with an example. Share a specific situation where you think you handled work under pressure quite well.

6. Are you willing to work overtime? Nights? Weekends?

It would be a good idea to say yes. But if you are not up to it, then say no. Be honest with your answer.

7. Describe your management style.

Do away with labeling your management style. Let them know that you have a situational style of management where you handle a situation differently each time and that you always weight your decision’s advantages and disadvantages before giving them out.

8. Do you have any blind spots?

A trick question yet again. If you tell them that you know what your blind spots are, they are no longer blind spots. Allow them to discover your areas of concern and do not give it to them.

9. How do you propose to compensate for your lack of experience?


If you have previous experiences that relates to the job, restate them. If you have none, then mention that you are a quick learner and a hard worker.

10. What qualities do you look for in a boss?


Keep your answer positive. State generic traits like you wanted a boss who is organized, dedicated, easy to communicate with and other positive characteristics along that line.

Can you change the value of a variable while debugging a C# application?

Yes, but not directly. You can change the value of variables by using the command window.

Type IMMED in the command window prompt to switch to immediate mode which will get rid of the “>”. To manipulate a variable in the command window, type strCustomerName.Value = “abc” or txtComments.innerText = “abc” and it will override the old value in strCustomerName with the new value.

Does Dispose method deletes the connection object from the memory?

No, it doesn’t delete it from memory, it closes any resources (e.g. returns the underlying database connection to the connection pool).
The garbage collector actually will delete the object from memory at some undefined point in the future.

What is the difference between an ARRAY and a LIST?

Three main differences ::

Array is collection of homogeneous elements.
List is collection of heterogeneous elements.

For Array memory allocated is static and continuous.
For List memory allocated is dynamic and Random.

Array: User need not have to keep in track of next memory allocation.
List: User has to keep in Track of next location where memory is allocated.

What is SCM, What does it do?

SCM is Windows Service Control Manager. Its responsibilities are as follows:

Accepts requests to install and uninstall Windows services from the Windows service database.
To start Windows services either on system startup or requested by the user.
To enumerate installed Windows services.
To maintain status information for currently running Windows services.

Give one basic difference between windows service and windows forms application?

A Windows service typically does not have a user interface.

What are Attributes?

Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Predefined attributes such as AssemblyVersion, which already exist and are accessed through the Runtime Classes; and custom attributes, which you write yourself by extending the System.Attribute class

Can you tell us briefly what is the difference between "remoting" and "webservices"?

The Web services technology enables cross-platform integration by using HTTP, XML and SOAP for communication thereby enabling true business-to-business application integrations across firewalls. Because Web services rely on industry standards to expose application functionality on the Internet, they are independent of programming language, platform and device.

Remoting is a technology that allows programs and software components to interact across application domains, processes, and machine boundaries. This enables your applications to take advantage of remote resources in a networked environment.

What is the relation between Dynamics and .NET? Can we develope dynamics based applications in .NET?

Dyanmics is Microsoft's ERP - like system which is based on .Net technology. So any application we develop in Dynamics will be using .Net. We have to probably use Biztalk for talking to another application from Dynamics or make a custom adapter for communication. But everything is .Net based.

What are the advantages and disadvantages of Server.Transfer over Response.Redirect ?

Response.Redirect simply sends a message to the browser, telling it to move to another page. However, the statement Server.Transfer has a number of distinct advantages and disadvantages:

1- Server.Transfer conserves server resources.
2- It works in the web server, not in the user browser. So, it transfers the request and makes your applications run faster.
3- You cant use Server.Transfer to send the user to an external site.
4- Server.Transfer maintains the original URL in the browser. (Can be confuse to debug)
5- The Server.Transfer method also has a second parameter—"preserveForm".

If you set this to True, using a statement such as Server.Transfer("Test2.aspx", True), the existing query string and any form variables will still be available to the page you are transferring to

How can you write javascript value in codebehind?

Correct Method :

ClientScript.RegisterStartupScript(this.GetType(),"OpenCv", jscode);

"jscode" is a string containig the javascript code .

Core programming Questions-1

These questions are generally asked in positions where hard core programming skills are required.
The fact to remember is that a language ( C++, C#, Java etc ) and its syntax can be learnt rapidly but good programming skills and understanding and ability to create alogrithms is a base requirement.
This is why interviews for programming / coding positions in companies like Microsoft, Google, IBM etc are not language or technology based but demands core skills.

Here are some questions which were asked in these companies in recent times ( from input of hundreds of candidates attending these interviews) :



What's the difference between a linked list and an array?
Implement a linked list. Why did you pick the method you did?
Implement an algorithm to sort a linked list. Why did you pick the method you did?
Describe advantages and disadvantages of the various stock sorting algorithms.
Implement an algorithm to reverse a linked list. Now do it without recursion.
Implement an algorithm to insert a node into a circular linked list without traversing it.
Implement an algorithm to sort an array. Why did you pick the method you did?
Implement an algorithm to do wild card string matching.
Implement strstr()

Next : part2, part3, part4

Core programming Questions-2

continuing from part1

1) Reverse a string. Optimize for speed. Optimize for space.
2) Reverse the words in a sentence, i.e. "I am Christina" becomes "Christina am I" Optimize for speed. Optimize for space.
3) Find a substring. Optimize for speed. Optimize for space.
4) Compare two strings using O(n) time with constant space.
5) Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of the array only once. Describe an algorithm to find the repeated number. If you used auxiliary storage in your algorithm, can you find an algorithm that does not require it?
6) Count the number of set bits in a number. Now optimize for speed. Now optimize for size.

Next : part3, part4

Core programming Questions-3

continuing from part1, part2


1) Multiple by 8 without using multiplication or addition. Now do the same with 7.
2) Write routines to read and write a bounded buffer.
3) Write routines to manage a heap using an existing array.
4) Implement an algorithm to take an array and return one with only unique elements in it.
5) Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Now speed it up. 6) Implement an algorithm to print out all files below a given root node.
7) How would you find a cycle in a linked list?
8) Give me an algorithm to shuffle a deck of cards, given that the cards are stored in an array of ints.

next >>

Core programming Questions-4

continuing from part1, part2, part3

1) Design the implementation and thread models for I/O completion ports. Remember to take into account multi-processor machines.
2) Write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value.
3) Write a function to print all of the permutations of a string.
4) Implement malloc.
5) Write a function to print the Fibonacci numbers.
6) Write a function to copy two strings, A and B. The last few bytes of string A overlap the first few bytes of string B.
7) How would you write qsort?
8) How would you print out the data in a binary tree, level by level, starting at the top?

What is LINQ? How its related to VS2008?

LINQ is a series of language extensions that supports data querying in a type-safe way; it will be released with the next version Visual Studio, VS2008, code-named "Orcas."

The data to be queried can take the form of XML (LINQ to XML), databases (LINQ-enabled ADO.NET, which includes LINQ to SQL, LINQ to Dataset and LINQ to Entities), objects (LINQ to Objects) etc

What are Lambda Expressions?

With Lambda expressions you can treat code as data. In C# 1.0 / 2.0, it is common to pass strings, integers, reference types, and so on to methods so that the methods can act on those values.

Anonymous methods and lambda expressions extend the range of the values to include code blocks. This concept is common in functional programming.

Entry level questions

These are some must know questions if you are going for a basic entry level coder position in .Net. In this case the interviewer will try to assess your basic and conceptual knowledge about the language and the framework. Most of the questions may be just asking for a definition.

Your ability to show your basic knowledge in addition to your ability to learn new things are the key to success. Do not be hesitant to say You don't know about something, instead use phrases like, "I have not dealt with this topic yet in my past projects / college studies etc however given time I can surely gain knowledge about this"

or

Refer to a similar area and tell the interviewer that in place of area X ( say remoting ) you are more comfortable in questions related to area Y ( say web services)

Some example Questions :

1. Explain the differences between Server-side and Client-side code?
Server side code basically gets executed on the server (for example on a webserver) per request/call basis, while client side code gets executed and rendered on the client side (for example web browser as a platform) per response basis.

2. What type of code (server or client) is found in a Code-Behind class?
In the Code-behind class the server side code resides, and it generates the responses to the client appropriately while it gets called or requested.

3. What does the "EnableViewState" property do? Why would I want it on or off?
EnableViewState stores the current state of the page and the objects in it like text boxes, buttons, tables etc. So this helps not losing the state between the round trips between client and server. But this is a very expensive on browser. It delays rendering on the browser, so you should enable it only for the important fields/objects.

4. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
Server.Transfer transfers the currnet context of the page to the next page and also avoids double roundtrips. Where as Response.Redirect could only pass querystring and also requires roundtrip.

5. How does VB.NET/C# achieve polymorphism?
Polymorphism is achieved through virtual, overloaded, overridden methods in C# and VB.NET.

6. Whats an assembly
An assembly is the primary building block of .NET. It's a reusable, self-describing,versionable deployment unit for types and resources. They are self-describing so to allowthe .NET runtime to fully understand the application and enforce dependency and versioning rules.

7. What is other name for shared assembly?
Global Assembly

8. How do you create and use shared assemblies?
using GACUtil.exe

9. How do you use thread in your .NET application?
Derive your class from Thread Class

10. what are the main differences between Web Server controls and HTML Server controls?
HTML Server controls are the nothing but some html tags with runat=server attribute in that tag. Web Server controls have richer event handling. HTML Server Controls need to be nested within a form tag. and so on.

11. Differences between ref and out parameters?
out parameter need not be initialized, where as ref parameter needs to be. This clarifies that ref is both I/O parameter and out is only Output parameter as name suggests

12. When on the internet would you look for web services?
I guess the question is where on the Internet would you look for web services. Go to UDDI Server and find.

13. Does .NET supports Pessimistic record locking or Optimistic record locking or both?
both.

14. What is Catch API?
I am not aware of any Catch API. If it is Cache then look for Cache class and if it is exception handling (try catch throw block) look for it.

15. which method do you use to redirect the user to another page without performing a round trip to the client?
Server.Transfer

16. What base class do all web forms inherit from?
System.web.UI.Page class. But for UserControl its System.Web.UI.UserControl

17. what method do you use to explicitly kill a users session?
Session.Abandon

18. Which .NET class is used to validate an XML document?
XMLValidatingReader.

19. What is AutoPostBack
Use this property to specify whether the state of the control is posted back to the server when clicked, changes, list.

20. What is reflection
The process of obtaining information about assemblies and the types defined within them, and creating, invoking, and accessing type instances at run time.

Few Good questions : Any answers ?

Here are some good and very basic questions that were asked in a interview for the position of technical leads for a CMMI 5 level company in India . The interesting point is that 85% of the respondent could not answer even half of them...

Here are the some of those questions :
If readers have answers to these please put comment to this post :)

* What is the difference between System.Int32 type and int type?
* Can you assign null value to a struct?
* How does the modifier readonly affect reference types?
* Is this code valid public const object KEY = new object()?
* Do you need to have a catch block whenever you use the try block?
* What is the accessibility level of internal protected fields and methods?

WCF / VS2008 Interview question


  • What is .NET 3.0 ?
  • What is WCF?
  • What are the important principles of SOA (Service oriented Architecture)?
  • What are end points, contract, address and bindings?
  • What are bindings?
  • Which specifications does WCF follow?
  • What are the main components of WCF?
  • Can you explain how End points, Contract, Address and Bindings are done in WCF?
  • What is a service class?
  • What is a service contract, operation contract and Data Contract?
  • What are the various ways of hosting a WCF service?
  • What are the major differences between services and Web services?
  • What is the difference WCF and Web services?
  • What are different bindings supported by WCF?
  • Which are the various programming approaches for WCF?
  • What is one way operation?
  • Can you explain duplex contracts in WCF?
  • How can we host a service on two different protocols on a single server?
  • How can we use MSMQ bindings in WCF?
  • Can you explain transactions in WCF?
  • What different transaction isolation levels provided in WCF?
  • Can we do transactions using MSMQ?
  • Can we have two way communications in MSMQ?
  • What are Volatile queues?
  • What are Dead letter queues?
  • What is a poison message?
  • WPF Interview questions What is WPF?
  • What is XAML?
  • What are dependency properties?
  • Are XAML file compiled or built on runtime?
  • Can you explain how we can separate code and XAML?
  • How can we access XAML objects in behind code?
  • What are the kind of documents are supported in WPF?
  • Windows workflow foundation(Vista series)
  • What is Windows Workflow Foundation?
  • What is a Workflow?.
  • What are different types of Workflow in Windows Workflow foundation?
  • When should we use a sequential workflow and when should we use state machiHow
  • do we create workflows using designer?
  • How do we specify conditions in Work flow?
  • How do you handle exceptions in workflow?
  • What is the use of XOML files?
  • How can we pass parameters to workflow?
  • AJAX Interview questions
  • What problem does Ajax solve?
  • What is Ajax?
  • What is the basic fundamental behind Ajax?
  • What is JSON?
  • How do we use XMLHttpRequest object in JavaScript?
  • How do we do asynchronous processing using Ajax?
  • What are the various states in XMLHttpRequest and how do we check the same?
  • How can we get response text?
  • How can we create XMLHttpRequest component?
  • How can we create a class in JavaScript using Atlas?
  • How do we do inheritance using Atlas?
  • How do we define interfaces using Atlas?
  • How do we reference HTML controls using Atlas?
  • Can you explain server controls in Atlas?
  • Can you explain ScriptManager control?
  • What is the importance of UpdatePanel Control?
  • Can you explain update progress control?
  • Can you explain control extenders?

What is windows cardspace?

Windows CardSpace (codenamed InfoCard), is Microsoft's client software for the Identity Metasystem. CardSpace is an instance of a class of identity client software called an Identity Selector.

CardSpace stores references to users' digital identities for them, presenting them to users as visual Information Cards. CardSpace provides a consistent UI that enables people to easily use these identities in applications and web sites where they are accepted.

What do you know about WS Security? Explain in brief

WS-Security (Web Services Security) is a communications protocol providing a means for applying security to Web services. On April 19 2004 the WS-Security 1.0 standard was released by Oasis-Open.

The protocol contains specifications on how integrity and confidentiality can be enforced on Web services messaging. The WSS protocol includes details on the use of SAML and Kerberos, and certificate formats such as X.509.

WS-Security describes how to attach signature and encryption headers to SOAP messages. In addition, it describes how to attach security tokens, including binary security tokens such as X.509 certificates and Kerberos tickets, to messages.

WS-Security incorporates security features in the header of a SOAP message, working in the application layer. Thus it ensures end-to-end security.

What do you understand by the word SSL? Give a one line answer.

Secure Sockets Layer (SSL), is a cryptographic protocol that provide secure communications on the Internet for such things as web browsing, e-mail, Internet faxing, instant messaging and other data transfers.

What is Web Services Enhancements ( WSE) and its various versions?

Web Services Enhancements (WSE) is an add-on to the Microsoft .NET Framework which includes a set of classes that implement additional WS-* Web service specifications chiefly in areas such as security, reliable messaging, and sending attachments. [1] Web services communicate via SOAP messages.

WSE provides extensions to the SOAP protocol and allows the definition of custom security, reliable messaging, policy, etc. Developers can add these capabilities at design time using code or at deployment time through the use of a policy file.

WSE 1.0 for .NET Framework 1.0 was released in December 2002. It was based on the draft version of WS-Security. It is not supported anymore and is not compatibile with .NET 2.0.

WSE 2.0 was released for Visual Studio .NET 2003 and the .NET Framework 1.1 in May 2004. It introduced major secure communication improvements (signing and encryption of user-defined SOAP headers, Kerberos Security Context Tokens, delegated trust etc), a new lightweight messaging infrastructure, a new programming model, support for SOAP based messaging over TCP as an alternative to HTTP, a policy framework based on WS-Policy and WSDL, WS-Addressing, WS-Trust, WS-SecureConversation support.

WSE 3.0 was released in October 2005 and has design time support with Visual Studio 2005. It includes policy framework enhancements including security based on policy assertions (associating CLR client proxies with policy files), turnkey security scenarios for securing end to end messages, extensibility mechanisms for user-defined policies in code and a simplified policy model applied to a message exchange instead of on a per-message level.

What is serialisation and deserialisation?

Serialization is the process of converting an object instance’s state into a sequence of bits that can then be written to a stream or some other storage medium.

Deserialization is the process of converting a serialized bit stream to an instance of an object type.

The .NET Framework provides an easy-to-use serialization mechanism for object implementers. To make a class, structure, delegate, or enumeration serializable, simply attribute it with the SerializableAttribute custom attribute, as shown in the following code snippet:

[Serializable]
class SomeClass
{
public int m_public = 5000;
private int m_private = 5001;
}

Because we’ve attributed the SomeClass type with the SerializableAttribute, the common language runtime will automatically handle the serialization details for us.

Also To prevent the serialization of a field member of a type attributed with the SerializableAttribute, you can attribute the field member with the NonSerializedAttribute.

What do you understand by Obfuscation and Encryption?

Encryption involves using a mathematical algorithm and a numeric key to transform text into cipher-text. The readable text has now become unreadable cipher-text. Encryption is usually two-way. In other words, using another mathematical algorithm and the same numeric key, the cipher-text can be reassembled into the originating text.

To obscure something is to make it not easily distinguishable. This technology hides your code from decompilers. It does so by keeping the same functionality but substituting different code and mixing in complexity. Obfuscation is a one-way function; once the code is obfuscated, there is no way of returning to the original input of the obfuscation

What do you understand by Asynchronous Database Commands ?

When we execute any database. Thread that executing the command waits before the command get fully executing before executing any additional code. Thread is blocked for another process. But Asynchronous Database Commands solve this problem when database command is executing the current thread can continue on other process.Thread can execute a no of database command.

There are two benefits of using Asynchronous Database Commands.
1) Executing Multiple Databse Commands simultaneously improve performance.
2) Because ASP.Net framework uses a limited pool service for request. Whenany request for a page is comes its assign a thread to handle the request. If framework is out of thread then job is in gueses we get error 503. But if we are using asynchronous database command then current thread is release back to current thread pool.

How will you get result from two table in SqlDataReader ?

Syntax:

string str="Select * from table1;Select * from table2";
cmd.commandtext=str;
dr=cmd.executereader();

What is the difference in using IP address and DNS name in the connection string while connecting to SQL database?

When we are making connection string always use Server's IP address not the DNS name if we use IP address it will reduce the time taken for connection to establish.

Because server IP address is used to get a default or named instance of Sql Server that ls running. if we are running the cluster we have to use the Virtual SQL Server IP address.

What are the differences between Datalist DataGrid and datarepeater ?

DataList

* Has table appearance by default
* Has no auto format option
* has no default paging & sorting options
* can define separators between elements using template

DataGrid

* Has a grid appearance by default
* has a auto format option
* has default paging and sorting
* has no separator between elements

DataRepeater

* simple,read-only output, has no built in support for selecting or editing items, has no default appearance, has no default paging.

What is digital identity?

A digital identity is a set of characteristics (or “claims”) by which a person or thing is recognizable or distinguished in the digital realm. Digital identity allows us to address an individual or thing without confusing it for someone/something else.

What is the difference between CardSpace and Smartcards?

Smartcards and CardSpace can work in concert with one another. CardSpace is a digital representation of a user’s identity as issued by a particular Identity Provider.

When the customer selects an CardSpace to use such as when logging into an online account or performing an online paymet, it results in sending a request to a Security Token Server (STS) at the Identity Provider to generate a security token of a requested type.

Sometimes the user needs to provide a credential, such as a PIN or password, to the Security Token Server. A Smartcard may be used as such a credential.

Fresher / Beginner Interview Questions

Here are some questions that you might be facing if you are going as a fresher or upto 2 year experience level position. The basic Idea of an interviewer here to know if you are good at fundamentals.
Deciding factor here will be your ability to show the interviewer that you are good in basics and even if you dont know some things you can pick up quickly.

  • What is the difference between a Thread and a Process?
  • What is a Windows Service and how does its lifecycle differ from a "standard" EXE?
  • What is the difference between an EXE and a DLL?
  • How many processes can listen on a single TCP/IP port?
  • What is the GAC? What problem does it solve?
  • What is a port? can a PC have multiple IP addresses?
  • What does this do? sn -t abc.dll
  • How would one do a deep copy in .NET?
  • What is boxing?
  • Is string a value type or a reference type?
  • What is the maximum length of a varchar field in SQL Server?
  • How do you define an integer in SQL Server?
  • How do you separate business logic while creating an ASP.NET application?
  • Name a few differences between .NET application and a Java application?
  • Specify the best ways to store variables so that we can access them in various pages of ASP.NET application?
  • What are the XML files that are important in developing an ASP.NET application?
  • What is XSLT and what is its use?
  • Is it possible to have a static indexer in C#? - No. Static indexers are not allowed in C#.
  • What is a sealed class
  • What are interfacec?
  • What is multiple Inheritence? give one example?

What an interviewer wants?

Before going to a technical interview you must know and understand the expectations of the interviewer. Every good interviewer knows that 30-40 minutes of questioning about basics and definitions can not guarantee that a good developer / software professional will be found.

There is no single criteria to find a true great professional, be it of any level.

Asking tough & tricky questions are not a sure way to get the best person. A person might be very good technically but on the other hand he might be a bad team worker ( which can be very detrimental to a project ).

So if you are in a technical interview and the interviewer is really good he will look for the following qualities more than your quality to memorize definitions, answer of basic bookish questions

  • Your fundamental understanding of the technology you are aspiring to work on?
  • Your ability to pick up new things and challenges?
  • Ability to see and conceptualize an overall picture?
  • Your understanding of software development process and ability to tackle different kind of development environments?
  • Your understanding that coding is only a small portion of a project life cycle?
  • Your ability and approach to understand and solve problems?
  • How do you interact with others?
  • How do you deal with adverse and crisis situations?
  • How well you communicate?
  • How well you perform under pressure?
  • How good a team player are you?
and many more of this kind ....


And to determine if you have these qualities he may ask you to :

  • Demonstrate conceptual understanding of some of the fundamentals of software engineering
  • Answer more generalized questions about hard core fundamentals of the technology and then provide some kind of concrete examples
  • Describe your last or favorite project and how it worked
  • Describe the overall architecture of your last or favorite project and how it worked
  • Describe any adverse or crisis situation you were into and how you faced it
  • Answer any open ended question ( which don't have any definite answer )
  • Describe your previous company / boss or coworker

What advantages IIS 7.0 have over its previous versions in terms of deployment?

In IIS 7.0 Deployment and Configuration is simplified to a great extent.

The centralized configuration store of the previous IIS releases, known affectionately as the metabase, is gone. IIS 7.0 features a new delegated configuration system based on a hierarchy of distributed XML configuration files. This hierarchy is comprised of a global applicationHost.config file, which contains server-level configuration defaults, and distributed web.config files within the application's directory structure. These are the same web.config files that are use

In the past, IIS application settings had to be explicitly configured in the machine-level metabase repository before the application could function correctly. With distributed web.config files, applications encapsulate the required server configuration within their directory structure. This dramatically simplifies deployment, allowing self-contained applications to be simply copied to the target server's application directory and thus be up and running immediately with the desired settings.

The new configuration system also gives comprehensive control to the server administrators, allowing them to delegate certain configuration options to the application while maintaining control over others for security or business reasons. In this way, applications on hosted servers can set essential configuration directly in their application without requiring the calling of the server administrator for help or using an external configuration panel.

Is IIS 7.0 backward compatible?

IIS 7.0 is able to run most existing applications without modification.

While IIS 7.0 provides a new extensibility model for developing IIS components, ISAPI components are still supported. If you install the ISAPI Extensions and ISAPI Filters setup components, you will be able to run your extensions and filters as before.

For a complete list of ASP.NET breaking changes and general ASP.NET compatibility information on IIS 7.0, be sure to check out the ASP.NET compatibility whitepaper at iis.net/default.aspx?tabid=2&subtabid=25&i=1223.

C# basics - true false questions

  1. If a class is declared as abstract it is not possible to instantiate it - True

  2. If any method in a class is abstract, then that implies the class itself should be abstract - True

  3. Interface members are always public and cannot be declared as virtual or static - True

  4. Like COM interfaces C# interfaces also have to use GUIDs as identifiers - False

  5. Using the enum names in code makes code more readable - True

  6. Structures in C# are value types - True

  7. You can derive an interface from itself - False

You have a specific requiremnt due to which you have to use a reserved keywords as an identifier name. How will you do that? Is it possible?

Yes its possible, You can precede the identifier with the @ symbol. This overrides the compiler error and enables you to use a keyword as an identifier.

Is it possible to derive your class from a base class and implement interfaces at the same time?

Yes its possible, we can use it like this

class MyDerivedClass : CMyBaseClass, Interface1, Interface2

What do you understand by unsafe mode in C#?

The C# language supports a special mode, called unsafe mode, that enables you to work directly with memory from within your C# code.

This special C# construct is called unsafe mode because your code is no longer safe from the memory-management protection offered by the CLR. In unsafe mode, your C# code is allowed to access memory directly, and it can suffer from the same class of memory-related bugs found in C and C++ code if you're not extremely careful with the way you manage memory.

Saturday, April 19, 2008

Software Job Interview Questions and Answers

1: Tell me about yourself.

This is usually the first question asked because it is a good icebreaker. You should not use this open-ended question to offer useless information about your hobbies and home life. Many people will make the mistake of saying, "I'm 32 years old, married, and the mother of three children aged 5, 7 and 9. My hobbies are knitting, cycling, reading and . . . blah blah blah." This is not a good answer.

A good answer to this question is about two minutes long and focuses on work-related skills and accomplishments. Tell the interviewer why you think your work-related skills and accomplishments would be an asset to the company. You could describe your education and work history (be brief) and then mention one or two personal character traits and tell the interviewer how the traits helped you accomplish a task at school or work. Do not describe yourself with tired old clichés such as "I'm a team player," "I have excellent communication skills," unless you can prove it with an illustration. For example, one might say "I would describe myself as a self-starter. At Acme Corporation, there was a problem with . . . so I created a new inventory system (give details) that reduced expenses 30 percent.

"Someone with a new degree in an IT field might answer this question as follows: "I have enjoyed working with computers since I was eight years old and have always been adept as using them. Throughout junior high and high school, friends and relatives were always asking me for help with their computer problems, so no one was surprised when I chose to major in IT at college. I spent hundreds of hours at the computer learning everything I could about them and how they worked. A few years ago I became particularly interested in software development and began formulating ideas for new software that would really help consumers. I even developed plans for a few applications on my own. [Discuss the plans briefly.] I've also worked on several college teams and as an intern at Acme developing software. [Offer highlights of work experience in software development.] I would like to continue working in this particular area very much. That's why I applied for a position with your company. You're one of the leaders in software development and I want to work in a company where I can really be challenged and make a difference. I also really like the products you've developed. I think they're some of the best on the market and I would very much enjoy working to improve and enhance these products even further and create new software as well."


Question 2: Where do you see yourself in five years?

Assume that you will be promoted two or three times in five years, so your answer should state that you see yourself working at whatever job is two or three levels above the job in which you are applying. Do not claim that you will be "running the company" in five years. You might want to add that you understand your promotions will be earned through hard work and that you do not assume you will be promoted just because you stayed with the company. Good answer: "I see myself as head of the Sales Department in five years. I've already proven that I have the ability to manage a large sales staff at Acme, and I expect that I will be promoted to a senior management position in the future provided that I work very hard at my job and earn the promotions, which I expect to do."

Question 3: Are you willing to relocate?

If relocating were not an issue, the interviewer would not be asking the question. Therefore, the only acceptable answer is "Yes." If you answer in the negative, you will not get the job. If you really do not want to relocate, then perhaps you should not accept the job if it is subsequently offered to you. If you are not sure, then ask questions about relocation, such as when it is likely to occur, where you will relocate to, and would it involve a promotion.

Question 4: Are you willing to travel?

If traveling were not part of the job, the interviewer would not be asking this question. Therefore, the only acceptable answer is "yes". If you are willing to travel, answer yes and give some illustrations of work-related travel you have done. However, if you do not want to travel, you should find out more about this aspect of the job before accepting the position, such as how much travel will be involved, where will you be traveling to and for how long.

Question 5: Are you willing to work overtime?

If this wasn't an aspect of the job, the interviewer wouldn't be asking this question. Therefore, the only acceptable answer is "yes" if you want to be considered for the job. If your past jobs involved overtime, now would be the time to tell this to the interviewer. "Yes, I am willing to work over time. I have no family or personal obligations that would prevent me from working at night and on weekends. I don't mind working over time at all."

Question 6: What book are you currently reading?

The only correct answer is to offer the title of a nonfiction book, preferably one that is on a subject related to your career or business in general. For example, if you are a sales person, tell the reader you're currently in the middle of "Selling for Dummies" or the title of a book on improving your time management, personality, efficiency, etc. As part of your job search, you will have to start reading one or two acceptable books so that you can intelligently discuss them if the subject is brought up during an interview. Some interviewers will try to determine if you regularly read by asking you for titles of 3-5 books you've read this year, so be ready.

Question 7: What is the last movie that you saw?

Replying that you "don't have time to watch movies as you are completely devoted to your job" is not a good answer and will not win you any points, even if the interviewer was dumb enough to believe you. Interviewers are looking for well-rounded people who enjoy healthy activities, such as relaxation and entertainment, and will expect you to state the name of a movie. The movie title that you give in reply to this question should always be one that is popular with the general public, but uncontroversial, meaning that it doesn't have any negative or zealous political or religious overtones. Don't reveal the fact that you spend way too much time watching movies by stating you have seen a particular movie 15 times or that you spend too much time watching movies. A well-known uncontroversial movie, popular with the general public, and one that the interviewer is likely to have seen, is always a good choice.

Question 8: What are your hobbies and interests outside of work?

The interviewer is trying to find out (1) more about whom you are and (2) if you maintain an interest in a particular subject for a long period. You should not indicate that you change hobbies frequently or have a problem maintaining an interest in one subject over a long period. A good answer might be, "I have been interested in genealogy for the past five years. I am currently the President of the Adams County Genealogical Society and we meet once a month to exchange research tips. So far, I have discovered that I am the descendent of two civil war generals and Thomas Edison as well. It's very interesting, but I don't have much time with my busy schedule to do much research now, but I plan to spend much more time doing research after I retire." Answers that reveal participation in sports are also good: "For the past five years I have been an avid racquetball player. I've competed in a dozen or so competitions and I've won a few." Of course, you do not want to reveal any hobby or activity that most people would consider strange, such as "I collect potato chips that look like celebrities" or "I collect the autographs of convicted serial killers."

Question 9: What do you like to watch on television?

In answering this question, one should not appear too silly or too arrogant. Therefore, avoid revealing the fact that you have seen every episode of the Brady Bunch 200 times or that you race home from work everyday to hear the Gilligan's Island theme song. Don't swing the other way and claim that you never watch television or only watch PBS and C-SPAN because they will know you're lying or think you are weird or boring. The best answer reveals that you do watch television, but you watch respectable, very popular programs such as "Law and Order" or "CSI." Never admit to being a coach potato who sits in front of the TV five hours every day.Good answer 1: "I don't watch that much television. I try to catch the news everyday, I like to watch the political programs on Sunday mornings, and football in the fall. "60 Minutes" is probably my favorite program. My family and I usually find a movie to watch on Saturday and Sunday nights. Sometimes we rent a few movies on weekends, but I don't really have any favorite programs I watch consistently every week."Good answer 2: "I enjoy watching "Friends" just like millions of other Americans. I get together with six or so friends at a pizza place on Thursday nights and we watch it together. I rent a few movies on most weekends, and I do try to catch the news every morning when I'm getting ready for work. I don't have that much time for television because I work and go to school full time. And the last thing I want to do after sitting all day in class and at work is to come home and sit some more in front of a television. In my free time, I usually go to the gym, walk my dog and spend time with my friends and family rather than watch television."
Question 10: What jobs did you have as a teenager?Answer this question honestly. Either you had jobs or you didn't. Household chores, mowing lawns, shoveling snow, and lemonade stands all count as jobs. Good answer 1: "I worked part-time at both Burger King and McDonalds between the ages of 16 and 20 in order to earn money to buy my first car and help my parents pay for my college education. I was able to handle both work and school without my grades suffering. And when I was younger, around 13 to 16 years old, I babysat for families in the neighborhood on weekends."Good answer 2: "I didn't have any jobs as a child other than chores I was expected to do around the house such as helping my parents with housekeeping, mowing the lawn, shoveling snow, and babysitting my younger sister and brother. My parents placed tremendous emphasis on academics and extracurricular activities, and would not allow me to work."

Question 11: Who are your references?

It is a good idea to type up the names and contact information of your references on a sheet of paper and present it to the interviewer when the topic comes up. Ideally, one should provide the names of current and former supervisors as references since these are the people prospective employers most want to speak with about your work performance. Giving the names of others as references -- such as co-workers, friends, family members, etc. -- might be an indication that you do not want the interviewer to contact your supervisor. If you do not have any work history, use teachers, professors, or business people you or your family knows as references.

A good answer to this question:

"I have prepared a list of references here I would like you to have. I have selected my current supervisor, Jane Doe, as my major reference since she can speak about my most recent work performance and accomplishments. I also list the names of my previous two supervisors at Acme, Jack Wilson and Norma Smith." If one does not have any work references, a good answer might be, "I asked two of my engineering professors to be references for me and they agreed to do so. I typed up their names, phone numbers and contact information on this sheet of paper. They can attest to the work I completed as an intern over the past two years. I also list Mrs. Sally Wilson, who is a prominent attorney and a friend of the family. She has known me since I was a child and can attest to my character."

Question 12: Do you mind if I contact your references?

You should always inform your present employer that you are looking for a new position and someone will be contacting them to discuss your work history. If you don't want your current boss to know you're searching for a new job, then tell the interviewer that: "I would prefer that you not contact my current employer as she is not aware that I am looking for another position, but you may contact Mr. Jack Smith, my former supervisor at Acme. He supervised me for four years and agreed to be a reference for me. Of course, if you decide to offer me this position, please let me know so that I can inform my current employer, and then, yes, you may contact her once I have received an offer of employment and given notice."On the other hand, you might have already informed your current employer that you're interviewing for other jobs. In this case, your answer might be, "Yes, you may contact my present supervisor, Mrs. Smith. She is well aware of the fact that I am searching for a new position and knows that you will be calling her in the near future."

Question 13: Will you take a lie-detector test?

The interviewer is asking this question (1) because it is a requirement to get the job, or (2) to find out if you are afraid of the prospect of taking such a test. Therefore, the only correct answer to this question is "Yes, I would be willing to take a lie detector test." You don't need to say anything else.

Question 14: How do you feel about air travel?

Obviously, the interviewer wouldn't be asking this question if traveling by air wasn't an important component of the job, so the only correct way to answer this question is "No, I have no problem with air travel." You might want to expand your answer by telling the interviewer that you traveled a lot in a previous job or in your personal life. If you tell the interviewer you are afraid of flying or cannot do so for some other reason, such as a medical condition, you will not get the job offer.

Question 15: Have you ever owned your own business?

The best answer to this question is yes since it shows initiative and that you have had some experience marketing services or products.

Good answer: "Yes, I ran my own business while in high school. I went door-to-door asking people if they needed their lawns mowed. I earned quite a sum of money in just a few months, enough to pay for a car and my first year of college."

Question 16: Are you in good health?

The interviewer is asking this question because providing health insurance to employees costs employers a small fortune. Consequently, many employers prefer to hire those who try to maintain their health to keep the number of claims down and insurance rates as low as possible. Keep in mind that employers can find out your medical history and many of them make the job offer contingent upon your passing a physical examination, therefore, it wouldn't be a good idea to blatantly lie about your medical history. That doesn't mean you should offer information you don't have to, such as "I smoked cigarettes for thirty years, but gave them up last year" or "I've had two heart attacks and a stroke". If your health is generally good, then answer this question briefly: "Yes, I'm in good health" or "I have no health problems that would prevent me from doing this job" and don't elaborate further.

Question 17: What do you do to maintain your health?

Obviously, if you're in good shape, answering this question is easy: "I jog two or three nights a week and lift weights at the Acme Gym three times a week. I try to eat a balanced diet; I eat lots of salads and try to maintain my weight." If you're overweight or obese (as are 65% of adult Americans) answering this question isn't going to be easy. Sample answer: "Well, obviously I'm overweight, so I can't tell you that I get up and jog for an hour every day, but I do walk my dogs for 45 minutes every night. I recently started the Atkins program and have already lost seven pounds. It's a diet I can live with, so I know this time I'll be able to lose all the weight and start taking better care of my health."

Question 18: Do you have any physical problems that would limit your ability to perform this job?

Employers have to be very careful about asking this question as too much prying can violate your civil rights. Therefore, they won't ask too many prying questions and you don't need to offer them very much information. The best way to answer this question is to keep it short and simple: "No, I don't have any physical problems that would affect my ability to perform this job."

Question 19: What organizations are you a member of?

The interviewer is interested in work-related memberships, not personal ones. The fact that you are a member of the American Business Association is more important than the fact you participate in your local PTA (which reveals the fact that you have children). It is also a good idea not to reveal religious and political affiliations, such as memberships in the Christian Business Association or the Republican Party or ethnic and cultural affiliations.

Question 20: How do you balance career and family?

On the surface this questions appears to be an illegal job interview question, but it isn't the way that it's worded. The interviewer is hoping you will reveal information about things he isn't allowed to ask, such as if you are married, single, divorced, have children, or are straight or gay. If you don't want to reveal information about your personal life, offer a vague simple answer: "I haven't had a problem balancing my work and private life. One has never interfered with the other. I am capable of getting the work I need to get done without it interfering with my personal life." On the other hand, you might want to reveal a great deal of information if you think it will help you get the job offer: "I can easily balance my career and family life as my children are now in college and my wife is starting a new career as a real estate agent. We both work hard and have flexible schedules to work when we need to, but we still have a good personal life, spending time with friends and family every week."

Question 21: What is your greatest strength (or strengths)?

Provide one or two strengths that are work-related and give the interviewer an example that proves you have that strength. Sample answer: "I have the ability to train and motivate people. For example, at Acme Corporation, employee turnover was sixty percent. To try to find out why, I interviewed more than 200 employees. I discovered that a major reason for the high turnover was lack of proper training and low morale. To try to resolve the problem, I developed a training program that helped workers perform their jobs better and got them motivated to do a better job. Each training session lasted only two days, but the results were very impressiveproductivity improved 30 percent and employee turnover dropped by more than half."

Question 22: What is your greatest weakness (or weaknesses)?

Don't answer this question by claiming that you have no weaknesses. Confess a real weakness that you have, but choose one that isn't particularly relevant to the job you're seeking if you can. Do not answer with phony weaknesses such as "I'm a slave to my job." Just state the weakness, tell the interview how it has harmed you in your work life, and what steps you have taken to improve it. A good step one can take to improve a weakness is to read self-help books on the subject. You might offer the title of a book you've read that helped you improve your weakness.

Sample answer 1: "A major weakness I had in the past was delegating work to others and trusting them to do it correctly. In my early career, this caused some problems for me in that my subordinates were unhappy because they felt I lacked confidence in them. I would try to do the work myself or look over their shoulders while they were doing the work. This problem was brought to my attention by my supervisor in a performance review. I agreed with her on this point and admitted I needed to change so I read a few self-help books that helped me change my thinking and let go of the idea that I needed to micromanage my work environment in order to get the job done. Now, I have no problem delegating work to subordinates."

Sample answer 2: "I'm a very shy person until I get to know a person. Being shy has cost me a great deal in my career as it has prevented me from getting promotions and jobs I've wanted. A few years ago, I realized I would have to change or I wasn't going to achieve my career goals. I read several self-help books on the subject, "Getting Over Your Shyness" was one, and I summoned up the courage to take a speech class at night. The teacher was excellent and was able to convince me how shyness is just an irrational fear. Although I'll always be shy, I'm not nearly as shy as I used to be and I've greatly improved my ability to communicate with others by taking several more speech classes. Now, I can get up in front of a large group of people and give a lengthy presentation without a problem."Bad answer: "I have a major weakness for chocolate." Although this is a weakness, to offer this as an answer is to sidestep the question and will turn off the interviewer.

Question 23: Do you work better alone or as part of a team?

If the position you're applying for requires you to spend lots of time alone, then of course, you should state that you like to work alone and vice versa. Never sound too extreme one way or another. Don't say that you hate people and would "die if you had to work with others" and don't state that you "will go crazy if you're left alone for five minutes". A healthy balance between the two is always the best choice. If you have previous experience illustrating the fact that you can work alone or with others, then offer it. For example, you might state that in your previous job you spent a significant amount of time alone while traveling, or that you have learned how to get alone well with people in the workplace by working on numerous team projects.

Question 24: Do you consider yourself to be organized?

The interviewer wants to hear about your work skills concerning time and task management, not that you have neatly separated the paperclips in your desk drawer into different trays based on size. A model answer might be "I manage my time very well. I routinely complete tasks ahead of schedule. For example, . . . (offer the interviewer proof of your organizational skills by telling him about a major project that you organized and completed on time or mention the fact that you consistently received an outstanding grade on previous performance reviews regarding your time management). Do not reveal to the interviewer that you are habitually late or that you complete tasks at the very last minute.

Question 25: Do you consider yourself to be a risk-taker?

How you answer this question depends on the type of company it is. If it is a start-up company or within a highly-competitive industry, then they are probably looking for those more willing to take risks. If you believe the company is this type, then offer an example of a risk you've taken in business. If the company is a well-established industry leader, risk takers are not as highly valued. Of course, no company is looking for employees who are foolish in their risk-taking behavior, so a good rule of thumb is to place yourself somewhere in the middle -- you are neither too foolish nor overly cautious.

Question 26: Are you a self-starter?

The correct answer to this question is always "yes", and the ideal answer includes an example of how you are able to work with minimal supervision, keep your skills current without being told, or a time when you took it upon yourself to be more efficient, accurate or productive.

Example 1: "Yes, I am definitely a self-starter. When I worked at Acme Corporation, I was positive that the firm would be adopting a new operating system within a year, so I started taking classes at the local university at night in order to prepare myself. I was the only one in the office that knew how to operate the equipment when it was installed, so I was appointed trainer and subsequently trained 200 co-workers. I did receive a reward for my work on that project."

Example 2: "Yes, I am a self-starter. I am always thinking of ways I can improve office efficiency and help the company be more profitable. For example, a few years ago I noticed that the sales reps were having a very difficult time finding client files when they called. The sales reps would put clients on hold and spend sometimes as much as five minutes frantically trying to locate a file. I took it upon myself to design a file management system that enabled the sales reps to locate client files on their desktops in less than 15 seconds. This has made the office much more efficient and, of course, made both the sales reps and our clients much happier."

Question 27: How do you react to criticism from supervisors that you consider to be unjust?

The only correct way to answer this question is to present yourself as a person who can handle criticism without becoming angry, defensive, vengeful or arrogant, yet, not let others intimidate or blame you when you don't deserve it.

Example: "There was a time when I was deeply hurt when a supervisor pointed out a mistake I made or an area in which I needed to improve and felt somewhat defensive. However, through the years, I have learned that no one is perfect; everyone makes mistakes and needs to improve in certain areas, so I shouldn't take criticism so personally. Therefore, I have learned to take it on the chin without becoming defensive or feeling hurt. I just take a few days to think about what was said and if I feel the criticism is warranted, I take steps to improve my performance. If I feel the criticism was unjustified, I will sit down with my supervisor and calmly discuss the reasons why I feel the criticism was unjustified."

Question 28: How well do you handle change?

The only acceptable answer is one stating you handle change very well. Don't just make this claim; offer an example of how well you coped with a major change that took place in your work environment. A common shakeup occurs when your employer brings in new automation or changes its culture. In any event, tell the interviewer what you did to cope or adapt to a change that occurred with a previous employer -- and this should be a major change, not a minor one.

Question 29: Are you opposed to doing a lot of routine work? Don't answer with, "Oh yes, I will enjoy filing eight hours a day, 40 hours a week, 50 weeks a year!" Instead, try to assure the interviewer you aren't going to go mad doing your boring job.

For example, "I know this position requires a lot of routine work, but I don't expect to start at the top. I'm willing to start at the bottom and prove myself. Eventually, I will be assigned tasks that require more brain power."

Question 30: How do you resolve disputes with co-workers and handle conflicts?

Don't claim that you have never had a dispute with a co-worker. The interviewer will know you are fibbing, since getting along with all co-workers is unusual -- there's always at least one person you can stand. The best answer to this question tells the interviewer about a dispute you had with a co-worker and how you resolved it so that the outcome was positive. Your answer should tell the interviewer how you resolved it on your own, and hopefully, that you and this other person are now friends, or at least are able to work together productively. Also, concentrate on offering an example of how you resolved a work-related conflict rather than disclosing a personal feud over some petty subject. For example, telling the interviewer about your problems getting a co-worker to take your suggestions on a specific project seriously is a much better topic than telling the interviewer about your feud with another over a parking space. In addition, don't tell the interviewer that you resolved a dispute by tattling to the boss or trying to get the other person fired. Employers are sick of dealing with employee conflicts and they want a mature person who can resolve conflicts on her own without tattling or complaining to the boss.

Question 31. What would you do if a supervisor asked you to do something the wrong way?

The interviewer is testing how insubordinate you might be. Never answer this question by claiming you would refuse to do something the way the supervisor told you to do it unless you are required by your company or by law to follow certain procedures. Instead, tell the interviewer you would tell the supervisor you think it should be done another way, but if the supervisor insisted you do it his way, you would do so.

Good answer: "If I was aware that there was a more efficient or better way to perform a task, I would tactfully point this out to the supervisor. However, if she still wanted me to do it her way, I would do so."

Question 32. What types of people do you have trouble getting along with?

You don't want to answer this question with "Hard-working people who make lazy people like me look bad." You want to be the hard-working, nice person who doesn't like lazy or difficult people. However, be careful, the position you're interviewing for might come with an unpleasant, difficult supervisor and the interviewer is asking you this question for that reason.

Good answer 1: "I don't get along well with people who don't hold up their end of the job, who are constantly coming in late or calling in sick. They don't really respect their co-workers and bring the whole organization down."

Good answer 2: "I don't get along well with people who are opinionated and close-minded. They always seem to be complaining about one thing or another and they're depressing to be around."

Question 33. Why should we hire you?

Take several minutes to answer this question, incorporating your personality traits, strengths, and experience in to the job you're applying for. A good answer is to focus on how you can benefit the company. You can best do this by matching your skills and qualifications to those needed for the job and be ready with examples of how your skills, talents, etc., mesh with the needs of that particular company.

Sample answer 1: "You should hire me because I have considerable experience and success in marketing software products to small companies. I know that your organization has not done well serving the small business sector and would like to greatly expand sales in this segment. At Acme, I was able to increase small business accounts 60 percent in just two years. At XYZ Corporation, I single-handedly brought in 260 new small business accounts in just three years, which was a company record. Currently, your company has a very high turnover rate among sales recruits, approximately 60 percent. I succeeded in reducing employee turnover by more than 30% at both Acme and XYZ. I also had great success in leading and motivating new sales recruits. A large percentage of those I have trained have gone on to be stellar performers. This is why you should hire me. I can make a positive impact on sales and help reduce your labor costs, making this company more competitive and profitable."

Sample answer 2: "I believe I am the best person for this position because you need an office manager who can work effectively with diverse employees in a very fast-paced hectic environment. I have more than a decade of experience supervising clerical workers from diverse cultures, helping them to become more productive and efficient. I have reduced employee turnover by more than 20% in the past three years, which saved my employer more than $1 million in related hiring and training costs each of those three years. I also eliminated the need for 10% of the office staff by automating several processes, saving my employer a small fortune in labor costs. I am confident that I can resolve your current labor problems, reduce your labor costs significantly while improving worker morale and productivity."

Question 34. What reference books do you use at work?

One should not answer this question, "I don't have any reference books." A good, safe answer is to state that you use a dictionary on a regular basis and one or two other books that are relevant to your field.

For example, if you are a sales person you might respond, "I keep a dictionary handy and the book that helped me succeed in sales, "How to Win Friends and Influence People." If your work involves accounting, then mention a few accounting reference books; if your work involves computer programming, and then mention a few relevant books, etc.

Question 35. Have you ever held a position that wasn't right for you?

One can answer this question either yes or no, but answering "no" would be better. If you answer yes, then you need to explain the mistake you made in exercising good judgment, and a good reason is always the lure of more money.

For example, one might answer: "A good friend of mine convinced me that I could make six figures quite easily selling real estate, so I gave up my job as an office manager and jumped right in. I soon realized I wasn't cut out for that world because there were too many players and I didn't have the necessary connections. Had I known that fewer than 10% of real estate agents manage to make a decent living, I never would have entered the field. I stayed in real estate for a year before I realized I was not going to make a six figure income, so I quit and found another position as an office manager, which is work that I am good at and like doing."

Question 36. What is your most significant career accomplishment?

Just answer this question honestly. You don't have to be Albert Einstein and say "I discovered the theory of relativity."

A good answer: "I think my most significant career accomplishment is rising from a receptionist to a district manager at Acme in just five years. I started there with no education and no training, and I worked hard all day and went to school at night until I earned a master's degree in management."

Another good answer: "I think my most significant career accomplishment was winning the XYZ account at Acme, which brought my employer $30 million in sales and help establish the company as an international player. It wasn't easy winning that account because we were competing with a dozen or so competitors who could offer a more high-tech product at a lower price, but I was able to put together a package that convinced the management at XYZ that our company was better for them in the long-term."

Question 37. Are you comfortable working for a large company?

The interviewer might be asking this question because your employment history shows you've always worked for smaller companies. Always answer this question in the positive, "Yes, I would be very comfortable working for a large company. I believe that working for a large company would not only provide more opportunities for advancement and growth, but would also expose me to more areas in my field."

Question 38. Are you comfortable working for a small company?

The interviewer might be asking this question because your employment history shows you've always worked for larger companies and doubts you will be able to fit in to a new environment. Always answer this question in the positive, "Yes, after working for a large corporation the past five years, I look forward to working for a small company where employees work more closely with one another and there is more of an informal team-effort rather than the cold, impersonal corporate atmosphere. I did work for smaller companies at the start of my career and have always missed that atmosphere and look forward to it again."

Question 39: Why have you changed jobs so frequently?

Reasons for job-hopping should be based on your past employers' failure to challenge you, failure to give you enough opportunity for advancement, because you needed more money, or for family reasons, and never on the fact that your past employers were incompetent, dumb, or unfair. Do not indicate in any way that you are hard to get along with or get bored and leave at the drop of a hat, and make sure you point out any jobs you did hold for a long time. Mention that your current goal is long-term employment and back that up with any proof you have to want job stability such as a new baby, new marriage, new home, etc. If the job you're applying for offers you the challenges and environment you were always looking for, make sure you point out this fact.

Good answer 1: "Well, at ABC Corporation, I was hired as an entry level salesman with the promise of rapid promotion to management within one year. After a year and a half, I realized that I wasn't going to be promoted as promised and took a position elsewhere because I could not support my family without the commissions that were promised. At Acme, I was told that the job was very challenging and exciting with significant opportunities for advancement within one year, but this did not materialize. The job was very unchallenging and the company seemed to be failing. I felt like I was capable of doing much more than sitting around with little to do, so I left. I admit that my resume shows some job hopping of late, but this is why I am so interested in the position with your company. I feel certain that this position offers very challenging and interesting work, as well as opportunities for advancement for those willing to work hard. Your company is very profitable and stable and has a good reputation in the industry. I know that this will be a position I will stay with a very long time."

Good answer 2: "I do not believe that my work history is an accurate reflection of who I am. I am actually a very stable person who would enjoy very much working for the same employer for a long period. Note that on my resume, it indicates that I worked for XYZ Company for five years in the early 1990s. I admit that my resume indicates some job hopping in the late 1990s, but this was because I was caring for my elderly, sick mother between 1995 and 2001. Caring for her required being available nights and on weekends, so I was not able to work overtime as the job at Acme required. I had to resign after working there for only a year. At XYZ Industries, I had to resign after only one year because they insisted on transferring me to the west coast. I simply could not move away from my mother who was too elderly and ill to make such a move. My mother passed away in 2001, I got married a year later and had a child. Now, I have a wife and child to support and a mortgage to pay. I am eager to settle down and work for a company like yours for a long period of time."

Question 40: Tell me what you do on a typical day at work.

The interviewer is trying to discover (1) if you exaggerated the job duties listed on your resume and/or (2) if you have the necessary experience to do the job for them. Therefore, your answer should emphasize duties one would perform in the job you're trying to get. If you can, reread the job description and emphasize the job duties listed there.

Good answer: "On a typical day, I arrive at work around 7:30 and look over various departmental reports in order to prepare myself for the morning meeting with the sales staff. From 8:30 to 10:00, I meet with a 30 member sales staff. We have training sessions, motivational sessions; we discuss problems and try to resolve them. From 10:00 to noon, I'm on the phone, chatting with various, clients, department heads, and government agencies. In the afternoon, I'm either out in the field, visiting various stores in the area or attending meetings with clients."

Question 41: Why do you want to leave your present employer?

You could state that you want a more challenging position, higher salary, or more responsibility. Don't mention personal conflicts with your present boss or bad- mouth your current employer or co-workers as this will harm your chances of being offered the job. Keep in mind that interviewers love people who are looking for more challenging positions or responsibility because it shows drive, ambition and motivation.

Archives