Friday, May 7, 2010

ASP.NET 3.0 Interview Questions




What is the Windows Presentation Foundation?

The Windows Presentation Foundation is the unified presentation subsystem for Windows. It consists of a display engine and a managed-code framework. The Windows Presentation Foundation unifies how Windows creates, displays, and manipulates documents, media, and user interface, which enables developers and designers to create visually-stunning, differentiated user experiences that improve customer connection. When it ships, scheduled for 2006, the Windows Presentation Foundation will be available on Windows XP, Windows Server 2003 and all future releases of the Windows operating system. When delivered, the Windows Presentation Foundation will become Microsoft’s strategic user interface technology.

What is the Windows Communication Foundation?

The Windows Communication Foundation is a set of technologies for building and running connected systems.
The Windows Communication Foundation is a new breed of communications infrastructure built around the Web services architecture. Advanced Web services support in the Windows Communication Foundation provides secure, reliable, and transacted messaging along with interoperability. The Windows Communication Foundation’s service-oriented programming model is built on the .NET Framework and simplifies development of connected systems. The Windows Communication Foundation unifies a broad array of distributed systems capabilities in an extensible architecture, spanning transports, security systems, messaging patterns, encodings, network topologies and hosting models. The Windows Communication Foundation will be an integral capability of Windows Vista and will also be supported on Windows XP and Windows Server 2003.
Microsoft has also done significant work to integrate the Windows Communication Foundation with existing Microsoft technologies for building distributed systems including COM+, MSMQ, and ASP.NET Web services. Applications built with those existing technologies can now be exposed as services without modification to the application. This infrastructure-level solution greatly assists developers in exposing existing applications as services. The Windows Communication Foundation also provides simple and mechanical mechanisms to migrate applications that use .NET remoting, ASP.NET Web services, and .NET Enterprise Services to natively use the Windows Communication Foundation programming model.

Is C# used for any core features of Windows Vista?
Yes, for example, much of the Windows Presentation Foundation is written using C#

Why do we need XAML as a new way to create applications in .NET Framework 3.0 (formerly WinFX)?

The new application model in Windows Vista separates out declarative code (XAML) from procedural code (C#, VB.NET, J#, etc.). One major reason for using XAML is to bridge the gap between developing an application for Microsoft Windows and developing an application for the Web.
XAML does not give you new functionality; it is just a declarative way to instantiate and initialize Microsoft .NET objects. XAML does, however, provide you with a way to solve problems such as:
When you write procedural code (C#, etc.) to create a number of controls, and compare that to the equivalent XAML, the XAML is more compact, less redundant, and less error-prone. Writing a designer for XAML will be a lot easier than writing a forms designer for C# or VB.NET, since the designer won’t have to do all that code parsing to figure out where to insert or change the setting of a property.
In the real world, many customers find requests coming in at the very last minute asking for changes to the user interface—a button needs to be moved or removed or the company logo needs to appear on every window. It is especially at the end of the development process, when you think your code is “frozen” and tested, that you’d rather not have to dive into the source code and start changing things. Who knows what subtle interaction you might break? With XAML, most—if not all—of the presentation layer is in its own file, thus providing a high degree of certainty that making a user interface change in the XAML will not break business logic code.
XAML enables professional graphic designers or user interface specialists to add beauty, style and grace to an application without modifying source files directly. Partitioning the user interface and the logic that drives it means each of us can get our job done without getting in each other’s way or having to understand the myriad details of one another’s tools.
XAML is considerably smaller than the equivalent C# code. Since there is less code, there are fewer opportunities for errors

XAML only used for quick UI prototyping?

XAML will be used for production work, not just for prototyping. Specifically, localizing your application or ensuring that it is accessible—common for most applications today—will be a lot more work if you build your own user interface from code instead of using XAML

Can XAML replace other programming languages like C# and VB?

No. XAML complements procedural languages, much the same way HTML complements ECMAScript. You can very quickly declare how you want your user interface to look with XAML, then use a language like C# to define the business logic behind that user interface

Can XAML be used to develop both Web and client-server applications?

XAML is used as part of Windows Presentation Foundation to write smart client applications that take advantage of the power of the PC and benefit from all of the power of the CLR. For Windows Presentation Foundation applications, the logic runs on the client, unlike ASP.NET, which processes on the server. ASP.NET continues to be the answer to producing powerful Web applications that take advantage of the benefits of the CLR on the server

What is NET Framework 3.0 ?

NET Framework 3.0 is the managed-code programming model for Windows, starting with Windows Vista. NET Framework 3.0 is a superset of the .NET Framework, designed to expose the new functionality in Windows Vista to the developer through managed classes. If you know how to write managed code on the .NET Framework today, NET Framework 3.0 will be familiar to you. Put another way, at PDC 2000, Microsoft debuted the .NET Framework, which introduced a new managed programming model on top of our existing Windows operating systems. With Windows Vista and NET Framework 3.0, we’re keeping that managed programming model while building new core parts of the operating system, such as moving the Windows Presentation Foundation subsystem next to GDI and User.

What is the difference between Windows Vista and .NET Framework 3.0 ?

A: The .NET Framework 3.0 is a managed-code programming model, including APIs for the Windows Presentation Foundation and the Windows Communication Foundation.

Where is the new functionality in the .NET Framework 3.0 (such as WCF, WF, WPF, and CardSpace) installed to? Is that different from where the .NET Framework 2.0 is installed to?

Components shared with the .NET Framework 2.0 are installed at %windir%\Microsoft.NET\Framework\V2.0.50727. Components that are new to the .NET Framework 3.0 are installed to %windir%\Microsoft.NET\Framework\V3.0. Check out the .NET 3.0 Deployment whitepaper for more information on installation and deployment.

How large is the .NET Framework 3.0? Does this change make the release larger?

There’s no change to the size of the .NET Framework 3.0 as a result of the name change from WinFX. It is about 49Mb, and that includes the .NET Framework 2.0, which is about 22Mb.
12. Q: How does servicing work for the .NET Framework 3.0? If I install the .NET Framework 3.0, can I get service updates for the .NET Framework 2.0?
Servicing will be available for the .NET Framework 2.0 components as long both it and the operating system it is installed on are still in service. Any service updates for the .NET Framework 2.0 will work for the 2.0 components installed as a part of the .NET Framework 3.0 as well.

What operating systems will the .NET Framework 3.0 be available for?

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

When will the .NET Framework 3.0 be released?

The .NET Framework 3.0 is included as part of Windows Vista, and customers who get Windows Vista will receive the .NET Framework 3.0. The first release of Windows Vista to business customers is currently planned for November 2006, although the final date will depend on customer feedback.
At the same time, we will make the .NET Framework 3.0 broadly available for download to all customers using Windows XP and Windows Server 2003.

How does the .NET Framework 3.0 relate to Windows Vista?

The .NET Framework 3.0 is a core component of the Windows Vista operating system, and is installed by default on Windows Vista. It will also be available for Windows XP and Windows Server 2003.

Are there any parts of the .NET Framework 3.0 that only work on Windows Vista?Though there are some optimizations in the .NET Framework 3.0 that take advantage of new functionality in Windows Vista, we’ve striven to provide a consistent experience for the .NET Framework 3.0 across Windows Vista, Windows Server 2003, and Windows XP.

Why is the .NET Framework 3.0 a major version number of the .NET Framework if it uses the .NET Framework 2.0 runtime and compiler?

The new technologies delivered in the .NET Framework 3.0, including WCF, WF, WPF, and CardSpace, offer tremendous functionality and innovation, and we wanted to signal that with a major release number.

How does “Side by Side” work for the .NET Framework 3.0?

Since the .NET Framework 3.0 includes only new components that are added to the .NET Framework 2.0 and there is no overlap between the assemblies of the .NET Framework 2.0 and the .NET Framework 3.0, there’s no real “Side by Side” scenario. You can run applications based on the .NET Framework 2.0 and applications based on the .NET Framework 3.0 on the same machine.

I’m running an application built on WinFX today. Do I need to do anything different to make it run on the .NET Framework 3.0?

No, applications running on WinFX will now run on the .NET Framework 3.0 without any changes. Of course, since the .NET Framework 3.0 is still under development, there may be changes to the framework in the future.

Can I remove particular .NET Framework 3.0 components?

No, the .NET Framework 3.0 components (WPF, WCF, WF, and CardSpace) are part of a single package, and are installed together.

Will C# 3.0, VB.NET 9.0, Atlas, or Linq be included in the .NET Framework 3.0?

No, these features are planned for future releases of the .NET Framework. The .NET Framework 3.0 includes only the technology formerly described as WinFX.

Will there be a .NET Compact Framework 3.0 release with release of .NET Framework 3.0?

No. We are currently working on developing a version of the .NET Framework 3.0 functionality that will be supported on the Compact Framework, but shipping plans and included functionality have not been announced.

What happens when I install the .NET Framework 3.0? How can I upgrade if I already have the .NET Framework 2.0 installed?

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.

My organization went through the approval process of supporting the .NET Framework 2.0 in production. Do we need to go through the same process all over again for the .NET Framework 3.0? Do I need to do any application compatibility testing for my .NET Framework 2.0 applications?

Because the .NET Framework 3.0 only adds new components to the .NET Framework 2.0 without changing any of the components released in the .NET Framework 2.0, the applications you’ve built on the .NET Framework 2.0 will not be affected. You don’t need to do any additional testing for your .NET Framework 2.0 applications when you install the .NET Framework 3.0.

Will the name change be reflected in any of the existing .NET Framework 2.0 APIs, assemblies, or namespaces?

There will be no changes to any of the existing .NET Framework 2.0 APIs, assemblies, or namespaces. The applications that you’ve built on .NET Framework 2.0 will continue to run on the .NET Framework 3.0 just as they have before.

Which version of the Common Language Runtime (CLR) does the .NET Framework 3.0 use?The .NET Framework 3.0 uses the 2.0 version of the CLR. With this release, the overall developer platform version has been decoupled from the core CLR engine version. We expect the lower level components of the .NET Framework such as the engine to change less than higher level APIs, and this decoupling helps retain customers’ investments in the technology.

What is the .NET Framework 3.0 (formerly WinFX)?

The .NET Framework 3.0 is Microsoft’s managed code programming model. It is a superset of the .NET Framework 2.0, combining .NET Framework 2.0 components with new technologies for building applications that have visually stunning user experiences, seamless and secure communication, and the ability to model a range of business processes. In addition to the .NET Framework 2.0, it includes Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), and Windows CardSpace.

What happens to the WinFX technologies?

The WinFX technologies will now be released under the name .NET Framework 3.0. There are no changes to the WinFX technologies or ship schedule — the same technologies you’re familiar with now simply have a new name.

How does the .NET Framework 3.0 relate to the .NET Framework 2.0?

The .NET Framework 3.0 is an additive release to the .NET Framework 2.0. The .NET Framework 3.0 adds four new technologies to the .NET Framework 2.0: Windows Presentation Foundation (WPF), Windows Workflow Foundation (WF), Windows Communication Foundation (WCF), and Windows CardSpace. 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 millions of 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.

XAML only used for quick UI prototyping?

XAML will be used for production work, not just for prototyping. Specifically, localizing your application or ensuring that it is accessible—common for most applications today—will be a lot more work if you build your own user interface from code instead of using XAML

XAML replace other programming languages like C# and VB?

No. XAML complements procedural languages, much the same way HTML complements ECMAScript. You can very quickly declare how you want your user interface to look with XAML, then use a language like C# to define the business logic behind that user interface

Can XAML be used to develop both Web and client-server applications?

XAML is used as part of Windows Presentation Foundation to write smart client applications that take advantage of the power of the PC and benefit from all of the power of the CLR. For Windows Presentation Foundation applications, the logic runs on the client, unlike ASP.NET, which processes on the server. ASP.NET continues to be the answer to producing powerful Web applications that take advantage of the benefits of the CLR on the server

Why do we need XAML as a new way to create applications in .NET Framework 3.0 (formerly WinFX)?

The new application model in Windows Vista separates out declarative code (XAML) from procedural code (C#, VB.NET, J#, etc.). One major reason for using XAML is to bridge the gap between developing an application for Microsoft Windows and developing an application for the Web.XAML does not give you new functionality; it is just a declarative way to instantiate and initialize Microsoft .NET objects. XAML does, however, provide you with a way to solve problems such as:
When you write procedural code (C#, etc.) to create a number of controls, and compare that to the equivalent XAML, the XAML is more compact, less redundant, and less error-prone. Writing a designer for XAML will be a lot easier than writing a forms designer for C# or VB.NET, since the designer won’t have to do all that code parsing to figure out where to insert or change the setting of a property.
In the real world, many customers find requests coming in at the very last minute asking for changes to the user interface—a button needs to be moved or removed or the company logo needs to appear on every window. It is especially at the end of the development process, when you think your code is “frozen” and tested, that you’d rather not have to dive into the source code and start changing things. Who knows what subtle interaction you might break? With XAML, most—if not all—of the presentation layer is in its own file, thus providing a high degree of certainty that making a user interface change in the XAML will not break business logic code.
XAML enables professional graphic designers or user interface specialists to add beauty, style and grace to an application without modifying source files directly. Partitioning the user interface and the logic that drives it means each of us can get our job done without getting in each other’s way or having to understand the myriad details of one another’s tools.
XAML is considerably smaller than the equivalent C# code. Since there is less code, there are fewer opportunities for errors


Why is XAML important for the delivery of e-commerce solutions?

As plug-and-play e-commerce emerges, businesses are mixing and matching web services from multiple partners to create sophisticated business web services. Because these “business webs” are comprised of aggregated calls to loosely coupled web services distributed across the web, and provided by multiple businesses, coordination among these web services is imperative, in order to carry out business-level transactions. There needs to be the notion of a transaction at the web service level, as well as a means by which software systems can coordinate the processing of calls to multiple web services to provide higher-level business transactions.
XAML will provide the standard mechanism to enable XML web services to participate in business transactions spanning multiple parties across the Web. Web services provide unprecedented business interoperability by enabling businesses to share processes and competencies on the web, creating a new era of business connectivity and dynamic, “plug-and-play” e-commerce.

What kind of applications will XAML enable?

As plug-and-play e-commerce emerges, businesses are mixing and matching web services from multiple partners to create sophisticated e-business applications. Because these “business webs” consist of loosely coupled web services distributed across the web from multiple businesses, coordination among these web services is imperative, in order to carry out business-level transactions. There needs to be the notion of a transaction at the web service level, as well as a means by which software systems can coordinate the processing of calls to multiple web services to provide higher-level business transactions.

Who is supporting XAML?

Bowstreet, Hewlett-Packard, IBM, Oracle and Sun are leading the XAML initiative to ensure distributed e-business transactions across the Internet. However, XAML is not owned by any one vendor. Instead, the standards proposal will be submitted to an appropriate open standards body to ensure that it remains an open industry standard in which any company and organization can participate.

How does XAML relate to other Web Service standards?

In order to understand how XAML relates to many of the existing standards, it is first necessary to understand what function each of these standards performs.When a web service is built, described, discovered and used, there are many elements that will be required. The combination of these many different elements is called a web services architecture. Some categories of these elements are: registries, business process modeling, negotiation, service description and web service transport protocols.
In order to use a web service, the existence of the service must be discovered. This discovery usually takes place in a “phone book” of web services known as a registry. Registries, such as UDDI and the ebXML registry/repository, contain human readable information that can be browsed and searched to find companies and their services.
Once a desired service is located, the terms of use can be reviewed and/or negotiated. The e-speak framework provides an elaborate negotiation mechanism. ebXML addresses the same issue through TPAML (Trading Partner Agreement Markup Language.)
Now that you know which service you need, you still have to know some additional things before you can use the web service; where is it located, what type of input it expects, what type of output it produces, which web service protocols it uses, etc. Service description languages, such as WSDL, provide a standard mechanism to outline all these details about a web service. Typically, for publicly available web services, their service descriptions are also made publicly available. The URI of the service description can be registered with a web service in a registry.
Once you know those details, you can start formulating a message to send to the service. However, some web services will require special packaging wrapped around the message, letting the web service know what to do with the message.
In this situation, an underlying web service transport protocol may need to be used, which can provide: an envelope which defines what is in a message and what program should deal with it2. specific information about how to exchange instances of application-defined data-types in a serialized format (You can think of this as how the programs agree on the format of a text-based XML file to send across the internet which contains information about a relational database or other complicated data structure within an application)3. a definition of a convention that can be used to represent remote procedure calls and responses.
XML-based web service transport protocols include: SOAP, XP (W3C XML Protocol) and ebXML Transport. Most of these web service transport protocols make use of existing protocols, such as: HTTP, SMTP, TCP, etc., to carry web service requests and responses across the internet.Another layer in the web services architecture is business process modeling. These languages define the business level descriptions of what needs to be accomplished. For example, they can describe a business scenario such as, “if a purchase order is received by my purchasing web service, the steps that need to be completed are: check inventory; if the inventory is available, ship product; if product ships, let accounting know, etc.” Business process modeling languages determine what needs to be completed and the necessary order of completion. However, they do not control nor monitor the underlying transactions themselves, where XAML is used to initiate, monitor, commit, cancel, retry, or initiate a compensating transaction.Consider this web services architecture example: A distributor of groceries needs to process an order from ACME grocery store. Included in the order is an order for 100lbs of fresh tomatoes. The grocery distributor needs to process this order. In order to fulfill this order the web services architecture will be used in a variety of ways.
The first requirement (even before the distributor gets the order) is to discover that Johnny’s Tomato Farm and Jimmy’s Refrigerated Transport provide the necessary business services. Both services are discovered via a registry; in this case, the distributor searched several different registries.
The second action is to make sure the distributor’s business web understands how to talk with each of these web services. This is done by downloading a service description for each of the two services. The registry entry indicated that Jimmy’s Refrigerated Transport is described as an e-speak service; whereas, Johnny’s Tomato Farm services are based solely on SOAP. An XML description is retrieved for the e-speak service and a WSDL document is retrieved for the SOAP service. Links to the service description documents were found in the registry entries.
An additional action must also happen before the order is placed. The business process model of a purchase order must be executed. 1)check to make sure that the person ordering is authorized to order; 2)check to make sure the ordering company has paid their last invoice; and 3)proceed to order the merchandise by ensuring that both services get managed using XAML. This entire business process is defined by an ebXML business process model. Some additional models may need to be set up…. If the item is perishable, then verify the transport availability, etc.
Now, the grocery distributor is ready for action and can accept a tomato order from ACME grocery store.
The order from ACME grocery store is taken via the distributor’s business web, and according to the business process model, the person is authorized and the finance department gives the approval. The transaction is begun on a business level. Because Tomatoes are marked as perishable, the “perishable food” model is initiated.
This model determines the business logic which states that transport must be arranged before tomatoes can be officially ordered. This logic is then used by the software that coordinates the calling of the relevant web services. The calling system prepares a message directed to a web service at Johnny’s Tomato Farm using SOAP, along with XAML to specify initiation of the transaction. In like manner, the system requests a web service at Jimmy’s Refrigerated Transport to supply the truck and driver, again using XAML to stage the request. Once both web services have responded confirming availability, the calling system interacts with the web services using XAML to facilitate the completion of the business process.

How does XAML relate to registries (UDDI)?

UDDI defines a registry for companies and their services. In a typical scenario using UDDI, a user/program would browse through categories (like in a yellow pages) for a particular service. Once the desired XML service is found, the ’service description’ for that service can be used to retrieve the details of calling that service (see service description languages section.) The ‘service description’ (WSDL, etc), defines the semantics of calling a specific service.
As with any other type of service, XAML services will be able to be registered and located within UDDI registries. UDDI can register XAML services.

How does XAML relate to service description languages (WSDL, XMI)?

Services description languages define the details that are needed to use a web service. Typically that includes: schema for the input, schema for the output, URI of the service, type of transport used (SOAP, XP, HTTP GET, …) The XAML group will consider providing binding information to service description languages.

How does XAML relate to business process modeling languages (ebXML business process, BPML)?

BPML covers dimensions of business process modeling that are specific to processes internal to the enterprise, including business rules, security roles, distributed transactions, and exception handling. XAML is targeted at coordinating business transactions that span web services crossing corporate boundaries.

How does XAML relate to XML-based web service transport protocols (XP, SOAP, ebXML Transport)?

XAML is designed for the coordination of transactional web services, not XML transportation and packaging issues. XAML will work with standard XML-based service transport protocols, including W3C XML Protocol (XP), SOAP and ebXML transport protocol.

How does XAML relate to ebXML?

ebXML is an OASIS/UN initiative to define all the layers in the web services stack. That includes categories such as registries, business process modeling, service descriptions, and transport/packaging/messaging. Please refer to the above explanation for details on how XAML relates to each of these categories.

How does XAML relate to e-speak?

E-speak is an open software platform designed for supporting the description, registration, and discovery of e-services, the ability to compose multiple e-services into higher-level e-services, the ability to negotiate among e-services, and the ability to manage e-service interactions. XAML will enhance the e-speak platform for the coordination and processing of online business transactions involving e-services. XAML provides e-speak with a standard set of XML message formats and interaction models for e-services to use to provide business level transactions that span across companies over the Internet.

How does XAML relate to BizTalk/.NET?

BizTalk/.Net is a Microsoft initiative to define all the layers in the web services stack. That includes four categories, registries(UDDI), business modeling languages (X-Lang), service descriptions (WSDL), and transport/packaging/messaging(SOAP). Please refer to the above explanation for details on how XAML relates to each of these categories.

What standards body will XAML be submitted to?

At this time, the XAML group has not determined which standards body is the most appropriate for XAML. However, as the specification evolves, the group will vote on an appropriate organization and submit a draft of the specification.

How does XAML support/extend existing transaction monitors?

XAML will enable web services to expose transactional semantics of the resources providing the services. Given that TP monitors commonly provide some of the management and coordination functions of these resources ‘behind the firewall” today, one of the goals of XAML is to enable TP monitors to participate and support the transactional semantics offered by web services. This includes passing of transaction ID’s through web service messages, and supporting the XAML web service operations of commit and cancel. At the level above individual web services, there is a new layer of software providing business-level transactions. This software makes calls to multiple web services, often spanning business boundaries. Given that XAML enables individual web services to support transactional semantics, there is also an opportunity for XAML to specify standard means for coordinating business-level transactions across collections of web services. To this end, one of the goals of XAML is to define message interfaces and interaction models that help software systems providing the business-level transactions to coordinate the interactions among web services. There is an opportunity to define XML interfaces and interaction models for a new breed of web services that would help software systems at the business transaction level. These services would provide brokering capabilities for managing the interactions among web services, for both web services supporting XAML, as well as web services that do not support XAML. This new breed of web services requires XML interfaces and interaction models that defines how software systems at the business transaction level would interact, to request assistance in shepherding a set of web services towards completion.

What is the relationship between XAML and other transaction protocols?

Classical online transaction management (OLTP) is the process of making simultaneous changes in several places “atomically” - that is, all the changes related to a transaction are made or none of the changes are made.
For example, within a single database connection, the DBMS provides some means of demarcating the beginning and end of a transaction. This demarcation ensures that changes to the database are made atomically. Sometimes, changes must be made atomically across multiple databases. For example, an insurance company might have to change both its claims information and its audit information at the same time, even though the audit information is in a separate database from the claims information. This multiple-database change would ensure that, during a later audit, the company would know which agent took the first report of the loss. In this case, the existing XA (Transaction Authority) protocol is useful. XA provides a standard mechanism for coordinating changes to multiple databases (called resource managers or RMs) as an atomic unit of work. Basically, the XA protocol asks each RM to vote on whether a commit will be successful. Once an RM has voted “yes,” it must be able to commit the open unit of work without failure. The commit occurs only if all RMs vote “yes.” This process of obtaining a vote, and then performing a commit, is called a “two-phase commit.”
Resource managers are most frequently databases, but they can also be message-oriented middleware. XA allows completely heterogeneous collections of RMs within a single transaction; for example a transaction can commit across DB/2 and Oracle at the same time. All major database vendors support XA.

What is the relationship between XAML and JTS/JTA?

J2EE includes support for distributed transactions through two specifications, Java Transaction API (JTA) and Java Transaction Service (JTS). JTA is a high level, implementation independent, protocol independent API that allows applications to access transactions. JTS specifies the implementation of a Transaction Manager which supports JTA and implements the Java mapping of the OMG Object Transaction Service (OTS) 1.1 specification using the IIOP protocol. The JTA API allows you to demarcate transactions in a manner that is independent of the transaction manager service or JTS.
While JTA provides an API for demarcating transactions in Java-based application logic, XAML provides an agreed upon protocol or a coordinated process of interaction among transactionally-aware web services over a defined transport. Given this, a web service internally implementing JTA could expose these transactional capabilities using XAML.

Thursday, May 6, 2010

C++ Object-Oriented Interview Questions And Answers




What is a modifier?
A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as ‘mutators’. Example: The function mod is a modifier in the following code snippet:

class test
{
int x,y;
public:
test()
{
x=0; y=0;
}
void mod()
{
x=10;
y=15;
}
};
What is an accessor?
An accessor is a class operation that does not modify the state of an object. The accessor functions need to be declared as const operations
Differentiate between a template class and class template?
Template class: A generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates. Class template: A class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.
When does a name clash occur?
A name clash occurs when a name is defined in more than one place. For example., two different class libraries could give two different classes the same name. If you try to use many class libraries at the same time, there is a fair chance that you will be unable to compile or link the program because of name clashes.
Define namespace?

It is a feature in C++ to minimize name collisions in the global name space. This namespace keyword assigns a distinct name to a library that allows other libraries to use the same identifier names without creating any name collisions. Furthermore, the compiler uses the namespace signature for differentiating the definitions.

What is the use of ‘using’ declaration ?
A using declaration makes it possible to use a name from a namespace without the scope operator.
What is an Iterator class ?
A class that is used to traverse through the objects maintained by a container class. There are five categories of iterators: input iterators, output iterators, forward iterators, bidirectional iterators, random access. An iterator is an entity that gives access to the contents of a container object without violating encapsulation constraints. Access to the contents is granted on a one-at-a-time basis in order. The order can be storage order (as in lists and queues) or some arbitrary order (as in array indices) or according to some ordering relation (as in an ordered binary tree). The iterator is a construct, which provides an interface that, when called, yields either the next element in the container, or some value denoting the fact that there are no more elements to examine. Iterators hide the details of access to and update of the elements of a container class.
The simplest and safest iterators are those that permit read-only access to the contents of a container class.

What is an incomplete type?
Incomplete types refers to pointers in which there is non availability of the implementation of the referenced location or it points to some location whose value is not available for modification.

int *i=0x400 // i points to address 400
*i=0; //set the value of memory location pointed by i.

Incomplete types are otherwise called uninitialized pointers.

What is a dangling pointer?
A dangling pointer arises when you use the address of an object after
its lifetime is over. This may occur in situations like returning
addresses of the automatic variables from a function or using the
address of the memory block after it is freed. The following
code snippet shows this:

class Sample
{
public:
int *ptr;
Sample(int i)
{
ptr = new int(i);
}

~Sample()
{
delete ptr;
}
void PrintVal()
{
cout << "The value is " << *ptr;
}
};

void SomeFunc(Sample x)
{
cout << "Say i am in someFunc " <<>
}

int main()
{
Sample s1 = 10;
SomeFunc(s1);
s1.PrintVal();
}

In the above example when PrintVal() function is
called it is called by the pointer that has been freed by the
destructor in SomeFunc.

Differentiate between the message and method?
Message:
* Objects communicate by sending messages to each other.
* A message is sent to invoke a method.

Method
* Provides response to a message.
* It is an implementation of an operation.

What is an adaptor class or Wrapper class?
A class that has no functionality of its own. Its member functions hide the use of a third party software component or an object with the non-compatible interface or a non-object-oriented implementation.
What is a Null object?
It is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member function that is supposed to return an object with some specified properties but cannot find such an object.
What is class invariant?
A class invariant is a condition that defines all valid states for an object. It is a logical condition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must be preserved under all operations of the class. In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class.
What do you mean by Stack unwinding?
It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.
Define precondition and post-condition to a member function?
Precondition: A precondition is a condition that must be true on entry to a member function. A class is used correctly if preconditions are never false. An operation is not responsible for doing anything sensible if its precondition fails to hold. For example, the interface invariants of stack class say nothing about pushing yet another element on a stack that is already full. We say that isful() is a precondition of the push operation. Post-condition: A post-condition is a condition that must be true on exit from a member function if the precondition was valid on entry to that function. A class is implemented correctly if post-conditions are never false. For example, after pushing an element on the stack, we know that isempty() must necessarily hold. This is a post-condition of the push operation.
What are the conditions that have to be met for a condition to be an invariant of the class?
* The condition should hold at the end of every constructor.
* The condition should hold at the end of every mutator (non-const) operation.

What are proxy objects?
Objects that stand for other objects are called proxy objects or surrogates.
template
class Array2D
{
public:
class Array1D
{
public:
T& operator[] (int index);
const T& operator[] (int index)const;
};

Array1D operator[] (int index);
const Array1D operator[] (int index) const;
};

The following then becomes legal:

Array2Ddata(10,20);
cout<

Here data[3] yields an Array1D object and the operator [] invocation on that object yields the float in position(3,6) of the original two dimensional array. Clients of the Array2D class need not be aware of the presence of the Array1D class. Objects of this latter class stand for one-dimensional array objects that, conceptually, do not exist for clients of Array2D. Such clients program as if they were using real, live, two-dimensional arrays. Each Array1D object stands for a one-dimensional array that is absent from a conceptual model used by the clients of Array2D. In the above example, Array1D is a proxy class. Its instances stand for one-dimensional arrays that, conceptually, do not exist.

Name some pure object oriented languages?

Smalltalk, Java, Eiffel, Sather.

What is an orthogonal base class?
If two base classes have no overlapping methods or data they are said to be independent of, or orthogonal to each other. Orthogonal in the sense means that two classes operate in different dimensions and do not interfere with each other in any way. The same derived class may inherit such classes with no difficulty
What is a node class?
A node class is a class that,
* relies on the base class for services and implementation,
* provides a wider interface to the users than its base class,
* relies primarily on virtual functions in its public interface
* depends on all its direct and indirect base class
* can be understood only in the context of the base class
* can be used as base for further derivation
* can be used to create objects.
A node class is a class that has added new services or functionality beyond the services inherited from its base class.

What is a container class? What are the types of container classes?
A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a well-known interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.
How do you write a function that can reverse a linked-list?
Answer1:

void reverselist(void)
{
if(head==0)
return;
if(head-
return;
if(head-
{
head-
tail-
}
else
{
node* pre = head;
node* cur = head-
node* curnext = cur-
head-
cur-

for(; curnext!=0; )
{
cur-
pre = cur;
cur = curnext;
curnext = curnext-
}

curnext-
}
}

Answer2:

node* reverselist(node* head)
{
if(0==head || 0==head->next)
//if head->next ==0 should return head instead of 0;
return 0;

{
node* prev = head;
node* curr = head->next;
node* next = curr->next;

for(; next!=0; )
{
curr->next = prev;
prev = curr;
curr = next;
next = next->next;
}
curr->next = prev;

head->next = 0;
head = curr;
}

return head;
}

What is polymorphism?
Polymorphism is the idea that a base class can be inherited by several classes. A base class pointer can point to its child class and a base class array can store different child class objects.
How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.
How can you tell what shell you are running on UNIX system?
You can do the Echo $RANDOM. It will return a undefined variable if you are from the C-Shell, just a return prompt if you are from the Bourne shell, and a 5 digit random numbers if you are from the Korn shell. You could also do a ps -l and look for the shell with the highest PID.
What is Boyce Codd Normal form?
A relation schema R is in BCNF with respect to a set F of functional dependencies if for all functional dependencies in F+ of the form a->b, where a and b is a subset of R, at least one of the following holds:

* a->b is a trivial functional dependency (b is a subset of a)
* a is a superkey for schema R

What is pure virtual function?
A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is one with an initializer of = 0 in its declaration
Write a Struct Time where integer m, h, s are its members
struct Time
{
int m;
int h;
int s;
};

How do you traverse a Btree in Backward in-order?
Process the node in the right subtree
Process the root
Process the node in the left subtree

What is the two main roles of Operating System?
As a resource manager
As a virtual machine

In the derived class, which data member of the base class are visible?
In the public and protected sections.