tag:blogger.com,1999:blog-90889870067898451232024-03-13T18:05:55.843+05:30Job Interview Questions - www.interviewhelper.orgwww.interviewhelper.org is a hope for all the Job seekers. Users can find unlimited here. These range from technical to HR, from functional to behavioral. www.interviewhelper.org contains in the fields like Ajax,VB,Networking,Sharepoint,JEE,Perl,Javascript,Bioinformatics,Classic ASP,Unix,Linux,Accounting,Oracle DBA,Microprocessor,Bluetooth,jms,jme,.net framework,ABAP,ASP,ASP.net,Basic .net Framework,Interview Questions,C language,C++,database,Oracle,Java,PHP,LAMP,SAP etc.Gaurav Nandahttp://www.blogger.com/profile/12749165288430220644noreply@blogger.comBlogger1317125tag:blogger.com,1999:blog-9088987006789845123.post-88301663638400806222010-05-07T00:32:00.003+05:302016-02-19T07:17:12.144+05:30ASP.NET 3.0 Interview Questions<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /><b><br /></b></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><b>What is the Windows Presentation Foundation? </b></span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What is the Windows Communication Foundation?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">The Windows Communication Foundation is a set of technologies for building and running connected systems.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Is C# used for any core features of Windows Vista?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">Yes, for example, much of the Windows Presentation Foundation is written using C#</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Why do we need XAML as a new way to create applications in .NET Framework 3.0 (formerly WinFX)?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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:</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">XAML is considerably smaller than the equivalent C# code. Since there is less code, there are fewer opportunities for errors</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;"> XAML only used for quick UI prototyping?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Can XAML replace other programming languages like C# and VB?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Can XAML be used to develop both Web and client-server applications?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What is NET Framework 3.0 ?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What is the difference between Windows Vista and .NET Framework 3.0 ?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">A: The .NET Framework 3.0 is a managed-code programming model, including APIs for the Windows Presentation Foundation and the Windows Communication Foundation.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">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?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How large is the .NET Framework 3.0? Does this change make the release larger? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What operating systems will the .NET Framework 3.0 be available for? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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).</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">When will the .NET Framework 3.0 be released?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does the .NET Framework 3.0 relate to Windows Vista?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-weight: bold;">Are there any parts of the .NET Framework 3.0 that only work on Windows Vista?</span>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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">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? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does “Side by Side” work for the .NET Framework 3.0? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">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? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Can I remove particular .NET Framework 3.0 components? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">No, the .NET Framework 3.0 components (WPF, WCF, WF, and CardSpace) are part of a single package, and are installed together.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Will C# 3.0, VB.NET 9.0, Atlas, or Linq be included in the .NET Framework 3.0? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Will there be a .NET Compact Framework 3.0 release with release of .NET Framework 3.0? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What happens when I install the .NET Framework 3.0? How can I upgrade if I already have the .NET Framework 2.0 installed?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">installer will only install the new components of the .NET Framework 3.0.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">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?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Will the name change be reflected in any of the existing .NET Framework 2.0 APIs, assemblies, or namespaces? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><span style="font-weight: bold;">Which version of the Common Language Runtime (CLR) does the .NET Framework 3.0 use?</span>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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What is the .NET Framework 3.0 (formerly WinFX)?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What happens to the WinFX technologies?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does the .NET Framework 3.0 relate to the .NET Framework 2.0? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;"> XAML only used for quick UI prototyping?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;"> XAML replace other programming languages like C# and VB?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Can XAML be used to develop both Web and client-server applications?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Why do we need XAML as a new way to create applications in .NET Framework 3.0 (formerly WinFX)?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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:</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">XAML is considerably smaller than the equivalent C# code. Since there is less code, there are fewer opportunities for errors</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Why is XAML important for the delivery of e-commerce solutions? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What kind of applications will XAML enable?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">Who is supporting XAML? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to other Web Service standards?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.)</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">Now, the grocery distributor is ready for action and can accept a tomato order from ACME grocery store.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to registries (UDDI)?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to service description languages (WSDL, XMI)?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to business process modeling languages (ebXML business process, BPML)?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to XML-based web service transport protocols (XP, SOAP, ebXML Transport)?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to ebXML?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to e-speak?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML relate to BizTalk/.NET?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What standards body will XAML be submitted to?</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">How does XAML support/extend existing transaction monitors? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What is the relationship between XAML and other transaction protocols? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.”</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif; font-weight: bold;">What is the relationship between XAML and JTS/JTA? </span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;"><br /></span>
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span><br />
<span style="font-family: "arial" , "helvetica" , sans-serif;">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.</span></div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com6tag:blogger.com,1999:blog-9088987006789845123.post-34309573101260799142010-05-06T23:32:00.002+05:302016-02-19T07:20:32.793+05:30C++ Object-Oriented Interview Questions And Answers<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<link href="file:///C:%5CUsers%5Cshivlee%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml" rel="File-List"></link><link href="file:///C:%5CUsers%5Cshivlee%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx" rel="themeData"></link><link href="file:///C:%5CUsers%5Cshivlee%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml" rel="colorSchemeMapping"></link><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:trackmoves/> <w:trackformatting/> <w:punctuationkerning/> <w:validateagainstschemas/> <w:saveifxmlinvalid>false</w:SaveIfXMLInvalid> <w:ignoremixedcontent>false</w:IgnoreMixedContent> <w:alwaysshowplaceholdertext>false</w:AlwaysShowPlaceholderText> <w:donotpromoteqf/> <w:lidthemeother>EN-GB</w:LidThemeOther> <w:lidthemeasian>X-NONE</w:LidThemeAsian> <w:lidthemecomplexscript>X-NONE</w:LidThemeComplexScript> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> <w:dontgrowautofit/> <w:splitpgbreakandparamark/> <w:dontvertaligncellwithsp/> <w:dontbreakconstrainedforcedtables/> <w:dontvertalignintxbx/> <w:word11kerningpairs/> <w:cachedcolbalance/> </w:Compatibility> <m:mathpr> <m:mathfont val="Cambria Math"> <m:brkbin val="before"> <m:brkbinsub val="--"> <m:smallfrac val="off"> <m:dispdef/> <m:lmargin val="0"> <m:rmargin val="0"> <m:defjc val="centerGroup"> <m:wrapindent val="1440"> <m:intlim val="subSup"> <m:narylim val="undOvr"> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"> <w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"> <w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"> <w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"> <w:lsdexception locked="false" priority="39" name="toc 1"> <w:lsdexception locked="false" priority="39" name="toc 2"> <w:lsdexception locked="false" priority="39" name="toc 3"> <w:lsdexception locked="false" priority="39" name="toc 4"> <w:lsdexception locked="false" priority="39" name="toc 5"> <w:lsdexception locked="false" priority="39" name="toc 6"> <w:lsdexception locked="false" priority="39" name="toc 7"> <w:lsdexception locked="false" priority="39" name="toc 8"> <w:lsdexception locked="false" priority="39" name="toc 9"> <w:lsdexception locked="false" priority="35" qformat="true" name="caption"> <w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"> <w:lsdexception locked="false" priority="1" name="Default Paragraph Font"> <w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"> <w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"> <w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"> <w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"> <w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"> <w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"> <w:lsdexception locked="false" unhidewhenused="false" name="Revision"> <w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"> <w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"> <w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"> <w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"> <w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"> <w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"> <w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"> <w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"> <w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"> <w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"> <w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"> <w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"> <w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"> <w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"> <w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"> <w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"> <w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"> <w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"> <w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"> <w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"> <w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"> <w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"> <w:lsdexception locked="false" priority="37" name="Bibliography"> <w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"> </w:LatentStyles> </xml><![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:1; mso-generic-font-family:roman; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:0 0 0 0 0 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin-top:0cm; margin-right:0cm; margin-bottom:10.0pt; margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-ansi-language:EN-US; mso-fareast-language:EN-US;} p {mso-style-noshow:yes; mso-style-priority:99; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:"Times New Roman"; mso-ansi-language:EN-US; mso-fareast-language:EN-US;} span.style54 {mso-style-name:style54; mso-style-unhide:no;} span.answers {mso-style-name:answers; mso-style-unhide:no;} span.forquestionsblue {mso-style-name:for_questions_blue; mso-style-unhide:no;} span.style53 {mso-style-name:style53; mso-style-unhide:no;} .MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-ansi-language:EN-US; mso-fareast-language:EN-US;} .MsoPapDefault {mso-style-type:export-only; margin-bottom:10.0pt; line-height:115%;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} </style> </div>
<span style="color: #444444;"><br /></span>
<div class="MsoNormal" style="line-height: normal;">
<span style="color: #444444;"><br /></span>
<span style="color: #444444;"><br /></span></div>
<div class="MsoNormal" style="font-weight: bold; line-height: normal;">
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span style=""><span lang="EN-US" style="font-size: 12pt;">What is a modifier? </span></span><span lang="EN-US" style="font-size: 12pt;"></span></span></div>
<div class="MsoNormal" style="line-height: normal;">
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif; font-size: 12pt;"> 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:
<br />
<br />class test
<br />{
<br />int x,y;
<br />public:
<br />test()
<br />{
<br />x=0; y=0;
<br />}
<br />void mod()
<br />{
<br />x=10;
<br />y=15;
<br />}
<br />};<o:p></o:p></span></div>
<div class="MsoNormal" style="line-height: normal;">
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b><span lang="EN-US" style="font-size: 12pt;">What is an accessor?</span></b><span lang="EN-US" style="font-size: 12pt;"> </span><span lang="EN-US" style="font-size: 12pt;"></span></span></div>
<div class="MsoNormal" style="line-height: normal;">
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif; font-size: 12pt;"><span style=""> </span>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<o:p></o:p></span></div>
<div style="">
<span class="style53" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b>Differentiate between a template class and class template?</b></span></div>
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style=""> </b><span class="answers"><span lang="EN-US">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. </span></span></span><br />
<div style="">
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b><span lang="EN-US">When does a name clash occur? </span></b><span lang="EN-US"></span></span></div>
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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. </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style=""><span lang="EN-US">Define namespace?</span></b><span lang="EN-US">
<br />
<br /><span class="answers">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. </span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is the use of ‘using’ declaration ?</b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">A using declaration makes it possible to use a name from a namespace without the scope operator. </span></span><br />
<div style="">
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b>What is an Iterator class ? </b><span lang="EN-US"></span></span></div>
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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.</span>
<br /><span class="answers">The simplest and safest iterators are those that permit read-only access to the contents of a container class.</span> </span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is an incomplete type? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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. </span>
<br />
<br /><span class="answers">int *i=0x400 // i points to address 400</span>
<br /><span class="answers">*i=0; //set the value of memory location pointed by i. </span>
<br />
<br /><span class="answers">Incomplete types are otherwise called uninitialized pointers.</span></span><br />
<div style="">
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b>What is a dangling pointer? </b><span lang="EN-US"></span></span></div>
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">A dangling pointer arises when you use the address of an object after</span>
<br /><span class="answers">its lifetime is over. This may occur in situations like returning</span>
<br /><span class="answers">addresses of the automatic variables from a function or using the</span>
<br /><span class="answers">address of the memory block after it is freed. The following</span>
<br /><span class="answers">code snippet shows this:</span>
<br />
<br /><span class="answers">class Sample</span>
<br />{
<br /><span class="answers">public:</span>
<br /><span class="answers">int *ptr;</span>
<br /><span class="answers">Sample(int i)</span>
<br />{
<br /><span class="answers">ptr = new int(i);</span>
<br />}
<br />
<br /><span class="answers">~Sample()</span>
<br />{
<br /><span class="answers">delete ptr;</span>
<br />}
<br /><span class="answers">void PrintVal()</span>
<br />{
<br /><span class="answers">cout << "The value is " << *ptr;</span>
<br />}
<br /><span class="answers">};</span>
<br />
<br /><span class="answers">void SomeFunc(Sample x)</span>
<br />{
<br /><span class="answers">cout << "Say i am in someFunc " <<>
<br />}
<br />
<br /><span class="answers">int main()</span>
<br />{
<br /><span class="answers">Sample s1 = 10;</span>
<br /><span class="answers">SomeFunc(s1);</span>
<br /><span class="answers">s1.PrintVal();</span>
<br />}
<br />
<br /><span class="answers">In the above example when PrintVal() function is</span>
<br /><span class="answers">called it is called by the pointer that has been freed by the</span>
<br /><span class="answers">destructor in SomeFunc.</span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span class="style53" style=""><b>Differentiate between the message and method?</b></span><b><span lang="EN-US" style="color: red;"></span></b></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b><span lang="EN-US" style="color: red;"> </span></b><span class="answers"><span lang="EN-US">Message:</span></span><span lang="EN-US">
<br /><span class="answers">* Objects communicate by sending messages to each other.</span>
<br /><span class="answers">* A message is sent to invoke a method.</span>
<br />
<br /><span class="answers">Method</span>
<br /><span class="answers">* Provides response to a message.</span>
<br /><span class="answers">* It is an implementation of an operation.</span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is an adaptor class or Wrapper class? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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. </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is a Null object? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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.</span> </span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is class invariant? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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. </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What do you mean by Stack unwinding? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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. </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">Define precondition and post-condition to a member function?</b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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. </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What are the conditions that have to be met for a condition to be an invariant of the class? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">* The condition should hold at the end of every constructor.</span>
<br /><span class="answers">* The condition should hold at the end of every mutator (non-const) operation. </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What are proxy objects?</b><span lang="EN-US" style=""> </span><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">Objects that stand for other objects are called proxy objects or surrogates. </span>
<br /><span class="answers">template <class t=""></class></span>
<br /><span class="answers">class Array2D</span>
<br />{
<br /><span class="answers">public:</span>
<br /><span class="answers">class Array1D</span>
<br />{
<br /><span class="answers">public:</span>
<br /><span class="answers">T& operator[] (int index);</span>
<br /><span class="answers">const T& operator[] (int index)const;</span>
<br /><span class="answers">};</span>
<br />
<br /><span class="answers">Array1D operator[] (int index);</span>
<br /><span class="answers">const Array1D operator[] (int index) const;</span>
<br /><span class="answers">};</span>
<br />
<br /><span class="answers">The following then becomes legal:</span>
<br />
<br /><span class="answers">Array2D<float>data(10,20);</float></span>
<br /><span class="answers">cout<<data>
<br />
<br /><span class="answers">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. </span></data></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">Name some pure object oriented languages?</b><span lang="EN-US">
<br />
<br /> <span class="answers">Smalltalk, Java, Eiffel, Sather.</span> </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is an orthogonal base class? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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</span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span class="style54" style=""><b>What is a node class?</b></span><b><span lang="EN-US" style="color: blue;"></span></b></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b><span lang="EN-US" style="color: blue;"> </span></b><span class="answers"><span lang="EN-US">A node class is a class that,</span></span><span lang="EN-US">
<br /><span class="answers">* relies on the base class for services and implementation,</span>
<br /><span class="answers">* provides a wider interface to the users than its base class,</span>
<br /><span class="answers">* relies primarily on virtual functions in its public interface</span>
<br /><span class="answers">* depends on all its direct and indirect base class</span>
<br /><span class="answers">* can be understood only in the context of the base class</span>
<br /><span class="answers">* can be used as base for further derivation</span>
<br /><span class="answers">* can be used to create objects.</span>
<br /><span class="answers">A node class is a class that has added new services or functionality beyond the services inherited from its base class.</span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is a container class? What are the types of container classes? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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. </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">How do you write a function that can reverse a linked-list? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">Answer1:</span>
<br />
<br /><span class="answers">void reverselist(void)</span>
<br />{
<br /><span class="answers">if(head==0)</span>
<br /><span class="answers">return;</span>
<br /><span class="answers">if(head-<next span="">
<br /><span class="answers">return;</span>
<br /><span class="answers">if(head-<next span="" tail="">
<br />{
<br /><span class="answers">head-<next>
<br /><span class="answers">tail-<next>
<br />}
<br /><span class="answers">else</span>
<br />{
<br /><span class="answers">node* pre = head;</span>
<br /><span class="answers">node* cur = head-<next span="">
<br /><span class="answers">node* curnext = cur-<next span="">
<br /><span class="answers">head-<next>
<br /><span class="answers">cur-<next>
<br />
<br /><span class="answers">for(; curnext!=0; )</span>
<br />{
<br /><span class="answers">cur-<next>
<br /><span class="answers">pre = cur;</span>
<br /><span class="answers">cur = curnext;</span>
<br /><span class="answers">curnext = curnext-<next span="">
<br />}
<br />
<br /><span class="answers">curnext-<next>
<br />}
<br />}
<br />
<br /><span class="answers">Answer2:</span>
<br />
<br /><span class="answers">node* reverselist(node* head)</span>
<br />{
<br /><span class="answers">if(0==head || 0==head->next) </span>
<br /><span class="answers">//if head->next ==0 should return head instead of 0;</span>
<br /><span class="answers">return 0;</span>
<br />
<br />{
<br /><span class="answers">node* prev = head;</span>
<br /><span class="answers">node* curr = head->next;</span>
<br /><span class="answers">node* next = curr->next;</span>
<br />
<br /><span class="answers">for(; next!=0; )</span>
<br />{
<br /><span class="answers">curr->next = prev;</span>
<br /><span class="answers">prev = curr;</span>
<br /><span class="answers">curr = next;</span>
<br /><span class="answers">next = next->next;</span>
<br />}
<br /><span class="answers">curr->next = prev;</span>
<br />
<br /><span class="answers">head->next = 0;</span>
<br /><span class="answers">head = curr;</span>
<br />}
<br />
<br /><span class="answers">return head;</span>
<br />}</next></span></next></span></next></span></next></span></next></span></next></span></next></span></next></span></next></span></next></span></next></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is polymorphism? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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.</span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">How do you find out if a linked-list has an end? (i.e. the list is not a cycle) </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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.</span></span><br />
<span class="style53" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b>How can you tell what shell you are running on UNIX system?</b></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style=""> </b><span class="answers"><span lang="EN-US">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. </span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is Boyce Codd Normal form? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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: </span>
<br />
<br /><span class="answers">* a->b is a trivial functional dependency (b is a subset of a)</span>
<br /><span class="answers">* a is a superkey for schema R </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is pure virtual function? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">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</span> </span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span class="forquestionsblue" style=""><b><span lang="EN-US">Write a Struct Time where integer m, h, s are its members </span></b></span><span lang="EN-US">
<br /> <span class="answers">struct Time</span>
<br />{
<br /><span class="answers">int m;</span>
<br /><span class="answers">int h;</span>
<br /><span class="answers">int s;</span>
<br /><span class="answers">};</span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style=""><span lang="EN-US">How do you traverse a Btree in Backward in-order? </span></b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">Process the node in the right subtree</span>
<br /><span class="answers">Process the root</span>
<br /><span class="answers">Process the node in the left subtree </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">What is the two main roles of Operating System? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">As a resource manager</span>
<br /><span class="answers">As a virtual machine </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><b style="">In the derived class, which data member of the base class are visible? </b><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">In the public and protected sections.</span></span></div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-49661495492518589372010-05-06T23:27:00.002+05:302016-02-19T07:21:54.180+05:30C++ programming Interview Questions on UNIX<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-weight: bold;"><span style="color: #444444;"><br /></span></span>
<span style="font-weight: bold;"><span style="color: #444444;">Could you tell something about the Unix System Kernel?</span></span><br />
<span style="color: #444444;">The kernel is the heart of the UNIX operating system, it’s responsible for controlling the computer’s resources and scheduling user jobs so that each one gets its fair share of resources.</span><br />
<span style="color: #444444;">What are each of the standard files and what are they normally associated with?</span><br />
<span style="color: #444444;">They are the standard input file, the standard output file and the standard error file. The first is usually associated with the keyboard, the second and third are usually associated with the terminal screen.</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-weight: bold;">Determine the code below, tell me exactly how many times is the operation sum++ performed ? </span><br />
<span style="color: #444444;">for ( i = 0; i < j =" 100;"> 100 - i; j–)</span><br />
<span style="color: #444444;">sum++;</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">(99 * 100)/2 = 4950</span><br />
<span style="color: #444444;">The sum++ is performed 4950 times.</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-weight: bold;">Give 4 examples which belongs application layer in TCP/IP architecture? </span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">FTP, TELNET, HTTP and TFTP</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-weight: bold;">What’s the meaning of ARP in TCP/IP? </span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">The "ARP" stands for Address Resolution Protocol. The ARP standard defines two basic message types: a request and a response. a request message contains an IP address and requests the corresponding hardware address; a replay contains both the IP address, sent in the request, and the hardware address.</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-weight: bold;">What is a Makefile? </span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">Makefile is a utility in Unix to help compile large programs. It helps by only compiling the portion of the program that has been changed.</span><br />
<span style="color: #444444;">A Makefile is the file and make uses to determine what rules to apply. make is useful for far more than compiling programs.</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-weight: bold;">What is deadlock? </span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">Deadlock is a situation when two or more processes prevent each other from running. Example: if T1 is holding x and waiting for y to be free and T2 holding y and waiting for x to be free deadlock happens.</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-weight: bold;">What is semaphore?</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">Semaphore is a special variable, it has two methods: up and down. Semaphore performs atomic operations, which means ones a semaphore is called it can not be inturrupted.</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">The internal counter (= #ups - #downs) can never be negative. If you execute the “down” method when the internal counter is zero, it will block until some other thread calls the “up” method. Semaphores are use for thread synchronization.</span><br />
<span style="color: #444444;">Is C an object-oriented language?</span><br />
<span style="color: #444444;">C is not an object-oriented language, but limited object-oriented programming can be done in C.</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-weight: bold;">Name some major differences between C++ and Java?</span><br />
<span style="color: #444444;"><br /></span>
<span style="color: #444444;">C++ has pointers; Java does not. Java is platform-independent; C++ is not. Java has garbage collection; C++ does not. Java does have pointers. In fact all variables in Java are pointers. The difference is that Java does not allow you to manipulate the addresses of the pointer</span></div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-16036187232848519592010-05-06T23:24:00.001+05:302016-02-19T07:24:32.833+05:30C++ Networking Interview Questions and Answers<div dir="ltr" style="text-align: left;" trbidi="on">
<b style="font-family: Arial, Helvetica, sans-serif;"><span lang="EN-US" style="color: #444444;">What is the difference between Stack and Queue?</span></b><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">Stack is a Last In First Out (LIFO) data structure. </span>
<br /><span class="answers">Queue is a First In First Out (FIFO) data structure </span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span class="forquestionsblue" style=""><b><span lang="EN-US">Write a fucntion that will reverse a string?</span></b></span><span lang="EN-US"></span></span><br />
<span lang="EN-US" style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"> <span class="answers">char *strrev(char *s)</span>
<br />{
<br /><span class="answers">int i = 0, len = strlen(s);</span>
<br /><span class="answers">char *str;</span>
<br /><span class="answers">if ((str = (char *)malloc(len+1)) == NULL)</span>
<br /><span class="answers">/*cannot allocate memory */</span>
<br /><span class="answers">err_num = 2;</span>
<br /><span class="answers">return (str);</span>
<br />}
<br /><span class="answers">while(len)</span>
<br /><span class="answers">str[i++]=s[–len];</span>
<br /><span class="answers">str[i] = NULL;</span>
<br /><span class="answers">return (str);</span>
<br />}</span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span class="forquestionsblue"><b><span lang="EN-US" style="">What is the software Life-Cycle?</span><span lang="EN-US"></span></b></span><span lang="EN-US">
<br />
<br /><span class="answers">The software Life-Cycle are</span>
<br /><span class="answers">1) Analysis and specification of the task</span>
<br /><span class="answers">2) Design of the algorithms and data structures</span>
<br /><span class="answers">3) Implementation (coding)</span>
<br /><span class="answers">4) Testing</span>
<br /><span class="answers">5) Maintenance and evolution of the system</span>
<br /><span class="answers">6) Obsolescence</span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span class="forquestionsblue" style=""><b><span lang="EN-US">What is the difference between a Java application and a Java applet? </span></b></span><span lang="EN-US">
<br />
<br /> <span class="answers">The difference between a Java application and a Java applet is that a Java application is a program that can be executed using the Java interpeter, and a JAVA applet can be transfered to different networks and executed by using a web browser (transferable to the WWW). </span></span></span><br />
<span style="color: #444444; font-family: "arial" , "helvetica" , sans-serif;"><span class="forquestionsblue" style=""><b><span lang="EN-US">Name 7 layers of the OSI Reference Model? </span></b></span><span lang="EN-US">
<br />
<br /> <span class="answers">-Application layer</span>
<br /><span class="answers">-Presentation layer</span>
<br /><span class="answers">-Session layer</span>
<br /><span class="answers">-Transport layer</span>
<br /><span class="answers">-Network layer</span>
<br /><span class="answers">-Data Link layer</span>
<br /><span class="answers">-Physical layer</span></span></span></div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-92035265510188161952010-05-06T23:21:00.000+05:302016-02-19T07:26:48.901+05:30C++ Algorithm Interview Questions and Answers<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: #444444;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif; font-weight: bold;">What are the advantages and disadvantages of B-star trees over Binary trees? </span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">Answer1</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">B-star trees have better data structure and are faster in search than Binary trees, but it’s harder to write codes for B-start trees.</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">Answer2</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">The major difference between B-tree and binary tres is that B-tree is a external data structure and binary tree is a main memory data structure. The computational complexity of binary tree is counted by the number of comparison operations at each node, while the computational complexity of B-tree is determined by the disk I/O, that is, the number of node that will be loaded from disk to main memory. The comparision of the different values in one node is not counted.</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif; font-weight: bold;">Write the psuedo code for the Depth first Search. </span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">dfs(G, v) //OUTLINE</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">Mark v as "discovered"</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">For each vertex w such that edge vw is in G:</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">If w is undiscovered:</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">dfs(G, w); that is, explore vw, visit w, explore from there as much as possible, and backtrack from w to v. Otherwise:</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">"Check" vw without visiting w. Mark v as "finished".</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif; font-weight: bold;">Describe one simple rehashing policy. </span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">The simplest rehashing policy is linear probing. Suppose a key K hashes to location i. Suppose other key occupies H[i]. The following function is used to generate alternative locations:</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">rehash(j) = (j + 1) mod h</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">where j is the location most recently probed. Initially j = i, the hash code for K. Notice that this version of rehash does not depend on K.</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif; font-weight: bold;">Describe Stacks and name a couple of places where stacks are useful. </span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">A Stack is a linear structure in which insertions and deletions are always made at one end, called the top. This updating policy is called last in, first out (LIFO). It is useful when we need to check some syntex errors, such as missing parentheses.</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">Suppose a 3-bit sequence number is used in the selective-reject ARQ, what is the maximum number of frames that could be transmitted at a time?</span><br />
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="color: #444444; font-family: Arial, Helvetica, sans-serif;">If a 3-bit sequence number is used, then it could distinguish 8 different frames. Since the number of frames that could be transmitted at a time is no greater half the numner of frames that could be distinguished by the sequence number, so at most 4 frames can be transmitted at a time.</span></div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-60092111083412481452009-07-13T23:55:00.000+05:302016-02-19T07:27:48.218+05:30Java Interview Questions<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Describe what happens when an object is created in Java</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Several things happen in a particular order to ensure the object is constructed properly:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. Memory is allocated from heap to hold all instance variables and implementation-specific data of the object and its superclasses. Implemenation-specific data includes pointers to class and method data.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. The instance variables of the objects are initialized to their default values.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3. The constructor for the most derived class is invoked. The first thing a constructor does is call the consctructor for its superclasses. This process continues until the constrcutor for java.lang.Object is called, as java.lang.Object is the base class for all objects in java.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4. Before the body of the constructor is executed, all instance variable initializers and initialization blocks are executed. Then the body of the constructor is executed. Thus, the constructor for the base class completes first and constructor for the most derived class completes last.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">In Java, You can create a String object as below :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">String str = "abc"; & String str = new String("abc");</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Why cant a button object be created as : Button bt = "abc" </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Why is it compulsory to create a button object as: Button bt = new Button("abc");</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Why this is not compulsory in String's case. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Button bt1= "abc"; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">is because "abc" is a literal string (something slightly different than a String object, by-the-way) and bt1 is a Button object. That simple. The only object in Java that can be assigned a literal String is java.lang.String.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Important to not that you are NOT calling a java.lang.String constuctor when you type String s = "abc"; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">For example </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">String x = "abc";</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">String y = "abc";</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">refer to the same object.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">While </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">String x1 = new String("abc");</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">String x2 = new String("abc");</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">refer to two different objects.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is the advantage of OOP? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You will get varying answers to this question depending on whom you ask. Major advantages of OOP, IMHO, are: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. simplicity: software objects model real world objects, so the complexity is reduced and the program structure is very clear; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. modularity: each object forms a separate entity whose internal workings are decoupled from other parts of the system; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3. modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4. extensibility: adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">5. maintainability: objects can be maintained separately, making locating and fixing problems easier; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">6. re-usability: objects can be reused in different programs</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What are the main differences between Java and C++?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Everything is an object in Java( Single root hierarchy as everything gets derived from java.lang.Object) </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java does not have all the complicated aspects of C++ ( For ex: Pointers, templates, unions, operator overloading, structures etc..) </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The Java language promoters initially said "No pointers!", but when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers." You can make up your mind whether it’s really a pointer or not. In any event, there’s no pointer arithmetic. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There are no destructors in Java. (automatic garbage collection) </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java does not support conditional compile (#ifdef/#ifndef type). </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Thread support is built into java but not in C++. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java does not support default arguments.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There’s no scope resolution operator :: in Java. Java uses the dot for everything, but can get away with it since you can define elements only within a class. Even the method definitions must always occur within a class, so there is no need for scope resolution there either. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There’s no "goto " statement in Java. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java doesn’t provide multiple inheritance (MI), at least not in the same sense that C++ does. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Exception handling in Java is different because there are no destructors. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java has method overloading, but no operator overloading. The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion, but that’s a special built-in case. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java is interpreted for the most part and hence platform independent</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What are interfaces? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Interfaces provide more sophisticated ways to organize and control the objects in your system. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">types, but no method bodies. An interface can also contain fields, but The interface keyword takes the abstract concept one step further. You could think of it as a “pure” abstract class. It allows the creator to establish the form for a class: method names, argument lists, and return types, but no method bodies. An interface can also contain fields, but </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">An interface says: “This is what all classes that implement this particular interface will look like.” Thus, any code that uses a particular interface knows what methods might be called for that interface, and that’s all. So the interface is used to establish a “protocol” between classes. (Some</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">object-oriented programming languages have a keyword called protocolto do the same thing.) </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Typical example from "Thinking in Java": </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">import java.util.*; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">interface Instrument {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">int i = 5; // static & final</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">// Cannot have method definitions:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void play(); // Automatically public</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">String what();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void adjust();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class Wind implements Instrument {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void play() {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">System.out.println("Wind.play()");</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public String what() { return "Wind"; }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void adjust() {}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">How can you achieve Multiple Inheritance in Java? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java's interface mechanism can be used to implement multiple inheritance, with one important difference from c++ way of doing MI: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">the inherited interfaces must be abstract. This obviates the need to choose between different implementations, as with interfaces there are no implementations. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">example: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">interface CanFight {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void fight();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">interface CanSwim {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void swim();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">interface CanFly {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void fly();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class ActionCharacter {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void fight() {}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class Hero extends ActionCharacter implements CanFight, CanSwim, CanFly {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void swim() {}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void fly() {}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">You can even achieve a form of multiple inheritance where you can use the *functionality* of classes rather than just the interface: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">interface A {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodA();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class AImpl implements A {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodA() { //do stuff }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">interface B {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodB();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class BImpl implements B {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodB() { //do stuff }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class Multiple implements A, B {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">private A a = new A();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">private B b = new B();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodA() { a.methodA(); }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodB() { b.methodB(); }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This completely solves the traditional problems of multiple inheritance in C++ where name clashes occur between multiple base classes. The coder of the derived class will have to explicitly resolve any clashes. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Don't you hate people who point out minor typos? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Everything in the previous example is correct, except you need to instantiate an AImpl and BImpl. So class Multiple would look like this: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class Multiple implements A, B {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">private A a = new AImpl();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">private B b = new BImpl();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodA() { a.methodA(); }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void methodB() { b.methodB(); }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is the difference between StringBuffer and String class? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A string buffer implements a mutable sequence of characters. A string buffer is like a String, but can be modified. At any point in time it contains some particular sequence of characters, but the length and content of the sequence can be changed through certain method calls. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The String class represents character strings. All string literals in Java programs, such as "abc" are constant and implemented as instances of this class; their values cannot be changed after they are created.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Strings in Java are known to be immutable. What it means is that every time you need to make a change to a String variable, behind the scene, a "new" String is actually being created by the JVM. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">For an example:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">if you change your String variable 2 times, then you end up with 3 Strings: one current and 2 that are ready for garbage collection. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The garbage collection cycle is quite unpredictable and these additional unwanted Strings will take up memory until that cycle occurs. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">For better performance, use StringBuffers for string-type data that will be reused or changed frequently. There is more overhead per class than using String, but you will end up with less overall classes and consequently consume less memory.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Describe, in general, how java's garbage collector works? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The Java runtime environment deletes objects when it determines that they are no longer being used. This process is known as garbage collection. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The Java runtime environment supports a garbage collector that periodically frees the memory used by objects that are no longer needed. The Java garbage collector is a mark-sweep garbage collector that scans Java's dynamic memory areas for objects, marking those that are referenced. After all possible paths to objects are investigated, those objects that are not marked (i.e. are not referenced) are known to be garbage and are collected. (A more complete description of our garbage collection algorithm might be "A compacting, mark-sweep collector with some conservative scanning".) </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The garbage collector runs synchronously when the system runs out of memory, or in response to a request from a Java program. Your Java program can ask the garbage collector to run at any time by calling System.gc(). The garbage collector requires about 20 milliseconds to complete its task so, your program should only run the garbage collector when there will be no performance impact and the program anticipates an idle period long enough for the garbage collector to finish its job.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Note: Asking the garbage collection to run does not guarantee that your objects will be garbage collected. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The Java garbage collector runs asynchronously when the system is idle on systems that allow the Java runtime to note when a thread has begun and to interrupt another thread (such as Windows 95). As soon as another thread becomes active, the garbage collector is asked to get to a consistent state and then terminate. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What's the difference between == and equals method? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">equals checks for the content of the string objects while == checks for the fact that the two String objects point to same memory location ie they are same references. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What are abstract classes, abstract methods? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Simply speaking a class or a method qualified with "abstract" keyword is an abstract class or abstract method. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You create an abstract class when you want to manipulate a set of classes through a common interface. All derived-class methods that match the signature of the base-class declaration will be called using the dynamic binding mechanism. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If you have an abstract class, objects of that class almost always have no meaning. That is, abstract class is meant to express only the interface and sometimes some default method implementations, and not a particular implementation, so creating an abstract class object makes no sense and are not allowed ( compile will give you an error message if you try to create one). </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">An abstract method is an incomplete method. It has only a declaration and no method body. Here is the syntax for an abstract method declaration: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">abstract void f(); </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If a class contains one or more abstract methods, the class must be qualified an abstract. (Otherwise, the compiler gives you an error message.). It’s possible to create a class as abstract without including any abstract methods. This is useful when you’ve got a class in which it doesn’t make sense to have any abstract methods, and yet you want to prevent any instances of that class. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Abstract classes and methods are created because they make the abstractness of a class explicit, and tell both the user and the compiler how it was intended to be used. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">For example: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">abstract class Instrument {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">int i; // storage allocated for each</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public abstract void play();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public String what() {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">return "Instrument";</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public abstract void adjust();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">class Wind extends Instrument {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void play() {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">System.out.println("Wind.play()");</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public String what() { return "Wind"; }</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void adjust() {} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Abstract classes are classes for which there can be no instances at run time. i.e. the implementation of the abstract classes are not complete. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Abstract methods are methods which have no defintion. i.e. abstract methods have to be implemented in one of the sub classes or else that class will also become Abstract. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is the difference between an Applet and an Application? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A Java application is made up of a main() method declared as public static void that accepts a string array argument, along with any other classes that main() calls. It lives in the environment that the host OS provides. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A Java applet is made up of at least one public class that has to be subclassed from java.awt.Applet. The applet is confined to living in the user's Web browser, and the browser's security rules, (or Sun's appletviewer, which has fewer restrictions). </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The differences between an applet and an application are as follows: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. Applets can be embedded in HTML pages and downloaded over the Internet whereas Applications have no special support in HTML for embedding or downloading. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. Applets can only be executed inside a java compatible container, such as a browser or appletviewer whereas Applications are executed at command line by java.exe or jview.exe. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3. Applets execute under strict security limitations that disallow certain operations(sandbox model security) whereas Applications have no inherent security restrictions. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4. Applets don't have the main() method as in applications. Instead they operate on an entirely different mechanism where they are initialized by init(),started by start(),stopped by stop() or destroyed by destroy(). </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Java says "write once, run anywhere". What are some ways this isn't quite true? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">As long as all implementaions of java are certified by sun as 100% pure java this promise of "Write once, Run everywhere" will hold true. But as soon as various java core implemenations start digressing from each other, this won't be true anymore. A recent example of a questionable business tactic is the surreptitious behavior and interface modification of some of Java's core classes in their own implementation of Java. Programmers who do not recognize these undocumented changes can build their applications expecting them to run anywhere that Java can be found, only to discover that their code works only on Microsoft's own Virtual Machine, which is only available on Microsoft's own operating systems. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is the difference between a Vector and an Array. Discuss the advantages and disadvantages of both? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Vector can contain objects of different types whereas array can contain objects only of a single type.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">- Vector can expand at run-time, while array length is fixed.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">- Vector methods are synchronized while Array methods are not</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What are java beans? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">JavaBeans is a portable, platform-independent component model written in the Java programming language, developed in collaboration with industry leaders. It enables developers to write reusable components once and run them anywhere -- benefiting from the platform-independent power of Java technology. JavaBeans acts as a Bridge between proprietary component models and provides a seamless and powerful means for developers to build components that run in ActiveX container applications. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">JavaBeans are usual Java classes which adhere to certain coding conventions:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. Implements java.io.Serializable interface </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. Provides no argument constructor </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3. Provides getter and setter methods for accessing it's properties </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is RMI? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">RMI stands for Remote Method Invocation. Traditional approaches to executing code on other machines across a network have been confusing as well as tedious and error-prone to implement. The nicest way to think about this problem is that some object happens to live on another machine, and that you can send a message to the remote object and get a result as if the object lived on your local</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">machine. This simplification is exactly what Java Remote Method Invocation (RMI) allows you to do. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Above excerpt is from "Thinking in java". For more information refer to any book on Java. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What does the keyword "synchronize" mean in java. When do you use it? What are the disadvantages of synchronization? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Synchronize is used when u want to make ur methods thread safe. The disadvantage of synchronise is it will end up in slowing down the program. Also if not handled properly it will end up in dead lock. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Any more additions to this</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What gives java it's "write once and run anywhere" nature? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Java is compiled to be a byte code which is the intermediate language between source code and machine code. This byte code is not platorm specific and hence can be fed to any platform. After being fed to the JVM, which is specific to a particular operating system, the code platform specific machine code is generated thus making java platform independent. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What are native methods? How do you use them? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Native methods are methods written in other languages like C, C++, or even assembly language. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You can call native methods from Java using JNI. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Native methods are used when the implementation of a particular method is present in language other than Java say C, C++.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">To use the native methods in java we use the keyword native</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public native method_a()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This native keyword is signal to the java compiler that the implementation of this method is in a language other than java.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Native methods are used when we realize that it would take up a lot of rework to write that piece of alerady existing code in other language to java. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is JDBC? Describe the steps needed to execute a SQL query using JDBC. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">We can connect to databases from java using JDBC. It stands for Java DataBase Connectivity. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Here are the steps: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. Register the jdbc driver with the driver manager</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. Establish jdbc connection</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3. Execute an sql statement</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4. Process the results</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">5. Close the connection </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Before doing these do import java.sql.* </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">JDBC is java based API for accessing data from the relational databases. JDBC provides a set of classes and interfaces for doing various database operations.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The steps are:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Register/load the jdbc driver with the driver manager.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Establish the connection thru DriverManager.getConnection();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Fire a SQL thru conn.executeStatement();</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Fetch the results in a result set</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Process the results</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Close statement/result set and connection object. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">How many different types of JDBC drivers are present? Discuss them. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There are four JDBC driver types. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Type 1: JDBC-ODBC Bridge plus ODBC Driver:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The first type of JDBC driver is the JDBC-ODBC Bridge. It is a driver that provides JDBC access to databases through ODBC drivers. The ODBC driver must be configured on the client for the bridge to work. This driver type is commonly used for prototyping or when there is no JDBC driver available for a particular DBMS. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Type 2: Native-API partly-Java Driver:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The Native to API driver converts JDBC commands to DBMS-specific native calls. This is much like the restriction of Type 1 drivers. The client must have some binary code loaded on its machine. These drivers do have an advantage over Type 1 drivers because they interface directly with the database. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Type 3: JDBC-Net Pure Java Driver:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The JDBC-Net drivers are a three-tier solution. This type of driver translates JDBC calls into a database-independent network protocol that is sent to a middleware server. This server then translates this DBMS-independent protocol into a DBMS-specific protocol, which is sent</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">to a particular database. The results are then routed back through the middleware server and sent back to the client. This type of solution makes it possible to implement a pure Java client. It also makes it possible to swap databases without affecting the client. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Type 4: Native-Protocol Pur Java Driver</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">These are pure Java drivers that communicate directly with the vendor's database. They do this by converting JDBC commands directly into the database engine's native protocol. This driver has no additional translation or middleware layer, which improves performance tremendously.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What does the "static" keyword mean in front of a variable? A method? A class? Curly braces {}? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">static variable </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">- means a class level variable </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">static method:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">-does not have "this". It is not allowed to access the not static members of the class.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">can be invoked enev before a single instance of a class is created.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">eg: main </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">static class: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">no such thing. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">static free floating block:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">is executed at the time the class is loaded. There can be multiple such blocks. This may be useful to load native libraries when using native methods. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">eg: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">native void doThis(){ </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">static{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">System.loadLibrary("myLibrary.lib");</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">..... </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Access specifiers: "public", "protected", "private", nothing? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Unfortunately I believe that buturab is discussing Static vs. non-Static methods and variables. In the case of Public, Private and Protected, that is used to describe which programs can access that class or method: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Public – any other class from any package can instantiate and execute the classes and methods</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Protected – only subclasses and classes inside of the package can access the classes and methods</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Private – the original class is the only class allowed to executed the methods.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What does the "final" keyword mean in front of a variable? A method? A class? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">FINAL for a variable : value is constant</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">FINAL for a method : cannot be overridden</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">FINAL for a class : cannot be derived </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A final variable cannot be reassigned,</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">but it is not constant. For instance, </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">final StringBuffer x = new StringBuffer()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">x.append("hello"); </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">is valid. X cannot have a new value in it,but nothing stops operations on the object</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">that it refers, including destructive operations. Also, a final method cannot be overridden</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">or hidden by new access specifications.This means that the compiler can choose</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">to in-line the invocation of such a method.(I don't know if any compiler actually does</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">this, but it's true in theory.) The best example of a final class is</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">String, which defines a class thatcannot be derived.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Does Java have "goto"? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">No. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Why "bytecode"? Can you reverse-engineer the code from bytecode? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">you can get the sourcecode from ur class file.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">u get a free JAD here</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What synchronization constructs does Java provide? How do they work? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The two common features that are used are: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. Synchronized keyword - Used to synchronize a method or a block of code. When you synchronize a method, you are in effect synchronizing the code within the method using the monitor of the current object for the lock. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The following have the same effect. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">synchronized void foo() {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">and </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">void foo() {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">synchronized(this) {</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If you synchronize a static method, then you are synchronizing across all objects of the same class, i.e. the monitor you are using for the lock is one per class, not one per object. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. wait/notify. wait() needs to be called from within a synchronized block. It will first release the lock acquired from the synchronization and then wait for a signal. In Posix C, this part is equivalent to the pthread_cond_wait method, which waits for an OS signal to continue. When somebody calls notify() on the object, this will signal the code which has been waiting, and the code will continue from that point. If there are several sections of code that are in the wait state, you can call notifyAll() which will notify all threads that are waiting on the monitor for the current object. Remember that both wait() and notify() have to be called from blocks of code that are synchronized on the monitor for the current object. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Does Java have multiple inheritance? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">JAva does not support multiple inheritence directly but it does thru the concept of interfaces.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">We can make a class implement a number of interfaces if we want to achieve multiple inheritence type of functionality of C++. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">How does exception handling work in Java? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1.It separates the working/functional code from the error-handling code by way of try-catch clauses. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2.It allows a clean path for error propagation. If the called method encounters a situation it can't manage, it can throw an exception and let the calling method deal with it. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3.By enlisting the compiler to ensure that "exceptional" situations are anticipated and accounted for, it enforces powerful coding. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4.Exceptions are of two types: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Compiler-enforced exceptions, or checked exceptions </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Runtime exceptions, or unchecked exceptions </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Compiler-enforced (checked) exceptions are instances of the Exception class or one of its subclasses -- excluding the RuntimeException branch. The compiler expects all checked exceptions to be appropriately handled. Checked exceptions must be declared in the throws clause of the method throwing them -- assuming, of course, they're not being caught within that same method. The calling method must take care of these exceptions by either catching or declaring them in its throws clause. Thus, making an exception checked forces the us to pay heed to the possibility of it being thrown. An example of a checked exception is java.io.IOException. As the name suggests, it throws whenever an input/output operation is abnormally terminated.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Does Java have destructors? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">garbage collector does the job working in the background </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Jva does not have destructors; but it has finalizers that does a similar job. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">the syntax is </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">public void finalize(){ </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">} </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">if an object has a finalizer, the method is invoked before the system garbage collects the object </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What does the "abstract" keyword mean in front of a method? A class? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Abstract keyword declares either a method or a class.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">If a method has a abstract keyword in front of it,it is called abstract method.Abstract method hs no body.It has only arguments and return type.Abstract methods act as placeholder methods that are implemented in the subclasses. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Abstract classes can't be instantiated.If a class is declared as abstract,no objects of that class can be created.If a class contains any abstract method it must be declared as abstract </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Are java constructors inherited ? if not, why not? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">You cannot inherit a constructor. That is, you cannot create a instance of a subclass using a constructor of one of it's superclasses. One of the main reasons is because you probably don't want to overide the superclasses constructor, which would be possible if they were inherited. By giving the developer the ability to override a superclasses constructor you would erode the encapsulation abilities of the language. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">SQL:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What are two methods of retrieving SQL? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What cursor type do you use to retrieve multiple recordsets? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is the difference between a "where" clause and a "having" clause? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">"Where" is a kind of restiriction statement. You use where clause to restirict all the data from DB.Where clause is using before result retrieving. But Having clause is using after retrieving the data.Having clause is a kind of filtering command. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is the basic form of a SQL statement to read data out of a table? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The basic form to read data out of table is </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">SELECT * FROM table_name; </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">An answer:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">SELECT * </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">FROM table_name </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">WHERE xyz= 'whatever';</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">cannot be called basic form because of WHERE clause.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">What structure can you have the database make to speed up table reads? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The question is not correct.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">"What structure can you have the database make to speed up table reads ?"</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">It is not cleare what exectly the term </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">"structure" means in this case.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Follow the rules of DB tuning we have to:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1] properly use indexes ( different types of indexes)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2] properly locate different DB objects</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">across different tablespaces, files and so on.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3] create a special space (tablespace) to locate some of the data with special datatype</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">( for example CLOB, LOB and ...)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">What are the tradeoffs with having indexes? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. Faster selects, slower updates.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. Extra storage space to store indexes. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">updates are slower because in addition to updating the table you have to update the index. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is a "join"? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">'join' used to connect two or more tables logically with or without common field. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is "normalization"? "Denormalization"? Why do you sometimes want to denormalize? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Normalizing data means eliminating redundant information from a table and oranizing the data so that future changes to the table are easier.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Denormalization means allowing redundancy in a table.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">The main benefit of denormalization is improved performance with simplified data retrieval and manipulation. This is done by reduction in the number of joins needed for data processing. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is a "constraint"? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A constraint allows you to apply simple referential integrity checks to a table. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There are four primary types of constraints that are currently supported by SQL Server: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">PRIMARY/UNIQUE - enforces uniqueness of a particular table column.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">DEFAULT - specifies a default value for a column in case an insert operation does not provide one.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">FOREIGN KEY - validates that every value in a column exists in a column of another table.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">CHECK - checks that every value stored in a column is in some specified list </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Each type of constraint performs a specific type of action. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Default is not a constraint.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">NOT NULL is one more constraint which does not allow values in the specific column to be null. And also it the only constraint which is not a table level constraint. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What types of index data structures can you have? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">An index helps to faster search values in tables. The three most commonly used index-types are:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">- B-Tree: builds a tree of possible values with a list of row IDs that have the leaf value. Needs a lot of space and is the default index type for most databases.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">- Bitmap: string of bits for each possible value of the column. Each bit string has one bit for each row. Needs only few space and is very fast.(however, domain of value cannot be large, e.g. SEX(m,f); degree(BS,MS,PHD)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">- Hash: A hashing algorithm is used to assign a set of characters to represent a text strig such as a composite of keys or partial keys, and compresses the underlying data. Takes longer to build and is supported by relatively few databases.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is a "primary key"? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A PRIMARY INDEX or PRIMARY KEY is something which comes mainly from</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">database theory. From its behaviour is almost the same as an UNIQUE</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">INDEX, i.e. there may only be one of each value in this column. If you</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">call such an INDEX PRIMARY instead of UNIQUE, you say something about</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">your table design, which I am not able to explain in few words.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Primary Key is a type of a constraint enforcing uniqueness and data integrity for each row of a table. All columns participating in a primary key constraint must possess the NOT NULL property. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is a "functional dependency"? How does it relate to database table design? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Functional dependency relates to how one object depends upon the other in the database.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">for example, procedure/function sp2 may be called by procedure sp1. Then we say that sp1 has functional dependency on sp2. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is a "trigger"? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Triggers are stored procedures created in order to enforce integrity rules in a database. A trigger is executed every time a data-modification operation occurs (i.e., insert, update or delete). Triggers are executed automatically on occurance of one of the data-modification operations. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A trigger is a database object directly associated with a particular table. It fires whenever a specific statement/type of statement is issued against that table. The types of statements are insert,update,delete and query statements. Basically, trigger is a set of SQL statements </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2 of 3 people found this post useful. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">A trigger is a solution to the restrictions of a constraint.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">For instance :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1.A database column cannot carry PSEUDO columns as criteria where a trigger can.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2.A database constraint cannot refer old and new values for a row where a trigger can.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Why can a "group by" or "order by" clause be expensive to process? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Processing of "group by" or "order by" clause often requires creation of Temporary tables to process the results of the query.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Which depending of the result set can be very expensive. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What is "index covering" of a query? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Index covering means that "Data can be found only using indexes, without touching the tables" </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Bottom of Form 1</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Top of Form 3</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Bottom of Form 3</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">What types of join algorithms can you have? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Nested loop, indexes and hash. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Top of Form 1</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4 of 5 people found this post useful. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">There are four type of joins</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">(join conditions):</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1) equa join</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2) non-equa join</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">3) self-join</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">4) outer join.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">State some advantages AND disadvantages of indexing database tables. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">This is the answer to advantage and disadvatage of Indexes: </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Adv:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Faster querying of data </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Disad:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">1. Slower Insert</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">2. Slower Updates if you are also pdating the primary key. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">What is a SQL view? </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">An output of a query can be stored as a view. View acts like small table which meets our criterion. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Top of Form 1</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">6 of 6 people found this post useful. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">View is a precomplied SQL query which is used to select data from one or more tables. A view is like a table but it doens't physically take any space. Viw is a good way to present data in a particualr format if you use that query quite often.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">View can also be used to restrict users from accessing the tables directly.</span></div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Gaurav Nandahttp://www.blogger.com/profile/12749165288430220644noreply@blogger.com1tag:blogger.com,1999:blog-9088987006789845123.post-57791891854115070492009-06-08T00:16:00.004+05:302016-02-19T08:24:03.676+05:30c++ source code Examples Part 6<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Arial, Helvetica, sans-serif;">101) void main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">void *v;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int integer=2;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int *i=&integer;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">v=i;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d",(int*)*v);</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Compiler Error. We cannot apply indirection on type void*.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Void pointer is a generic pointer type. No pointer arithmetic can be done on it.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Void pointers are normally used for,</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">1. Passing generic pointers to functions and returning such pointers.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">2. As a intermediate pointer type.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">3. Used when the exact pointer type will be known at a later point of time.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">102) void main()</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int i=i++,j=j++,k=k++;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf(“%d%d%d”,i,j,k);</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Garbage values.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">An identifier is available to use in program code from the point of its declaration.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">So expressions such as i = i++ are valid statements. The i, j and k are automatic</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">variables and so they contain some garbage value. Garbage in is garbage out (GIGO).</span><br />
<script type="text/javascript"><!-- google_ad_client = "pub-8716701302248821"; /* 728x15, created 6/12/09 */ google_ad_slot = "9087350094"; google_ad_width = 728; google_ad_height = 15; //</script></div>
<span style="font-family: Arial, Helvetica, sans-serif;">--><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">103) void main()</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">static int i=i++, j=j++, k=k++;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf(“i = %d j = %d k = %d”, i, j, k);</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">i = 1 j = 1 k = 1</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Since static variables are initialized to zero by default.</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">104) void main()</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">while(1){</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">if(printf("%d",printf("%d")))</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">break;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">else</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">continue;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Garbage values</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The inner printf executes first to print some garbage value. The printf returns no</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">of characters printed and this value also cannot be predicted. Still the outer</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">printf prints something and so returns a non-zero value. So it encounters the break</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">statement and comes out of the while statement.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">104) main()</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">unsigned int i=10;</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">while(i-->=0)</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%u ",i);</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">10 9 8 7 6 5 4 3 2 1 0 65535 65534…..</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Since i is an unsigned integer it can never become negative. So the expression i--</span></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">>=0 will always be true, leading to an infinite loop. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">105) #include</span><conio .h=""><span style="font-family: Arial, Helvetica, sans-serif;"><br /><br />main()<br /><br />{<br /><br /> int x,y=2,z,a;<br /><br /> if(x=y%2) z=2;<br /><br /> a=2;<br /><br /> printf("%d %d ",z,x);<br /><br />}<br /><br />Answer:<br /><br />Garbage-value 0<br /><br />Explanation:<br /><br />The value of y%2 is 0. This value is assigned to x. The condition reduces to if (x)<br />or in other words if(0) and so z goes uninitialized.<br /><br />Thumb Rule: Check all control paths to write bug free code.<br /><br /><br /><br />106) main()<br /><br />{<br /><br /> int a[10];<br /><br /> printf("%d",*a+1-*a+3);<br /><br />}<br /><br />Answer:<br /><br />4<br /><br />Explanation:<br /><br /> *a and -*a cancels out. The result is as simple as 1 + 3 = 4 ! <br /><br /><br /><br />107) #define prod(a,b) a*b<br /><br />main()<br /><br />{<br /><br /> int x=3,y=4;<br /><br /> printf("%d",prod(x+2,y-1));<br /><br />}<br /><br />Answer:<br /><br />10<br /><br />Explanation:<br /><br /> The macro expands and evaluates to as:<br /><br /> x+2*y-1 => x+(2*y)-1 => 10<br /><br /><script type="text/javascript"><!-- google_ad_client = "pub-8716701302248821"; /* 728x15, created 6/12/09 */ google_ad_slot = "9087350094"; google_ad_width = 728; google_ad_height = 15; //</script></span></conio></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">--><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">108) main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">unsigned int i=65000;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">while(i++!=0);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d",i);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">1</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Note the semicolon after the while statement. When the value of i becomes 0 it comes</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">out of while loop. Due to post-increment on i the value of i while printing is 1.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">109) main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int i=0;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">while(+(+i--)!=0)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">i-=i++;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d",i);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">-1</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Unary + is the only dummy operator in C. So it has no effect on the expression and</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">now the while loop is, while(i--!=0) which is false and so breaks out of</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">while loop. The value –1 is printed due to the post-decrement operator.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">113) main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">float f=5,g=10;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">enum{i=10,j=20,k=50};</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d\n",++k);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%f\n",f<<2 i="0;">=0;i++) ;<br /><br /> printf("%d\n",i);<br /><br /> }<br /><br />Answer<br /><br /> -128<br /><br />Explanation<br /><br />Notice the semicolon at the end of the for loop. THe initial value of the i is set<br />to 0. The inner loop executes to increment the value from 0 to 127 (the positive<br />range of char) and then it rotates to the negative value of -128. The condition in<br />the for loop fails and so comes out of the for loop. It prints the current value of<br />i that is -128.<br /><br /> <br /><br />113) main()<br /><br /> {<br /><br /> unsigned char i=0;<br /><br /> for(;i>=0;i++) ;<br /><br /> printf("%d\n",i);<br /><br /> }<br /><br />Answer<br /><br /> infinite loop<br /><br />Explanation<br /><br />The difference between the previous question and this one is that the char is<br />declared to be unsigned. So the i++ can never yield negative value and i>=0 never<br />becomes false so that it can come out of the for loop.<br /><br /><br /><br />114) main()<br /><br /> {<br /><br /> char i=0;<br /><br /> for(;i>=0;i++) ;<br /><br /> printf("%d\n",i);<br /><br /> <br /><br />}<br /><br />Answer:<br /><br /> Behavior is implementation dependent.<br /><br />Explanation:<br /><br />The detail if the char is signed/unsigned by default is implementation dependent. If<br />the implementation treats the char to be signed by default the program will print<br />–128 and terminate. On the other hand if it considers char to be unsigned by<br />default, it goes to infinite loop.<br /><br />Rule:<br /><br />You can write programs that have implementation dependent behavior. But dont write<br />programs that depend on such behavior.<br /><br /><br /><br />115) Is the following statement a declaration/definition. Find what does it mean?<br /><br />int (*x)[10];<br /><br />Answer<br /><br /> Definition.<br /><br /> x is a pointer to array of(size 10) integers.<br /><br /><br /><br /> Apply clock-wise rule to find the meaning of this definition.<br /><br /><br /><script type="text/javascript"><!-- google_ad_client = "pub-8716701302248821"; /* 728x15, created 6/12/09 */ google_ad_slot = "9087350094"; google_ad_width = 728; google_ad_height = 15; //</script><!--2-->--><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></2></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">116). What is the output for the program given below</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">typedef enum errorType{warning, error, exception,}error;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">error g1;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">g1=1;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d",g1);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Compiler error: Multiple declaration for error</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The name error is used in the two meanings. One means that it is a enumerator</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">constant with value 1. The another use is that it is a type name (due to typedef)</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">for enum errorType. Given a situation the compiler cannot distinguish the meaning of</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">error to know in what sense the error is used:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">error g1;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">g1=error;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">// which error it refers in each case?</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">When the compiler can distinguish between usages then it will not issue error (in</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">pure technical terms, names can only be overloaded in different namespaces).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Note: the extra comma in the declaration,</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">enum errorType{warning, error, exception,}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">is not an error. An extra comma is valid and is provided just for programmer’s</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">convenience.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">117) typedef struct error{int warning, error, exception;}error;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">error g1;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">g1.error =1;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d",g1.error);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">1</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The three usages of name errors can be distinguishable by the compiler at any</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">instance, so valid (they are in different namespaces).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Typedef struct error{int warning, error, exception;}error;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This error can be used only by preceding the error by struct kayword as in:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">struct error someError;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">typedef struct error{int warning, error, exception;}error;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This can be used only after . (dot) or -> (arrow) operator preceded by the variable</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">name as in :</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">g1.error =1;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d",g1.error);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">typedef struct error{int warning, error, exception;}error;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This can be used to define variables without using the preceding struct keyword as in:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">error g1;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Since the compiler can perfectly distinguish between these three usages, it is</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">perfectly legal and valid.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Note</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This code is given here to just explain the concept behind. In real programming</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">don’t use such overloading of names. It reduces the readability of the code.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">Possible doesn’t mean that we should use it!</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">118) #ifdef something</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int some=0;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">#endif</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int thing = 0;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d %d\n", some ,thing);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Compiler error : undefined symbol some</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation:</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This is a very simple example for conditional compilation. The name something is not</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">already known to the compiler making the declaration</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int some = 0;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">effectively removed from the source code.</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">119) #if something == 0</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int some=0;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">#endif</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int thing = 0;</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d %d\n", some ,thing);</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">0 0</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This code is to show that preprocessor expressions are not the same as the ordinary</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">expressions. If a name is not known the preprocessor treats it to be equal to zero.</span><br />
<script type="text/javascript"><!-- google_ad_client = "pub-8716701302248821"; /* 728x15, created 6/12/09 */ google_ad_slot = "9087350094"; google_ad_width = 728; google_ad_height = 15; //</script><span style="font-family: Arial, Helvetica, sans-serif;">--><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script></span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">120). What is the output for the following program</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">main()</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">{</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">int arr2D[3][3];</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) );</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">}</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Answer</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">1</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Explanation</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">This is due to the close relation between the arrays and pointers. N dimensional</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">arrays are made up of (N-1) dimensional arrays. </span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">arr2D is made up of a 3 single arrays that contains 3 integers each .</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">arr2D</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">arr2D[1]</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">arr2D[2]</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">arr2D[3]</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">The name arr2D refers to the beginning of all the 3 arrays. *arr2D refers to the</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">start of the first 1D array (of 3 integers) that is the same address as arr2D. So</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">the expression (arr2D == *arr2D) is true (1).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Similarly, *arr2D is nothing but *(arr2D + 0), adding a zero doesn’t change the</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">value/meaning. Again arr2D[0] is the another way of telling *(arr2D + 0). So the</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">expression (*(arr2D + 0) == arr2D[0]) is true (1).</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;"><br /></span>
<span style="font-family: Arial, Helvetica, sans-serif;">Since both parts of the expression evaluates to true the result is true(1) and the</span><br />
<span style="font-family: Arial, Helvetica, sans-serif;">same is printed.</span><!--2--></div>
<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com3tag:blogger.com,1999:blog-9088987006789845123.post-31971725758156591172009-06-08T00:13:00.001+05:302009-06-08T00:14:22.427+05:30c++ source code Examples Part 581)main(int argc, char **argv)<br /><br />{<br /><br /> printf("enter the character");<br /><br /> getchar();<br /><br /> sum(argv[1],argv[2]);<br /><br />}<br /><br />sum(num1,num2)<br /><br />int num1,num2;<br /><br />{<br /><br /> return num1+num2;<br /><br />}<br /><br />Answer:<br /><br />Compiler error.<br /><br />Explanation:<br /><br />argv[1] & argv[2] are strings. They are passed to the function sum without<br />converting it to integer values. <br /><br /> <br /><br />82) # include <stdio.h><br /><br />int one_d[]={1,2,3};<br /><br />main()<br /><br />{<br /><br /> int *ptr; <br /><br /> ptr=one_d;<br /><br /> ptr+=3;<br /><br /> printf("%d",*ptr);<br /><br />}<br /><br />Answer:<br /><br />garbage value<br /><br />Explanation:<br /><br />ptr pointer is pointing to out of the array range of one_d.<br /><br /> <br /><br />83) # include<stdio.h><br /><br />aaa() {<br /><br /> printf("hi");<br /><br /> }<br /><br />bbb(){<br /><br /> printf("hello");<br /><br /> }<br /><br />ccc(){<br /><br /> printf("bye");<br /><br /> }<br /><br />main()<br /><br />{<br /><br /> int (*ptr[3])();<br /><br /> ptr[0]=aaa;<br /><br /> ptr[1]=bbb;<br /><br /> ptr[2]=ccc;<br /><br /> ptr[2]();<br /><br />}<br /><br />Answer:<br /><br />bye <br /><br />Explanation:<br /><br />ptr is array of pointers to functions of return type int.ptr[0] is assigned to<br />address of the function aaa. Similarly ptr[1] and ptr[2] for bbb and ccc<br />respectively. ptr[2]() is in effect of writing ccc(), since ptr[2] points to ccc.<br /><br /> <br /><br />85) #include<stdio.h><br /><br />main()<br /><br />{<br /><br />FILE *ptr;<br /><br />char i;<br /><br />ptr=fopen("zzz.c","r");<br /><br />while((i=fgetch(ptr))!=EOF)<br /><br />printf("%c",i);<br /><br />}<br /><br />Answer:<br /><br />contents of zzz.c followed by an infinite loop <br /><br /> Explanation:<br /><br />The condition is checked against EOF, it should be checked against NULL.<br /><br /> <br /><br />86) main()<br /><br />{<br /><br /> int i =0;j=0;<br /><br /> if(i && j++)<br /><br /> printf("%d..%d",i++,j);<br /><br />printf("%d..%d,i,j);<br /><br />}<br /><br />Answer:<br /><br />0..0 <br /><br />Explanation:<br /><br />The value of i is 0. Since this information is enough to determine the truth value<br />of the boolean expression. So the statement following the if statement is not<br />executed. The values of i and j remain unchanged and get printed.<br /><br /> <br /><br />87) main()<br /><br />{<br /><br /> int i;<br /><br /> i = abc();<br /><br /> printf("%d",i);<br /><br />}<br /><br />abc()<br /><br />{<br /><br /> _AX = 1000;<br /><br />}<br /><br />Answer:<br /><br />1000<br /><br />Explanation:<br /><br />Normally the return value from the function is through the information from the<br />accumulator. Here _AH is the pseudo global variable denoting the accumulator. Hence,<br />the value of the accumulator is set 1000 so the function returns value 1000. <br /><br /> <br /><br />88) int i;<br /><br /> main(){<br /><br />int t;<br /><br />for ( t=4;scanf("%d",&i)-t;printf("%d\n",i))<br /><br /> printf("%d--",t--);<br /><br /> }<br /><br /> // If the inputs are 0,1,2,3 find the o/p<br /><br />Answer:<br /><br /> 4--0<br /><br /> 3--1<br /><br /> 2--2 <br /><br />Explanation:<br /><br />Let us assume some x= scanf("%d",&i)-t the values during execution <br /><br /> will be,<br /><br /> t i x<br /><br /> 4 0 -4<br /><br /> 3 1 -2<br /><br /> 2 2 0<br /><br /> <br /><br />89) main(){<br /><br /> int a= 0;int b = 20;char x =1;char y =10;<br /><br /> if(a,b,x,y)<br /><br /> printf("hello");<br /><br /> }<br /><br />Answer:<br /><br />hello <br /><br />Explanation:<br /><br />The comma operator has associativity from left to right. Only the rightmost value is<br />returned and the other values are evaluated and ignored. Thus the value of last<br />variable y is returned to check in if. Since it is a non zero value if becomes true<br />so, "hello" will be printed.<br /><br /> <br /><br />90) main(){<br /><br /> unsigned int i;<br /><br /> for(i=1;i>-2;i--)<br /><br /> printf("c aptitude");<br /><br />}<br /><br />Explanation:<br /><br />i is an unsigned integer. It is compared with a signed value. Since the both types<br />doesn't match, signed is promoted to unsigned value. The unsigned equivalent of -2<br />is a huge value so condition becomes false and control comes out of the loop. <br /><br /> <br /><br />91) In the following pgm add a stmt in the function fun such that the<br />address of <br /><br />'a' gets stored in 'j'.<br /><br />main(){<br /><br /> int * j;<br /><br /> void fun(int **);<br /><br /> fun(&j);<br /><br /> }<br /><br /> void fun(int **k) {<br /><br /> int a =0;<br /><br /> /* add a stmt here*/<br /><br /> }<br /><br />Answer:<br /><br /> *k = &a<br /><br />Explanation:<br /><br /> The argument of the function is a pointer to a pointer.<br /><br /> <br /><br />92) What are the following notations of defining functions known as?<br /><br />i. int abc(int a,float b)<br /><br /> {<br /><br /> /* some code */<br /><br /> }<br /><br />ii. int abc(a,b)<br /><br /> int a; float b;<br /><br /> {<br /><br /> /* some code*/<br /><br /> }<br /><br />Answer:<br /><br />i. ANSI C notation<br /><br />ii. Kernighan & Ritche notation <br /><br /> <br /><br />93) main()<br /><br />{<br /><br />char *p;<br /><br />p="%d\n";<br /><br /> p++;<br /><br /> p++;<br /><br /> printf(p-2,300);<br /><br />}<br /><br />Answer:<br /><br /> 300<br /><br />Explanation:<br /><br />The pointer points to % since it is incremented twice and again decremented by 2, it<br />points to '%d\n' and 300 is printed.<br /><br /> <br /><br />94) main(){<br /><br /> char a[100];<br /><br /> a[0]='a';a[1]]='b';a[2]='c';a[4]='d';<br /><br /> abc(a);<br /><br />}<br /><br />abc(char a[]){<br /><br /> a++; <br /><br /> printf("%c",*a);<br /><br /> a++;<br /><br /> printf("%c",*a);<br /><br />}<br /><br />Explanation:<br /><br />The base address is modified only in function and as a result a points to 'b' then<br />after incrementing to 'c' so bc will be printed.<br /><br /> <br /><br />95) func(a,b)<br /><br />int a,b;<br /><br />{<br /><br /> return( a= (a==b) );<br /><br />}<br /><br />main()<br /><br />{<br /><br />int process(),func();<br /><br />printf("The value of process is %d !\n ",process(func,3,6));<br /><br />}<br /><br />process(pf,val1,val2)<br /><br />int (*pf) ();<br /><br />int val1,val2;<br /><br />{<br /><br />return((*pf) (val1,val2));<br /><br /> }<br /><br />Answer:<br /><br />The value if process is 0 !<br /><br />Explanation:<br /><br />The function 'process' has 3 parameters - 1, a pointer to another function 2 and 3,<br />integers. When this function is invoked from main, the following substitutions for<br />formal parameters take place: func for pf, 3 for val1 and 6 for val2. This function<br />returns the result of the operation performed by the function 'func'. The function<br />func has two integer parameters. The formal parameters are substituted as 3 for a<br />and 6 for b. since 3 is not equal to 6, a==b returns 0. therefore the function<br />returns 0 which in turn is returned by the function 'process'.<br /><br /> <br /><br />96) void main()<br /><br />{<br /><br /> static int i=5;<br /><br /> if(--i){<br /><br /> main();<br /><br /> printf("%d ",i);<br /><br /> }<br /><br />}<br /><br />Answer:<br /><br /> 0 0 0 0<br /><br />Explanation:<br /><br /> The variable "I" is declared as static, hence memory for I will be<br />allocated for only once, as it encounters the statement. The function<br />main() will be called recursively unless I becomes equal to 0, and since<br />main() is recursively called, so the value of static I ie., 0 will be<br />printed every time the control is returned.<br /><br /> <br /><br />97) void main()<br /><br />{<br /><br /> int k=ret(sizeof(float));<br /><br /> printf("\n here value is %d",++k);<br /><br />}<br /><br />int ret(int ret)<br /><br />{<br /><br /> ret += 2.5;<br /><br /> return(ret);<br /><br />}<br /><br />Answer:<br /><br /> Here value is 7<br /><br />Explanation:<br /><br /> The int ret(int ret), ie., the function name and the argument name can<br />be the same.<br /><br /> Firstly, the function ret() is called in which the sizeof(float) ie., 4<br />is passed, after the first expression the value in ret will be 6, as<br />ret is integer hence the value stored in ret will have implicit type<br />conversion from float to int. The ret is returned in main() it is<br />printed after and preincrement.<br /><br /> <br /><br />98) void main()<br /><br />{<br /><br /> char a[]="12345\0";<br /><br /> int i=strlen(a);<br /><br /> printf("here in 3 %d\n",++i);<br /><br />}<br /><br />Answer: <br /><br />here in 3 6<br /><br />Explanation:<br /><br /> The char array 'a' will hold the initialized string, whose length will<br />be counted from 0 till the null character. Hence the 'I' will hold the<br />value equal to 5, after the pre-increment in the printf statement, the 6<br />will be printed.<br /><br /> <br /><br />99) void main()<br /><br />{<br /><br /> unsigned giveit=-1;<br /><br /> int gotit;<br /><br /> printf("%u ",++giveit);<br /><br /> printf("%u \n",gotit=--giveit);<br /><br />}<br /><br />Answer:<br /><br /> 0 65535<br /><br />Explanation:<br /><br /> <br /><br />100) void main()<br /><br />{<br /><br /> int i;<br /><br /> char a[]="\0";<br /><br /> if(printf("%s\n",a))<br /><br /> printf("Ok here \n");<br /><br /> else<br /><br /> printf("Forget it\n");<br /><br />}<br /><br />Answer:<br /><br /> Ok here <br /><br />Explanation:<br /><br />Printf will return how many characters does it print. Hence printing a null<br />character returns 1 which makes the if statement true, thus "Ok here" is printed.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-10661760751461988732009-06-08T00:13:00.000+05:302009-06-08T00:14:20.127+05:30c++ source code Examples Part 581)main(int argc, char **argv)<br /><br />{<br /><br /> printf("enter the character");<br /><br /> getchar();<br /><br /> sum(argv[1],argv[2]);<br /><br />}<br /><br />sum(num1,num2)<br /><br />int num1,num2;<br /><br />{<br /><br /> return num1+num2;<br /><br />}<br /><br />Answer:<br /><br />Compiler error.<br /><br />Explanation:<br /><br />argv[1] & argv[2] are strings. They are passed to the function sum without<br />converting it to integer values. <br /><br /> <br /><br />82) # include <stdio.h><br /><br />int one_d[]={1,2,3};<br /><br />main()<br /><br />{<br /><br /> int *ptr; <br /><br /> ptr=one_d;<br /><br /> ptr+=3;<br /><br /> printf("%d",*ptr);<br /><br />}<br /><br />Answer:<br /><br />garbage value<br /><br />Explanation:<br /><br />ptr pointer is pointing to out of the array range of one_d.<br /><br /> <br /><br />83) # include<stdio.h><br /><br />aaa() {<br /><br /> printf("hi");<br /><br /> }<br /><br />bbb(){<br /><br /> printf("hello");<br /><br /> }<br /><br />ccc(){<br /><br /> printf("bye");<br /><br /> }<br /><br />main()<br /><br />{<br /><br /> int (*ptr[3])();<br /><br /> ptr[0]=aaa;<br /><br /> ptr[1]=bbb;<br /><br /> ptr[2]=ccc;<br /><br /> ptr[2]();<br /><br />}<br /><br />Answer:<br /><br />bye <br /><br />Explanation:<br /><br />ptr is array of pointers to functions of return type int.ptr[0] is assigned to<br />address of the function aaa. Similarly ptr[1] and ptr[2] for bbb and ccc<br />respectively. ptr[2]() is in effect of writing ccc(), since ptr[2] points to ccc.<br /><br /> <br /><br />85) #include<stdio.h><br /><br />main()<br /><br />{<br /><br />FILE *ptr;<br /><br />char i;<br /><br />ptr=fopen("zzz.c","r");<br /><br />while((i=fgetch(ptr))!=EOF)<br /><br />printf("%c",i);<br /><br />}<br /><br />Answer:<br /><br />contents of zzz.c followed by an infinite loop <br /><br /> Explanation:<br /><br />The condition is checked against EOF, it should be checked against NULL.<br /><br /> <br /><br />86) main()<br /><br />{<br /><br /> int i =0;j=0;<br /><br /> if(i && j++)<br /><br /> printf("%d..%d",i++,j);<br /><br />printf("%d..%d,i,j);<br /><br />}<br /><br />Answer:<br /><br />0..0 <br /><br />Explanation:<br /><br />The value of i is 0. Since this information is enough to determine the truth value<br />of the boolean expression. So the statement following the if statement is not<br />executed. The values of i and j remain unchanged and get printed.<br /><br /> <br /><br />87) main()<br /><br />{<br /><br /> int i;<br /><br /> i = abc();<br /><br /> printf("%d",i);<br /><br />}<br /><br />abc()<br /><br />{<br /><br /> _AX = 1000;<br /><br />}<br /><br />Answer:<br /><br />1000<br /><br />Explanation:<br /><br />Normally the return value from the function is through the information from the<br />accumulator. Here _AH is the pseudo global variable denoting the accumulator. Hence,<br />the value of the accumulator is set 1000 so the function returns value 1000. <br /><br /> <br /><br />88) int i;<br /><br /> main(){<br /><br />int t;<br /><br />for ( t=4;scanf("%d",&i)-t;printf("%d\n",i))<br /><br /> printf("%d--",t--);<br /><br /> }<br /><br /> // If the inputs are 0,1,2,3 find the o/p<br /><br />Answer:<br /><br /> 4--0<br /><br /> 3--1<br /><br /> 2--2 <br /><br />Explanation:<br /><br />Let us assume some x= scanf("%d",&i)-t the values during execution <br /><br /> will be,<br /><br /> t i x<br /><br /> 4 0 -4<br /><br /> 3 1 -2<br /><br /> 2 2 0<br /><br /> <br /><br />89) main(){<br /><br /> int a= 0;int b = 20;char x =1;char y =10;<br /><br /> if(a,b,x,y)<br /><br /> printf("hello");<br /><br /> }<br /><br />Answer:<br /><br />hello <br /><br />Explanation:<br /><br />The comma operator has associativity from left to right. Only the rightmost value is<br />returned and the other values are evaluated and ignored. Thus the value of last<br />variable y is returned to check in if. Since it is a non zero value if becomes true<br />so, "hello" will be printed.<br /><br /> <br /><br />90) main(){<br /><br /> unsigned int i;<br /><br /> for(i=1;i>-2;i--)<br /><br /> printf("c aptitude");<br /><br />}<br /><br />Explanation:<br /><br />i is an unsigned integer. It is compared with a signed value. Since the both types<br />doesn't match, signed is promoted to unsigned value. The unsigned equivalent of -2<br />is a huge value so condition becomes false and control comes out of the loop. <br /><br /> <br /><br />91) In the following pgm add a stmt in the function fun such that the<br />address of <br /><br />'a' gets stored in 'j'.<br /><br />main(){<br /><br /> int * j;<br /><br /> void fun(int **);<br /><br /> fun(&j);<br /><br /> }<br /><br /> void fun(int **k) {<br /><br /> int a =0;<br /><br /> /* add a stmt here*/<br /><br /> }<br /><br />Answer:<br /><br /> *k = &a<br /><br />Explanation:<br /><br /> The argument of the function is a pointer to a pointer.<br /><br /> <br /><br />92) What are the following notations of defining functions known as?<br /><br />i. int abc(int a,float b)<br /><br /> {<br /><br /> /* some code */<br /><br /> }<br /><br />ii. int abc(a,b)<br /><br /> int a; float b;<br /><br /> {<br /><br /> /* some code*/<br /><br /> }<br /><br />Answer:<br /><br />i. ANSI C notation<br /><br />ii. Kernighan & Ritche notation <br /><br /> <br /><br />93) main()<br /><br />{<br /><br />char *p;<br /><br />p="%d\n";<br /><br /> p++;<br /><br /> p++;<br /><br /> printf(p-2,300);<br /><br />}<br /><br />Answer:<br /><br /> 300<br /><br />Explanation:<br /><br />The pointer points to % since it is incremented twice and again decremented by 2, it<br />points to '%d\n' and 300 is printed.<br /><br /> <br /><br />94) main(){<br /><br /> char a[100];<br /><br /> a[0]='a';a[1]]='b';a[2]='c';a[4]='d';<br /><br /> abc(a);<br /><br />}<br /><br />abc(char a[]){<br /><br /> a++; <br /><br /> printf("%c",*a);<br /><br /> a++;<br /><br /> printf("%c",*a);<br /><br />}<br /><br />Explanation:<br /><br />The base address is modified only in function and as a result a points to 'b' then<br />after incrementing to 'c' so bc will be printed.<br /><br /> <br /><br />95) func(a,b)<br /><br />int a,b;<br /><br />{<br /><br /> return( a= (a==b) );<br /><br />}<br /><br />main()<br /><br />{<br /><br />int process(),func();<br /><br />printf("The value of process is %d !\n ",process(func,3,6));<br /><br />}<br /><br />process(pf,val1,val2)<br /><br />int (*pf) ();<br /><br />int val1,val2;<br /><br />{<br /><br />return((*pf) (val1,val2));<br /><br /> }<br /><br />Answer:<br /><br />The value if process is 0 !<br /><br />Explanation:<br /><br />The function 'process' has 3 parameters - 1, a pointer to another function 2 and 3,<br />integers. When this function is invoked from main, the following substitutions for<br />formal parameters take place: func for pf, 3 for val1 and 6 for val2. This function<br />returns the result of the operation performed by the function 'func'. The function<br />func has two integer parameters. The formal parameters are substituted as 3 for a<br />and 6 for b. since 3 is not equal to 6, a==b returns 0. therefore the function<br />returns 0 which in turn is returned by the function 'process'.<br /><br /> <br /><br />96) void main()<br /><br />{<br /><br /> static int i=5;<br /><br /> if(--i){<br /><br /> main();<br /><br /> printf("%d ",i);<br /><br /> }<br /><br />}<br /><br />Answer:<br /><br /> 0 0 0 0<br /><br />Explanation:<br /><br /> The variable "I" is declared as static, hence memory for I will be<br />allocated for only once, as it encounters the statement. The function<br />main() will be called recursively unless I becomes equal to 0, and since<br />main() is recursively called, so the value of static I ie., 0 will be<br />printed every time the control is returned.<br /><br /> <br /><br />97) void main()<br /><br />{<br /><br /> int k=ret(sizeof(float));<br /><br /> printf("\n here value is %d",++k);<br /><br />}<br /><br />int ret(int ret)<br /><br />{<br /><br /> ret += 2.5;<br /><br /> return(ret);<br /><br />}<br /><br />Answer:<br /><br /> Here value is 7<br /><br />Explanation:<br /><br /> The int ret(int ret), ie., the function name and the argument name can<br />be the same.<br /><br /> Firstly, the function ret() is called in which the sizeof(float) ie., 4<br />is passed, after the first expression the value in ret will be 6, as<br />ret is integer hence the value stored in ret will have implicit type<br />conversion from float to int. The ret is returned in main() it is<br />printed after and preincrement.<br /><br /> <br /><br />98) void main()<br /><br />{<br /><br /> char a[]="12345\0";<br /><br /> int i=strlen(a);<br /><br /> printf("here in 3 %d\n",++i);<br /><br />}<br /><br />Answer: <br /><br />here in 3 6<br /><br />Explanation:<br /><br /> The char array 'a' will hold the initialized string, whose length will<br />be counted from 0 till the null character. Hence the 'I' will hold the<br />value equal to 5, after the pre-increment in the printf statement, the 6<br />will be printed.<br /><br /> <br /><br />99) void main()<br /><br />{<br /><br /> unsigned giveit=-1;<br /><br /> int gotit;<br /><br /> printf("%u ",++giveit);<br /><br /> printf("%u \n",gotit=--giveit);<br /><br />}<br /><br />Answer:<br /><br /> 0 65535<br /><br />Explanation:<br /><br /> <br /><br />100) void main()<br /><br />{<br /><br /> int i;<br /><br /> char a[]="\0";<br /><br /> if(printf("%s\n",a))<br /><br /> printf("Ok here \n");<br /><br /> else<br /><br /> printf("Forget it\n");<br /><br />}<br /><br />Answer:<br /><br /> Ok here <br /><br />Explanation:<br /><br />Printf will return how many characters does it print. Hence printing a null<br />character returns 1 which makes the if statement true, thus "Ok here" is printed.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-70571744199647036032009-06-08T00:07:00.000+05:302009-06-08T00:10:03.503+05:30c++ source code Examples Part 461) main()<br /> <br /> {<br /> <br /> char *cptr,c;<br /> <br /> void *vptr,v;<br /> <br /> c=10; v=0;<br /> <br /> cptr=&c; vptr=&v;<br /> <br /> printf("%c%v",c,v);<br /> <br /> }<br /> <br />Answer:<br /> <br />Compiler error (at line number 4): size of v is Unknown.<br /> <br />Explanation:<br /> <br />You can create a variable of type void * but not of type void, since void is an<br />empty type. In the second line you are creating variable vptr of type void * and v<br />of type void hence an error.<br /> <br /> <br /> <br />62) main()<br /> <br /> {<br /> <br /> char *str1="abcd";<br /> <br /> char str2[]="abcd";<br /> <br /> printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));<br /> <br /> }<br /> <br />Answer:<br /> <br />2 5 5<br /> <br />Explanation:<br /> <br />In first sizeof, str1 is a character pointer so it gives you the size of the pointer<br />variable. In second sizeof the name str2 indicates the name of the array whose size<br />is 5 (including the '\0' termination character). The third sizeof is similar to the<br />second one.<br /> <br /> <br /> <br />63) main()<br /> <br /> {<br /> <br /> char not;<br /> <br /> not=!2;<br /> <br /> printf("%d",not);<br /> <br /> }<br /> <br />Answer:<br /> <br />0<br /> <br />Explanation:<br /> <br />! is a logical operator. In C the value 0 is considered to be the boolean value<br />FALSE, and any non-zero value is considered to be the boolean value TRUE. Here 2 is<br />a non-zero value so TRUE. !TRUE is FALSE (0) so it prints 0.<br /> <br /> <br /> <br />64) #define FALSE -1<br /> <br /> #define TRUE 1<br /> <br /> #define NULL 0<br /> <br /> main() {<br /> <br /> if(NULL)<br /> <br /> puts("NULL");<br /> <br /> else if(FALSE)<br /> <br /> puts("TRUE");<br /> <br /> else<br /> <br /> puts("FALSE");<br /> <br /> }<br /> <br />Answer:<br /> <br />TRUE<br /> <br />Explanation:<br /> <br />The input program to the compiler after processing by the preprocessor is,<br /> <br /> main(){<br /> <br /> if(0)<br /> <br /> puts("NULL");<br /> <br /> else if(-1)<br /> <br /> puts("TRUE");<br /> <br /> else<br /> <br /> puts("FALSE");<br /> <br /> }<br /> <br />Preprocessor doesn't replace the values given inside the double quotes. The check by<br />if condition is boolean value false so it goes to else. In second if -1 is boolean<br />value true hence "TRUE" is printed.<br /> <br /> <br /> <br />65) main()<br /> <br /> {<br /> <br /> int k=1;<br /> <br /> printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE");<br /> <br /> }<br /> <br />Answer:<br /> <br />1==1 is TRUE<br /> <br />Explanation:<br /> <br />When two strings are placed together (or separated by white-space) they are<br />concatenated (this is called as "stringization" operation). So the string is as if<br />it is given as "%d==1 is %s". The conditional operator( ?: ) evaluates to "TRUE".<br /> <br /> <br /> <br />66) main()<br /> <br /> {<br /> <br /> int y;<br /> <br /> scanf("%d",&y); // input given is 2000<br /> <br /> if( (y%4==0 && y%100 != 0) || y%100 == 0 )<br /> <br /> printf("%d is a leap year");<br /> <br /> else<br /> <br /> printf("%d is not a leap year");<br /> <br /> }<br /> <br />Answer:<br /> <br />2000 is a leap year<br /> <br />Explanation:<br /> <br />An ordinary program to check if leap year or not.<br /> <br /> <br /> <br />67) #define max 5<br /> <br /> #define int arr1[max]<br /> <br /> main()<br /> <br /> {<br /> <br /> typedef char arr2[max];<br /> <br /> arr1 list={0,1,2,3,4};<br /> <br /> arr2 name="name";<br /> <br /> printf("%d %s",list[0],name);<br /> <br /> }<br /> <br />Answer:<br /> <br />Compiler error (in the line arr1 list = {0,1,2,3,4})<br /> <br />Explanation:<br /> <br />arr2 is declared of type array of size 5 of characters. So it can be used to declare<br />the variable name of the type arr2. But it is not the case of arr1. Hence an error.<br /> <br />Rule of Thumb: <br /> <br />#defines are used for textual replacement whereas typedefs are used for declaring<br />new types.<br /> <br /> <br /> <br />68) int i=10;<br /> <br /> main()<br /> <br /> {<br /> <br /> extern int i;<br /> <br /> {<br /> <br /> int i=20;<br /> <br /> {<br /> <br /> const volatile unsigned i=30;<br /> <br /> printf("%d",i);<br /> <br /> }<br /> <br /> printf("%d",i);<br /> <br /> }<br /> <br /> printf("%d",i);<br /> <br /> }<br /> <br />Answer:<br /> <br />30,20,10<br /> <br />Explanation:<br /> <br />'{' introduces new block and thus new scope. In the innermost block i is declared as, <br /> <br /> const volatile unsigned<br /> <br />which is a valid declaration. i is assumed of type int. So printf prints 30. In the<br />next block, i has value 20 and so printf prints 20. In the outermost block, i is<br />declared as extern, so no storage space is allocated for it. After compilation is<br />over the linker resolves it to global variable i (since it is the only variable<br />visible there). So it prints i's value as 10.<br /> <br /> <br /> <br />69) main()<br /> <br /> {<br /> <br /> int *j;<br /> <br /> {<br /> <br /> int i=10;<br /> <br /> j=&i;<br /> <br /> }<br /> <br /> printf("%d",*j);<br /> <br />}<br /> <br />Answer:<br /> <br />10<br /> <br />Explanation:<br /> <br />The variable i is a block level variable and the visibility is inside that block<br />only. But the lifetime of i is lifetime of the function so it lives upto the exit of<br />main function. Since the i is still allocated space, *j prints the value stored in i<br />since j points i.<br /> <br /> <br /> <br />70) main()<br /> <br /> {<br /> <br /> int i=-1;<br /> <br /> -i;<br /> <br /> printf("i = %d, -i = %d \n",i,-i);<br /> <br /> }<br /> <br />Answer:<br /> <br />i = -1, -i = 1<br /> <br />Explanation:<br /> <br />-i is executed and this execution doesn't affect the value of i. In printf first you<br />just print the value of i. After that the value of the expression -i = -(-1) is<br />printed.<br /> <br /> <br /> <br />71) #include<stdio.h><br /> <br />main()<br /> <br /> {<br /> <br /> const int i=4;<br /> <br /> float j;<br /> <br /> j = ++i;<br /> <br /> printf("%d %f", i,++j);<br /> <br /> }<br /> <br />Answer:<br /> <br />Compiler error <br /> <br /> Explanation:<br /> <br />i is a constant. you cannot change the value of constant <br /> <br /> <br /> <br />72) #include<stdio.h><br /> <br />main()<br /> <br />{<br /> <br /> int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} };<br /> <br /> int *p,*q;<br /> <br /> p=&a[2][2][2];<br /> <br /> *q=***a;<br /> <br /> printf("%d..%d",*p,*q);<br /> <br />}<br /> <br />Answer:<br /> <br />garbagevalue..1<br /> <br />Explanation:<br /> <br />p=&a[2][2][2] you declare only two 2D arrays. but you are trying to access the<br />third 2D(which you are not declared) it will print garbage values. *q=***a starting<br />address of a is assigned integer pointer. now q is pointing to starting address of<br />a.if you print *q meAnswer:it will print first element of 3D array.<br /> <br /> <br /> <br />73) #include<stdio.h><br /> <br />main()<br /> <br /> {<br /> <br /> register i=5;<br /> <br /> char j[]= "hello"; <br /> <br /> printf("%s %d",j,i);<br /> <br />}<br /> <br />Answer:<br /> <br />hello 5<br /> <br />Explanation:<br /> <br />if you declare i as register compiler will treat it as ordinary integer and it will<br />take integer value. i value may be stored either in register or in memory.<br /> <br /> <br /> <br />74) main()<br /> <br />{<br /> <br /> int i=5,j=6,z;<br /> <br /> printf("%d",i+++j);<br /> <br /> }<br /> <br />Answer:<br /> <br />11<br /> <br />Explanation:<br /> <br />the expression i+++j is treated as (i++ + j) <br /> <br /> <br /> <br />76) struct aaa{<br /> <br />struct aaa *prev;<br /> <br />int i;<br /> <br />struct aaa *next;<br /> <br />};<br /> <br />main()<br /> <br />{<br /> <br /> struct aaa abc,def,ghi,jkl;<br /> <br /> int x=100;<br /> <br /> abc.i=0;abc.prev=&jkl;<br /> <br /> abc.next=&def;<br /> <br /> def.i=1;def.prev=&abc;def.next=&ghi;<br /> <br /> ghi.i=2;ghi.prev=&def;<br /> <br /> ghi.next=&jkl;<br /> <br /> jkl.i=3;jkl.prev=&ghi;jkl.next=&abc;<br /> <br /> x=abc.next->next->prev->next->i;<br /> <br /> printf("%d",x);<br /> <br />}<br /> <br />Answer:<br /> <br />2<br /> <br />Explanation:<br /> <br /> above all statements form a double circular linked list;<br /> <br />abc.next->next->prev->next->i <br /> <br />this one points to "ghi" node the value of at particular node is 2.<br /> <br /> <br /> <br />77) struct point<br /> <br /> {<br /> <br /> int x;<br /> <br /> int y;<br /> <br /> };<br /> <br />struct point origin,*pp;<br /> <br />main()<br /> <br />{<br /> <br />pp=&origin;<br /> <br />printf("origin is(%d%d)\n",(*pp).x,(*pp).y);<br /> <br />printf("origin is (%d%d)\n",pp->x,pp->y);<br /> <br />} <br /> <br /> <br /> <br />Answer:<br /> <br />origin is(0,0)<br /> <br />origin is(0,0) <br /> <br />Explanation:<br /> <br />pp is a pointer to structure. we can access the elements of the structure either<br />with arrow mark or with indirection operator. <br /> <br />Note: <br /> <br />Since structure point is globally declared x & y are initialized as zeroes <br /> <br /> <br /> <br />78) main()<br /> <br />{<br /> <br /> int i=_l_abc(10);<br /> <br /> printf("%d\n",--i);<br /> <br />}<br /> <br />int _l_abc(int i)<br /> <br />{<br /> <br /> return(i++);<br /> <br />}<br /> <br />Answer:<br /> <br />9<br /> <br />Explanation: <br /> <br />return(i++) it will first return i and then increments. i.e. 10 will be returned.<br /> <br /> <br /> <br />79) main()<br /> <br />{<br /> <br /> char *p;<br /> <br /> int *q;<br /> <br /> long *r;<br /> <br /> p=q=r=0;<br /> <br /> p++;<br /> <br /> q++;<br /> <br /> r++;<br /> <br /> printf("%p...%p...%p",p,q,r);<br /> <br />}<br /> <br />Answer:<br /> <br />0001...0002...0004<br /> <br />Explanation:<br /> <br />++ operator when applied to pointers increments address according to their<br />corresponding data-types.<br /> <br /> <br /> <br /> 80) main()<br /> <br />{<br /> <br /> char c=' ',x,convert(z);<br /> <br /> getc(c);<br /> <br /> if((c>='a') && (c<='z'))<br /> <br /> x=convert(c);<br /> <br /> printf("%c",x);<br /> <br />}<br /> <br />convert(z)<br /> <br />{<br /> <br /> return z-32;<br /> <br />}<br /> <br />Answer: <br /> <br />Compiler error<br /> <br />Explanation:<br /> <br />declaration of convert and format of getc() are wrong.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-59043841770885680582009-06-08T00:05:00.000+05:302009-06-08T00:07:12.877+05:30C++ source code Examples Part 341) #include<stdio.h>
<br />
<br />main()
<br />
<br />{
<br />
<br /> struct xx
<br />
<br /> {
<br />
<br /> int x=3;
<br />
<br /> char name[]="hello";
<br />
<br /> };
<br />
<br />struct xx *s=malloc(sizeof(struct xx));
<br />
<br />printf("%d",s->x);
<br />
<br />printf("%s",s->name);
<br />
<br />}
<br />
<br />Answer:
<br />
<br />Compiler Error
<br />
<br />Explanation:
<br />
<br />Initialization should not be done for structure members inside the structure
<br />declaration
<br />
<br />
<br />
<br />42) #include<stdio.h>
<br />
<br />main()
<br />
<br />{
<br />
<br />struct xx
<br />
<br /> {
<br />
<br /> int x;
<br />
<br /> struct yy
<br />
<br /> {
<br />
<br /> char s;
<br />
<br /> struct xx *p;
<br />
<br /> };
<br />
<br /> struct yy *q;
<br />
<br /> };
<br />
<br /> }
<br />
<br />Answer:
<br />
<br />Compiler Error
<br />
<br />Explanation:
<br />
<br />in the end of nested structure yy a member have to be declared.
<br />
<br />
<br />
<br />43) main()
<br />
<br />{
<br />
<br /> extern int i;
<br />
<br /> i=20;
<br />
<br /> printf("%d",sizeof(i));
<br />
<br />}
<br />
<br />Answer:
<br />
<br />Linker error: undefined symbol '_i'.
<br />
<br />Explanation:
<br />
<br />extern declaration specifies that the variable i is defined somewhere else. The
<br />compiler passes the external variable to be resolved by the linker. So compiler
<br />doesn't find an error. During linking the linker searches for the definition of i.
<br />Since it is not found the linker flags an error.
<br />
<br />
<br />
<br />44) main()
<br />
<br />{
<br />
<br />printf("%d", out);
<br />
<br />}
<br />
<br />int out=100;
<br />
<br />Answer:
<br />
<br />Compiler error: undefined symbol out in function main.
<br />
<br />Explanation:
<br />
<br />The rule is that a variable is available for use from the point of declaration. Even
<br />though a is a global variable, it is not available for main. Hence an error.
<br />
<br />
<br />
<br />45) main()
<br />
<br />{
<br />
<br /> extern out;
<br />
<br /> printf("%d", out);
<br />
<br />}
<br />
<br /> int out=100;
<br />
<br />Answer:
<br />
<br />100
<br />
<br /> Explanation:
<br />
<br />This is the correct way of writing the previous program.
<br />
<br />
<br />
<br />46) main()
<br />
<br />{
<br />
<br /> show();
<br />
<br />}
<br />
<br />void show()
<br />
<br />{
<br />
<br /> printf("I'm the greatest");
<br />
<br />}
<br />
<br />Answer:
<br />
<br />Compier error: Type mismatch in redeclaration of show.
<br />
<br />Explanation:
<br />
<br />When the compiler sees the function show it doesn't know anything about it. So the
<br />default return type (ie, int) is assumed. But when compiler sees the actual
<br />definition of show mismatch occurs since it is declared as void. Hence the error.
<br />
<br />The solutions are as follows:
<br />
<br />1. declare void show() in main() .
<br />
<br />2. define show() before main().
<br />
<br />3. declare extern void show() before the use of show().
<br />
<br />
<br />
<br />47) main( )
<br />
<br />{
<br />
<br /> int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};
<br />
<br /> printf(“%u %u %u %d \n”,a,*a,**a,***a);
<br />
<br /> printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1);
<br />
<br /> }
<br />
<br />Answer:
<br />
<br />100, 100, 100, 2
<br />
<br />114, 104, 102, 3
<br />
<br />Explanation:
<br />
<br /> The given array is a 3-D one. It can also be viewed as a 1-D array.
<br />
<br />
<br />
<br />2
<br />
<br />4
<br />
<br />7
<br />
<br />8
<br />
<br />3
<br />
<br />4
<br />
<br />2
<br />
<br />2
<br />
<br />2
<br />
<br />3
<br />
<br />3
<br />
<br />4
<br />
<br /> 100 102 104 106 108 110 112 114 116 118 120 122
<br />
<br />
<br />
<br />thus, for the first printf statement a, *a, **a give address of first element .
<br />since the indirection ***a gives the value. Hence, the first line of the output.
<br />
<br />for the second printf a+1 increases in the third dimension thus points to value at
<br />114, *a+1 increments in second dimension thus points to 104, **a +1 increments the
<br />first dimension thus points to 102 and ***a+1 first gets the value at first location
<br />and then increments it by 1. Hence, the output.
<br />
<br />
<br />
<br />48) main( )
<br />
<br />{
<br />
<br /> int a[ ] = {10,20,30,40,50},j,*p;
<br />
<br /> for(j=0; j<5; j++)
<br />
<br /> {
<br />
<br />printf(“%d” ,*a);
<br />
<br />a++;
<br />
<br /> }
<br />
<br /> p = a;
<br />
<br /> for(j=0; j<5; j++)
<br />
<br /> {
<br />
<br />printf(“%d ” ,*p);
<br />
<br />p++;
<br />
<br /> }
<br />
<br /> }
<br />
<br />Answer:
<br />
<br />Compiler error: lvalue required.
<br />
<br />
<br />
<br />Explanation:
<br />
<br />Error is in line with statement a++. The operand must be an lvalue and may be of any
<br />of scalar type for the any operator, array name only when subscripted is an lvalue.
<br />Simply array name is a non-modifiable lvalue.
<br />
<br />
<br />
<br />49) main( )
<br />
<br />{
<br />
<br /> static int a[ ] = {0,1,2,3,4};
<br />
<br /> int *p[ ] = {a,a+1,a+2,a+3,a+4};
<br />
<br /> int **ptr = p;
<br />
<br /> ptr++;
<br />
<br /> printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
<br />
<br /> *ptr++;
<br />
<br /> printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
<br />
<br /> *++ptr;
<br />
<br /> printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
<br />
<br /> ++*ptr;
<br />
<br /> printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr);
<br />
<br />}
<br />
<br />Answer:
<br />
<br /> 111
<br />
<br /> 222
<br />
<br /> 333
<br />
<br /> 344
<br />
<br />Explanation:
<br />
<br />Let us consider the array and the two pointers with some address
<br />
<br />a
<br />
<br />0
<br />
<br />1
<br />
<br />2
<br />
<br />3
<br />
<br />4
<br />
<br /> 100 102 104 106 108
<br />
<br /> p
<br />
<br />100
<br />
<br />102
<br />
<br />104
<br />
<br />106
<br />
<br />108
<br />
<br /> 1000 1002 1004 1006 1008
<br />
<br /> ptr
<br />
<br />1000
<br />
<br />2000
<br />
<br />After execution of the instruction ptr++ value in ptr becomes 1002, if scaling
<br />factor for integer is 2 bytes. Now ptr – p is value in ptr – starting location of
<br />array p, (1002 – 1000) / (scaling factor) = 1, *ptr – a = value at address pointed
<br />by ptr – starting value of array a, 1002 has a value 102 so the value is (102 –
<br />100)/(scaling factor) = 1, **ptr is the value stored in the location pointed by
<br />the pointer of ptr = value pointed by value pointed by 1002 = value pointed by 102 =
<br />1. Hence the output of the firs printf is 1, 1, 1.
<br />
<br />After execution of *ptr++ increments value of the value in ptr by scaling factor, so
<br />it becomes1004. Hence, the outputs for the second printf are ptr – p = 2, *ptr – a =
<br />2, **ptr = 2.
<br />
<br />After execution of *++ptr increments value of the value in ptr by scaling factor, so
<br />it becomes1004. Hence, the outputs for the third printf are ptr – p = 3, *ptr – a =
<br />3, **ptr = 3.
<br />
<br />After execution of ++*ptr value in ptr remains the same, the value pointed by the
<br />value is incremented by the scaling factor. So the value in array p at location 1006
<br />changes from 106 10 108,. Hence, the outputs for the fourth printf are ptr – p =
<br />1006 – 1000 = 3, *ptr – a = 108 – 100 = 4, **ptr = 4.
<br />
<br />
<br />
<br />50) main( )
<br />
<br />{
<br />
<br /> char *q;
<br />
<br /> int j;
<br />
<br /> for (j=0; j<3; j++) scanf(“%s” ,(q+j));
<br />
<br /> for (j=0; j<3; j++) printf(“%c” ,*(q+j));
<br />
<br /> for (j=0; j<3; j++) printf(“%s” ,(q+j));
<br />
<br />}
<br />
<br />Explanation:
<br />
<br />Here we have only one pointer to type char and since we take input in the same
<br />pointer thus we keep writing over in the same location, each time shifting the
<br />pointer value by 1. Suppose the inputs are MOUSE, TRACK and VIRTUAL. Then for the
<br />first input suppose the pointer starts at location 100 then the input one is stored
<br />as
<br />MOU
<br />S
<br />
<br />E
<br />
<br />\0
<br />
<br />When the second input is given the pointer is incremented as j value becomes 1, so
<br />the input is filled in memory starting from 101.
<br />MTRACK\0
<br />The third input starts filling from the location 102
<br />MTVIRTUAL
<br />\0
<br />
<br />This is the final value stored .
<br />
<br />The first printf prints the values at the position q, q+1 and q+2 = M T V
<br />
<br />The second printf prints three strings starting from locations q, q+1, q+2
<br />
<br /> i.e MTVIRTUAL, TVIRTUAL and VIRTUAL.
<br />
<br />
<br />
<br />51) main( )
<br />
<br />{
<br />
<br /> void *vp;
<br />
<br /> char ch = ‘g’, *cp = “goofy”;
<br />
<br /> int j = 20;
<br />
<br /> vp = &ch;
<br />
<br /> printf(“%c”, *(char *)vp);
<br />
<br /> vp = &j;
<br />
<br /> printf(“%d”,*(int *)vp);
<br />
<br /> vp = cp;
<br />
<br /> printf(“%s”,(char *)vp + 3);
<br />
<br />}
<br />
<br />Answer:
<br />
<br /> g20fy
<br />
<br />Explanation:
<br />
<br />Since a void pointer is used it can be type casted to any other type pointer. vp =
<br />&ch stores address of char ch and the next statement prints the value stored in vp
<br />after type casting it to the proper data type pointer. the output is ‘g’. Similarly
<br />the output from second printf is ‘20’. The third printf statement type casts it to
<br />print the string from the 4th value hence the output is ‘fy’.
<br />
<br />
<br />
<br />52) main ( )
<br />
<br />{
<br />
<br /> static char *s[ ] = {“black”, “white”, “yellow”, “violet”};
<br />
<br /> char **ptr[ ] = {s+3, s+2, s+1, s}, ***p;
<br />
<br /> p = ptr;
<br />
<br /> **++p;
<br />
<br /> printf(“%s”,*--*++p + 3);
<br />
<br />}
<br />
<br />Answer:
<br />
<br /> ck
<br />
<br />Explanation:
<br />
<br />In this problem we have an array of char pointers pointing to start of 4 strings.
<br />Then we have ptr which is a pointer to a pointer of type char and a variable p which
<br />is a pointer to a pointer to a pointer of type char. p hold the initial value of
<br />ptr, i.e. p = s+3. The next statement increment value in p by 1 , thus now value of
<br />p = s+2. In the printf statement the expression is evaluated *++p causes gets value
<br />s+1 then the pre decrement is executed and we get s+1 – 1 = s . the indirection
<br />operator now gets the value from the array of s and adds 3 to the starting address.
<br />The string is printed starting from this position. Thus, the output is ‘ck’.
<br />
<br />
<br />
<br />53) main()
<br />
<br />{
<br />
<br /> int i, n;
<br />
<br /> char *x = “girl”;
<br />
<br /> n = strlen(x);
<br />
<br /> *x = x[n];
<br />
<br /> for(i=0; i<n; ++i)
<br />
<br /> {
<br />
<br />printf(“%s\n”,x);
<br />
<br />x++;
<br />
<br /> }
<br />
<br /> }
<br />
<br />Answer:
<br />
<br />(blank space)
<br />
<br />irl
<br />
<br />rl
<br />
<br />l
<br />
<br />
<br />
<br />Explanation:
<br />
<br />Here a string (a pointer to char) is initialized with a value “girl”. The strlen
<br />function returns the length of the string, thus n has a value 4. The next statement
<br />assigns value at the nth location (‘\0’) to the first location. Now the string
<br />becomes “\0irl” . Now the printf statement prints the string after each iteration it
<br />increments it starting position. Loop starts from 0 to 4. The first time x[0] =
<br />‘\0’ hence it prints nothing and pointer value is incremented. The second time it
<br />prints from x[1] i.e “irl” and the third time it prints “rl” and the last time it
<br />prints “l” and the loop terminates.
<br />
<br />54) int i,j;
<br />
<br /> for(i=0;i<=10;i++)
<br />
<br /> {
<br />
<br /> j+=5;
<br />
<br /> assert(i<5);
<br />
<br /> }
<br />
<br />Answer:
<br />
<br />Runtime error: Abnormal program termination.
<br />
<br /> assert failed (i<5), <file name>,<line number>
<br />
<br />Explanation:
<br />
<br />asserts are used during debugging to make sure that certain conditions are
<br />satisfied. If assertion fails, the program will terminate reporting the same. After
<br />debugging use,
<br />
<br /> #undef NDEBUG
<br />
<br />and this will disable all the assertions from the source code. Assertion
<br />
<br />is a good debugging tool to make use of.
<br />
<br />
<br />
<br />55) main()
<br />
<br /> {
<br />
<br /> int i=-1;
<br />
<br /> +i;
<br />
<br /> printf("i = %d, +i = %d \n",i,+i);
<br />
<br /> }
<br />
<br />Answer:
<br />
<br /> i = -1, +i = -1
<br />
<br />Explanation:
<br />
<br />Unary + is the only dummy operator in C. Where-ever it comes you can just ignore it
<br />just because it has no effect in the expressions (hence the name dummy operator).
<br />
<br />
<br />
<br />56) What are the files which are automatically opened when a C file is executed?
<br />
<br />Answer:
<br />
<br />stdin, stdout, stderr (standard input,standard output,standard error).
<br />
<br />
<br />
<br />57) what will be the position of the file marker?
<br />
<br /> a: fseek(ptr,0,SEEK_SET);
<br />
<br /> b: fseek(ptr,0,SEEK_CUR);
<br />
<br />
<br />
<br />Answer :
<br />
<br /> a: The SEEK_SET sets the file position marker to the starting of the file.
<br />
<br /> b: The SEEK_CUR sets the file position marker to the current
<br />position
<br />
<br /> of the file.
<br />
<br />
<br />
<br />58) main()
<br />
<br /> {
<br />
<br /> char name[10],s[12];
<br />
<br /> scanf(" \"%[^\"]\"",s);
<br />
<br /> }
<br />
<br /> How scanf will execute?
<br />
<br />Answer:
<br />
<br />First it checks for the leading white space and discards it.Then it matches with a
<br />quotation mark and then it reads all character upto another quotation mark.
<br />
<br />
<br />
<br />59) What is the problem with the following code segment?
<br />
<br /> while ((fgets(receiving array,50,file_ptr)) != EOF)
<br />
<br /> ;
<br />
<br />Answer & Explanation:
<br />
<br />fgets returns a pointer. So the correct end of file check is checking for != NULL.
<br />
<br />
<br />
<br />60) main()
<br />
<br /> {
<br />
<br /> main();
<br />
<br /> }
<br />
<br />Answer:
<br />
<br /> Runtime error : Stack overflow.
<br />
<br />Explanation:
<br />
<br />main function calls itself again and again. Each time the function is called its
<br />return address is stored in the call stack. Since there is no condition to terminate
<br />the function call, the call stack overflows at runtime. So it terminates the program
<br />and results in an error.
<br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-70396582163274830052009-06-08T00:03:00.000+05:302009-06-08T00:05:22.670+05:30c++ source code Examples Part 221. #define square(x) x*x<br /> <br />main()<br /> <br />{<br /> <br />int i;<br /> <br />i = 64/square(4);<br /> <br />printf("%d",i);<br /> <br />}<br /> <br />Answer:<br /> <br />64<br /> <br />Explanation:<br /> <br />the macro call square(4) will substituted by 4*4 so the expression becomes i =<br />64/4*4 . Since / and * has equal priority the expression will be evaluated as<br />(64/4)*4 i.e. 16*4 = 64<br /> <br /> <br /> <br />22. main()<br /> <br />{<br /> <br />char *p="hai friends",*p1;<br /> <br />p1=p;<br /> <br />while(*p!='\0') ++*p++;<br /> <br />printf("%s %s",p,p1);<br /> <br />}<br /> <br />Answer:<br /> <br />ibj!gsjfoet<br /> <br /> Explanation:<br /> <br /> ++*p++ will be parse in the given order<br /> <br />Ø *p that is value at the location currently pointed by p will be taken<br /> <br />Ø ++*p the retrieved value will be incremented <br /> <br />Ø when ; is encountered the location will be incremented that is p++ will be<br />executed<br /> <br />Hence, in the while loop initial value pointed by p is ‘h’, which is changed to ‘i’<br />by executing ++*p and pointer moves to point, ‘a’ which is similarly changed to ‘b’<br />and so on. Similarly blank space is converted to ‘!’. Thus, we obtain value in p<br />becomes “ibj!gsjfoet” and since p reaches ‘\0’ and p1 points to p thus p1doesnot<br />print anything. <br /> <br /> <br /> <br />23. #include <stdio.h><br /> <br />#define a 10<br /> <br />main()<br /> <br />{<br /> <br />#define a 50<br /> <br />printf("%d",a);<br /> <br />}<br /> <br />Answer:<br /> <br />50<br /> <br />Explanation:<br /> <br />The preprocessor directives can be redefined anywhere in the program. So the most<br />recently assigned value will be taken.<br /> <br /> <br /> <br />24. #define clrscr() 100<br /> <br />main()<br /> <br />{<br /> <br />clrscr();<br /> <br />printf("%d\n",clrscr());<br /> <br />}<br /> <br />Answer:<br /> <br />100<br /> <br />Explanation:<br /> <br />Preprocessor executes as a seperate pass before the execution of the compiler. So<br />textual replacement of clrscr() to 100 occurs.The input program to compiler looks<br />like this :<br /> <br /> main()<br /> <br /> {<br /> <br /> 100;<br /> <br /> printf("%d\n",100);<br /> <br /> }<br /> <br /> Note: <br /> <br />100; is an executable statement but with no action. So it doesn't give any problem<br /> <br /> <br /> <br />25. main()<br /> <br />{<br /> <br />printf("%p",main);<br /> <br />}<br /> <br />Answer:<br /> <br /> Some address will be printed.<br /> <br />Explanation:<br /> <br /> Function names are just addresses (just like array names are addresses).<br /> <br />main() is also a function. So the address of function main will be printed. %p in<br />printf specifies that the argument is an address. They are printed as hexadecimal<br />numbers.<br /> <br /> <br /> <br />27) main()<br /> <br />{<br /> <br />clrscr();<br /> <br />}<br /> <br />clrscr();<br /> <br /> <br /> <br />Answer:<br /> <br />No output/error<br /> <br />Explanation:<br /> <br />The first clrscr() occurs inside a function. So it becomes a function call. In the<br />second clrscr(); is a function declaration (because it is not inside any function).<br /> <br /> <br /> <br />28) enum colors {BLACK,BLUE,GREEN}<br /> <br /> main()<br /> <br />{<br /> <br /> <br /> <br /> printf("%d..%d..%d",BLACK,BLUE,GREEN);<br /> <br /> <br /> <br /> return(1);<br /> <br />}<br /> <br />Answer:<br /> <br />0..1..2<br /> <br />Explanation:<br /> <br />enum assigns numbers starting from 0, if not explicitly defined.<br /> <br /> <br /> <br />29) void main()<br /> <br />{<br /> <br /> char far *farther,*farthest;<br /> <br /> <br /> <br /> printf("%d..%d",sizeof(farther),sizeof(farthest));<br /> <br /> <br /> <br /> }<br /> <br />Answer:<br /> <br />4..2 <br /> <br />Explanation:<br /> <br /> the second pointer is of char type and not a far pointer<br /> <br /> <br /> <br />30) main()<br /> <br />{<br /> <br /> int i=400,j=300;<br /> <br /> printf("%d..%d");<br /> <br />}<br /> <br />Answer:<br /> <br />400..300<br /> <br />Explanation:<br /> <br />printf takes the values of the first two assignments of the program. Any number of<br />printf's may be given. All of them take only the first two values. If more number of<br />assignments given in the program,then printf will take garbage values.<br /> <br /> <br /> <br />31) main()<br /> <br />{<br /> <br /> char *p;<br /> <br /> p="Hello";<br /> <br /> printf("%c\n",*&*p);<br /> <br />}<br /> <br />Answer:<br /> <br />H <br /> <br />Explanation:<br /> <br />* is a dereference operator & is a reference operator. They can be applied any<br />number of times provided it is meaningful. Here p points to the first character in<br />the string "Hello". *p dereferences it and so its value is H. Again & references it<br />to an address and * dereferences it to the value H.<br /> <br /> <br /> <br />32) main()<br /> <br />{<br /> <br /> int i=1;<br /> <br /> while (i<=5)<br /> <br /> {<br /> <br /> printf("%d",i);<br /> <br /> if (i>2)<br /> <br /> goto here;<br /> <br /> i++;<br /> <br /> }<br /> <br />}<br /> <br />fun()<br /> <br />{<br /> <br /> here:<br /> <br /> printf("PP");<br /> <br />}<br /> <br />Answer:<br /> <br />Compiler error: Undefined label 'here' in function main<br /> <br />Explanation:<br /> <br />Labels have functions scope, in other words The scope of the labels is limited to<br />functions . The label 'here' is available in function fun() Hence it is not visible<br />in function main.<br /> <br /> <br /> <br />33) main()<br /> <br />{<br /> <br /> static char names[5][20]={"pascal","ada","cobol","fortran","perl"};<br /> <br /> int i;<br /> <br /> char *t;<br /> <br /> t=names[3];<br /> <br /> names[3]=names[4];<br /> <br /> names[4]=t; <br /> <br /> for (i=0;i<=4;i++)<br /> <br /> printf("%s",names[i]);<br /> <br />}<br /> <br />Answer:<br /> <br />Compiler error: Lvalue required in function main<br /> <br />Explanation:<br /> <br />Array names are pointer constants. So it cannot be modified.<br /> <br /> <br /> <br />34) void main()<br /> <br />{<br /> <br /> int i=5;<br /> <br /> printf("%d",i++ + ++i);<br /> <br />}<br /> <br />Answer:<br /> <br />Output Cannot be predicted exactly.<br /> <br />Explanation:<br /> <br />Side effects are involved in the evaluation of i<br /> <br /> <br /> <br />35) void main()<br /> <br />{<br /> <br /> int i=5;<br /> <br /> printf("%d",i+++++i);<br /> <br />}<br /> <br />Answer:<br /> <br />Compiler Error <br /> <br />Explanation:<br /> <br />The expression i+++++i is parsed as i ++ ++ + i which is an illegal combination of<br />operators. <br /> <br /> <br /> <br />36) #include<stdio.h><br /> <br />main()<br /> <br />{<br /> <br />int i=1,j=2;<br /> <br />switch(i)<br /> <br /> {<br /> <br /> case 1: printf("GOOD");<br /> <br /> break;<br /> <br /> case j: printf("BAD");<br /> <br /> break;<br /> <br /> }<br /> <br />}<br /> <br />Answer:<br /> <br />Compiler Error: Constant expression required in function main.<br /> <br />Explanation:<br /> <br />The case statement can have only constant expressions (this implies that we cannot<br />use variable names directly so an error).<br /> <br /> Note:<br /> <br />Enumerated types can be used in case statements. <br /> <br /> <br /> <br />37) main()<br /> <br />{<br /> <br />int i;<br /> <br />printf("%d",scanf("%d",&i)); // value 10 is given as input here<br /> <br />}<br /> <br />Answer:<br /> <br />1<br /> <br />Explanation:<br /> <br />Scanf returns number of items successfully read and not 1/0. Here 10 is given as<br />input which should have been scanned successfully. So number of items read is 1. <br /> <br /> <br /> <br />38) #define f(g,g2) g##g2<br /> <br />main()<br /> <br />{<br /> <br />int var12=100;<br /> <br />printf("%d",f(var,12));<br /> <br /> }<br /> <br />Answer:<br /> <br />100 <br /> <br /> <br /> <br />39) main()<br /> <br />{<br /> <br />int i=0;<br /> <br /> <br /> <br />for(;i++;printf("%d",i)) ;<br /> <br />printf("%d",i);<br /> <br />}<br /> <br />Answer:<br /> <br /> 1<br /> <br />Explanation:<br /> <br />before entering into the for loop the checking condition is "evaluated". Here it<br />evaluates to 0 (false) and comes out of the loop, and i is incremented (note the<br />semicolon after the for loop).<br /> <br /> <br /> <br />40) #include<stdio.h><br /> <br />main()<br /> <br />{<br /> <br /> char s[]={'a','b','c','\n','c','\0'};<br /> <br /> char *p,*str,*str1;<br /> <br /> p=&s[3];<br /> <br /> str=p;<br /> <br /> str1=s;<br /> <br /> printf("%d",++*p + ++*str1-32);<br /> <br />}<br /> <br />Answer:<br /> <br />M<br /> <br />Explanation:<br /> <br />p is pointing to character '\n'.str1 is pointing to character 'a' ++*p meAnswer:"p<br />is pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10.<br />then it is incremented to 11. the value of ++*p is 11. ++*str1 meAnswer:"str1 is<br />pointing to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is<br />98. both 11 and 98 is added and result is subtracted from 32. <br /> <br />i.e. (11+98-32)=77("M");<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-66733255589658340902009-06-07T23:55:00.003+05:302009-06-08T00:00:44.876+05:30c++ source code Examples Part 1<meta equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 10"><meta name="Originator" content="Microsoft Word 10"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CSHIVLEE%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"><o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"></o:smarttagtype><!--[if gte mso 9]><xml> <o:officedocumentsettings> <o:relyonvml/> <o:allowpng/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:worddocument> <w:view>Normal</w:View> <w:zoom>0</w:Zoom> <w:compatibility> <w:breakwrappedtables/> <w:snaptogridincell/> <w:wraptextwithpunct/> <w:useasianbreakrules/> </w:Compatibility> </w:WordDocument> </xml><![endif]--><!--[if !mso]><object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id="ieooui"></object> <style> st1\:*{behavior:url(#ieooui) } </style> <![endif]--><style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:1627421319 -2147483648 8 0 66047 0;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1610611985 1073750139 0 0 159 0;} @font-face {font-family:Cambria; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1073741899 0 0 159 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:Calibri; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} h2 {mso-style-noshow:yes; mso-style-next:Normal; margin-top:10.0pt; margin-right:0in; margin-bottom:0in; margin-left:0in; margin-bottom:.0001pt; line-height:115%; mso-pagination:widow-orphan lines-together; page-break-after:avoid; mso-outline-level:2; font-size:13.0pt; font-family:Cambria; color:#4F81BD; font-weight:bold;} h3 {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; mso-outline-level:3; font-size:13.5pt; font-family:"Times New Roman"; font-weight:bold;} a:link, span.MsoHyperlink {mso-style-noshow:yes; color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} p {mso-margin-top-alt:auto; margin-right:0in; mso-margin-bottom-alt:auto; margin-left:0in; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} pre {margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; font-size:10.0pt; font-family:"Courier New"; mso-fareast-font-family:"Times New Roman";} tt {mso-style-noshow:yes; font-family:"Courier New"; mso-ascii-font-family:"Courier New"; mso-fareast-font-family:"Times New Roman"; mso-hansi-font-family:"Courier New"; mso-bidi-font-family:"Courier New";} p.ListParagraph, li.ListParagraph, div.ListParagraph {mso-style-name:"List Paragraph"; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:Calibri; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.ListParagraphCxSpFirst, li.ListParagraphCxSpFirst, div.ListParagraphCxSpFirst {mso-style-name:"List ParagraphCxSpFirst"; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:Calibri; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.ListParagraphCxSpMiddle, li.ListParagraphCxSpMiddle, div.ListParagraphCxSpMiddle {mso-style-name:"List ParagraphCxSpMiddle"; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:0in; margin-left:.5in; margin-bottom:.0001pt; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:Calibri; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} p.ListParagraphCxSpLast, li.ListParagraphCxSpLast, div.ListParagraphCxSpLast {mso-style-name:"List ParagraphCxSpLast"; mso-style-type:export-only; margin-top:0in; margin-right:0in; margin-bottom:10.0pt; margin-left:.5in; mso-add-space:auto; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:Calibri; mso-fareast-font-family:Calibri; mso-bidi-font-family:"Times New Roman";} span.italic {mso-style-name:italic;} span.pk {mso-style-name:pk;} span.Char {mso-style-name:" Char"; mso-style-noshow:yes; mso-style-link:"Balloon Text"; mso-ansi-font-size:8.0pt; mso-bidi-font-size:8.0pt; font-family:Tahoma; mso-ascii-font-family:Tahoma; mso-fareast-font-family:Calibri; mso-hansi-font-family:Tahoma; mso-bidi-font-family:Tahoma; mso-ansi-language:EN-US; mso-fareast-language:EN-US; mso-bidi-language:AR-SA;} span.klink {mso-style-name:klink;} span.kw {mso-style-name:kw;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:-132; mso-list-type:simple; mso-list-template-ids:718861580;} @list l0:level1 {mso-level-tab-stop:1.25in; mso-level-number-position:left; margin-left:1.25in; text-indent:-.25in;} @list l1 {mso-list-id:-131; mso-list-type:simple; mso-list-template-ids:462086524;} @list l1:level1 {mso-level-tab-stop:1.0in; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in;} @list l2 {mso-list-id:-130; mso-list-type:simple; mso-list-template-ids:162444386;} @list l2:level1 {mso-level-tab-stop:.75in; mso-level-number-position:left; margin-left:.75in; text-indent:-.25in;} @list l3 {mso-list-id:-129; mso-list-type:simple; mso-list-template-ids:1541181084;} @list l3:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l4 {mso-list-id:-128; mso-list-type:simple; mso-list-template-ids:-1994621262;} @list l4:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:1.25in; mso-level-number-position:left; margin-left:1.25in; text-indent:-.25in; font-family:Symbol;} @list l5 {mso-list-id:-127; mso-list-type:simple; mso-list-template-ids:-59320694;} @list l5:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:1.0in; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:Symbol;} @list l6 {mso-list-id:-126; mso-list-type:simple; mso-list-template-ids:-1462089782;} @list l6:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:.75in; mso-level-number-position:left; margin-left:.75in; text-indent:-.25in; font-family:Symbol;} @list l7 {mso-list-id:-125; mso-list-type:simple; mso-list-template-ids:1027914936;} @list l7:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in; font-family:Symbol;} @list l8 {mso-list-id:-120; mso-list-type:simple; mso-list-template-ids:1501322392;} @list l8:level1 {mso-level-tab-stop:.25in; mso-level-number-position:left; margin-left:.25in; text-indent:-.25in;} @list l9 {mso-list-id:-119; mso-list-type:simple; mso-list-template-ids:-1803907356;} @list l9:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:.25in; mso-level-number-position:left; margin-left:.25in; text-indent:-.25in; font-family:Symbol;} @list l10 {mso-list-id:120728403; mso-list-type:hybrid; mso-list-template-ids:1902799502 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l10:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l11 {mso-list-id:162205563; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l11:level1 {mso-level-start-at:2; mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l12 {mso-list-id:197818146; mso-list-type:hybrid; mso-list-template-ids:-1814390832 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l12:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l12:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l12:level3 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l13 {mso-list-id:214633515; mso-list-type:hybrid; mso-list-template-ids:-16380244 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l13:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l13:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l14 {mso-list-id:215237571; mso-list-type:simple; mso-list-template-ids:-1292485160;} @list l14:level1 {mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l15 {mso-list-id:226689597; mso-list-type:hybrid; mso-list-template-ids:391397472 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l15:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l15:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l16 {mso-list-id:257641153; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l16:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l17 {mso-list-id:275329619; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l17:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l18 {mso-list-id:283511270; mso-list-type:hybrid; mso-list-template-ids:-1852781780 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l18:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l18:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l19 {mso-list-id:338627553; mso-list-type:hybrid; mso-list-template-ids:1364488884 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l19:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l19:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l20 {mso-list-id:351961035; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l20:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l21 {mso-list-id:388040308; mso-list-type:hybrid; mso-list-template-ids:-1998707180 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l21:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l21:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l22 {mso-list-id:458963445; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l22:level1 {mso-level-start-at:2; mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l23 {mso-list-id:502621903; mso-list-type:hybrid; mso-list-template-ids:-773144704 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l23:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l23:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l24 {mso-list-id:527184361; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l24:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l25 {mso-list-id:547112380; mso-list-type:hybrid; mso-list-template-ids:-2054128720 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l25:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l25:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.5in; text-indent:-.25in; font-family:"Courier New";} @list l26 {mso-list-id:601956909; mso-list-type:hybrid; mso-list-template-ids:-1626436694 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l26:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l27 {mso-list-id:612172979; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l27:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l28 {mso-list-id:675772064; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l28:level1 {mso-level-start-at:2; mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l29 {mso-list-id:693699801; mso-list-type:hybrid; mso-list-template-ids:1907260308 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l29:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l30 {mso-list-id:714474502; mso-list-type:hybrid; mso-list-template-ids:560077464 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l30:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l30:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l31 {mso-list-id:777720204; mso-list-type:hybrid; mso-list-template-ids:288945544 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l31:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l31:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l32 {mso-list-id:781144929; mso-list-type:hybrid; mso-list-template-ids:3419794 67698689 67698689 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l32:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.5in; text-indent:-.25in; font-family:Symbol;} @list l32:level2 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:2.0in; text-indent:-.25in; font-family:Symbol;} @list l33 {mso-list-id:837505930; mso-list-type:hybrid; mso-list-template-ids:-934801692 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l33:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l33:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l34 {mso-list-id:890845880; mso-list-type:hybrid; mso-list-template-ids:-975133136 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l34:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l34:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l35 {mso-list-id:943925769; mso-list-type:hybrid; mso-list-template-ids:1918372802 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l35:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l35:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l36 {mso-list-id:1099369616; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l36:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l37 {mso-list-id:1100103000; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l37:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l38 {mso-list-id:1112748303; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l38:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l39 {mso-list-id:1127548236; mso-list-type:hybrid; mso-list-template-ids:30326230 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l39:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l39:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l40 {mso-list-id:1197623986; mso-list-type:simple; mso-list-template-ids:-1292485160;} @list l40:level1 {mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l41 {mso-list-id:1206137693; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l41:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l42 {mso-list-id:1321810628; mso-list-type:hybrid; mso-list-template-ids:-1807056140 67698711 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l42:level1 {mso-level-number-format:alpha-lower; mso-level-text:"%1\)"; mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @list l43 {mso-list-id:1347559219; mso-list-type:hybrid; mso-list-template-ids:383920488 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l43:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l43:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l44 {mso-list-id:1373268067; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l44:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l45 {mso-list-id:1380205676; mso-list-type:hybrid; mso-list-template-ids:780556570 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l45:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l45:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l45:level3 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l46 {mso-list-id:1395423223; mso-list-type:hybrid; mso-list-template-ids:-1194441540 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l46:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l46:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l47 {mso-list-id:1423064206; mso-list-type:hybrid; mso-list-template-ids:-843308932 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l47:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l48 {mso-list-id:1424762690; mso-list-type:hybrid; mso-list-template-ids:-721650238 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l48:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l48:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l49 {mso-list-id:1465923847; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l49:level1 {mso-level-start-at:2; mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l50 {mso-list-id:1515340205; mso-list-type:hybrid; mso-list-template-ids:240835260 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l50:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l50:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l51 {mso-list-id:1593975099; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l51:level1 {mso-level-start-at:2; mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l52 {mso-list-id:1669675441; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l52:level1 {mso-level-start-at:2; mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l53 {mso-list-id:1693415778; mso-list-type:hybrid; mso-list-template-ids:902045512 1494769650 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l53:level1 {mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.25in; text-indent:-.25in;} @list l54 {mso-list-id:1698236560; mso-list-type:hybrid; mso-list-template-ids:1586810332 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l54:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l54:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l55 {mso-list-id:1703901406; mso-list-type:hybrid; mso-list-template-ids:-1981223492 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l55:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l55:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l56 {mso-list-id:1732272313; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l56:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l57 {mso-list-id:1762871402; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l57:level1 {mso-level-start-at:2; mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l58 {mso-list-id:1771929184; mso-list-type:hybrid; mso-list-template-ids:-643412024 -1031394728 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l58:level1 {mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.25in; text-indent:-.25in;} @list l59 {mso-list-id:1789662225; mso-list-type:hybrid; mso-list-template-ids:665611326 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l59:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l60 {mso-list-id:1834224125; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l60:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l61 {mso-list-id:1854606111; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l61:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l62 {mso-list-id:1910799055; mso-list-type:hybrid; mso-list-template-ids:1025292108 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l62:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l63 {mso-list-id:1963919789; mso-list-type:hybrid; mso-list-template-ids:-608639784 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l63:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:.75in; text-indent:-.25in; font-family:"Courier New";} @list l64 {mso-list-id:1981879563; mso-list-type:hybrid; mso-list-template-ids:1205610974 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l64:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l64:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l65 {mso-list-id:1996180414; mso-list-type:hybrid; mso-list-template-ids:-2055592870 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l65:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l65:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l65:level3 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l66 {mso-list-id:1997763336; mso-list-type:hybrid; mso-list-template-ids:-95000244 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l66:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:2.0in; text-indent:-.25in; font-family:Symbol;} @list l67 {mso-list-id:2041661490; mso-list-type:hybrid; mso-list-template-ids:1727665760 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l67:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:Wingdings;} @list l67:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-.25in; font-family:"Courier New";} @list l68 {mso-list-id:2044402162; mso-list-type:hybrid; mso-list-template-ids:546588222 67698701 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l68:level1 {mso-level-number-format:bullet; mso-level-text:; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:43.45pt; text-indent:-.25in; font-family:Wingdings;} @list l68:level2 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:79.45pt; text-indent:-.25in; font-family:"Courier New";} @list l69 {mso-list-id:2046522114; mso-list-type:hybrid; mso-list-template-ids:-1837353878 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l69:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.0in; text-indent:-.25in; font-family:"Courier New";} @list l70 {mso-list-id:2087532415; mso-list-type:hybrid; mso-list-template-ids:1655736028 67698691 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;} @list l70:level1 {mso-level-number-format:bullet; mso-level-text:o; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:1.5in; text-indent:-.25in; font-family:"Courier New";} @list l71 {mso-list-id:2090999896; mso-list-type:simple; mso-list-template-ids:-1317777270;} @list l71:level1 {mso-level-text:%1; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l38:level1 lfo40 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l38:level1 lfo41 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l38:level1 lfo42 {mso-level-start-at:4; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l17:level1 lfo44 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l27:level1 lfo46 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l52:level1 lfo50 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l52:level1 lfo51 {mso-level-start-at:4; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l52:level1 lfo52 {mso-level-start-at:1; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l11:level1 lfo55 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l11:level1 lfo56 {mso-level-start-at:1; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l49:level1 lfo58 {mso-level-start-at:1; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l71:level1 lfo60 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l71:level1 lfo61 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l16:level1 lfo63 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l22:level1 lfo68 {mso-level-start-at:1; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l40:level1 lfo70 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l40:level1 lfo71 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l14:level1 lfo74 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l14:level1 lfo75 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l28:level1 lfo78 {mso-level-start-at:1; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l41:level1 lfo80 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo82 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo83 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo84 {mso-level-start-at:4; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo85 {mso-level-start-at:5; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo86 {mso-level-start-at:6; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo87 {mso-level-start-at:7; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo88 {mso-level-start-at:8; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo89 {mso-level-start-at:9; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo90 {mso-level-start-at:10; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo91 {mso-level-start-at:11; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo92 {mso-level-start-at:12; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo93 {mso-level-start-at:13; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo94 {mso-level-start-at:14; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo95 {mso-level-start-at:15; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo96 {mso-level-start-at:16; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo97 {mso-level-start-at:17; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo98 {mso-level-start-at:18; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo99 {mso-level-start-at:19; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo100 {mso-level-start-at:20; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo101 {mso-level-start-at:21; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:Calibri;} @list l44:level1 lfo102 {mso-level-start-at:2; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:"Courier New";} @list l44:level1 lfo103 {mso-level-start-at:3; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:"Courier New";} @list l44:level1 lfo104 {mso-level-start-at:4; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:"Courier New";} @list l44:level1 lfo105 {mso-level-start-at:5; mso-level-numbering:continue; mso-level-tab-stop:none; mso-level-number-position:left; mso-level-legacy:yes; mso-level-legacy-indent:.25in; mso-level-legacy-space:0in; margin-left:0in; text-indent:0in; font-family:"Courier New";} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} table.MsoTableGrid {mso-style-name:"Table Grid"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; border:solid black 1.0pt; mso-border-alt:solid black .5pt; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-border-insideh:.5pt solid black; mso-border-insidev:.5pt solid black; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:Calibri; mso-fareast-font-family:Calibri;} </style> <![endif]--> <p class="MsoNormal">Predict the output or error(s) for the following:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p><p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">1.<span style=""> </span>void main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><span style=""> </span>int<span style=""> </span>const * p=5;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p><p class="MsoNormal"><span style=""> </span>printf("%d",++(*p));<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Compiler error: Cannot modify a constant value. <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">p is a pointer to a "constant integer". But we tried to change the value of the<o:p></o:p></p> <p class="MsoNormal">"constant integer".<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">2.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>char s[ ]="man";<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int i;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>for(i=0;s[ i ];i++)<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>mmmm<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>aaaa<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>nnnn<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">s[i], *(i+s), *(s+i), i[s] are all different ways of expressing the same idea.<o:p></o:p></p> <p class="MsoNormal">Generally<span style=""> </span>array name is the base address for that array. Here s is the base<o:p></o:p></p> <p class="MsoNormal">address. i is the index number/displacement from the base address. So, indirecting<o:p></o:p></p> <p class="MsoNormal">it with * is same as s[i]. i[s] may be surprising. But in the<span style=""> </span>case of<span style=""> </span>C<span style=""> </span>it is<o:p></o:p></p> <p class="MsoNormal">same as s[i].<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">3.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>float me = 1.1;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>double you = 1.1;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>if(me==you)<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("I love U");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">else<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("I hate U");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer: <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">I hate U<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">For floating point numbers (float, double, long double) the values cannot be<o:p></o:p></p> <p class="MsoNormal">predicted exactly. Depending on the number of bytes, the precession with of the<o:p></o:p></p> <p class="MsoNormal">value<span style=""> </span>represented varies. Float takes 4 bytes and long double takes 10 bytes. So<o:p></o:p></p> <p class="MsoNormal">float stores 0.9 with less precision than long double.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Rule of Thumb: <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Never compare or at-least be cautious when using floating point numbers with<o:p></o:p></p> <p class="MsoNormal">relational operators (== , >, <, <=, >=,!= ) .<span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">4.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>static int var = 5;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("%d ",var--);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>if(var)<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>main();<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">5 4 3 2 1<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">When static storage class is given, it is initialized once. The change in the value<o:p></o:p></p> <p class="MsoNormal">of a static variable is retained even between the function calls. <st1:place>Main</st1:place> is also<o:p></o:p></p> <p class="MsoNormal">treated like any other ordinary function, which can be called recursively.<span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">5.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int c[ ]={2.8,3.4,4,6.7,5};<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int j,*p=c,*q=c;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><span style=""> </span>for(j=0;j<5;j++)></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf(" %d ",*c);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>++q;<span style=""> </span>}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>for(j=0;j<5;j++){<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf(" %d ",*p);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">++p;<span style=""> </span>}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>2 2 2 2 2 2 3 4 6 5<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Explanation: <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Initially pointer c is assigned to both p and q. In the first loop, since only q is<o:p></o:p></p> <p class="MsoNormal">incremented and not c , the value 2 will be printed 5 times. In second loop p itself<o:p></o:p></p> <p class="MsoNormal">is incremented. So the values 2 3 4 6 5 will be printed. <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">6.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>extern int i;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>i=20;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("%d",i);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Linker Error : Undefined symbol '_i'<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation: <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>extern storage class in the following declaration,<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>extern int i;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">specifies to the compiler that the memory for i is allocated in some other program<o:p></o:p></p> <p class="MsoNormal">and that address will be given to the current program at the time of linking. But<o:p></o:p></p> <p class="MsoNormal">linker finds that no other variable of name i is available in any other program with<o:p></o:p></p> <p class="MsoNormal">memory space allocated for it. Hence a linker error has occurred .<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">7.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int i=-1,j=-1,k=0,l=2,m;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>m=i++&&j++&&k++||l++;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("%d %d %d %d %d",i,j,k,l,m);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>0 0 1 3 1<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation :<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Logical operations always give a result of 1 or 0 . And also the logical AND (&&)<o:p></o:p></p> <p class="MsoNormal">operator has higher priority over the logical OR (||) operator. So the expression <o:p></o:p></p> <p class="MsoNormal">‘i++ && j++ && k++’ is executed first. The result of this expression is 0<span style=""> </span>(-1 &&<o:p></o:p></p> <p class="MsoNormal">-1 && 0 = 0). Now the expression is 0 || 2 which evaluates to 1 (because OR operator<o:p></o:p></p> <p class="MsoNormal">always gives 1 except for ‘0 || 0’ combination- for which it gives 0). So the value<o:p></o:p></p> <p class="MsoNormal">of m is 1. The values of other variables are also incremented by 1.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">8.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>char *p;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("%d %d ",sizeof(*p),sizeof(p));<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer: <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>1 2<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">The sizeof() operator gives the number of bytes taken by its operand. P is a<o:p></o:p></p> <p class="MsoNormal">character pointer, which needs one byte for storing its value (a character). Hence<o:p></o:p></p> <p class="MsoNormal">sizeof(*p) gives a value of 1. Since it needs two bytes to store the address of the<o:p></o:p></p> <p class="MsoNormal">character pointer sizeof(p) gives 2.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">9.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int i=3;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>switch(i)<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><span style=""> </span>{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>default:printf("zero");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>case 1: printf("one");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>break;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>case 2:printf("two");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>break;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>case 3: printf("three");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><span style=""> </span>break;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>}<span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer :<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">three<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation :<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">The default case can be placed anywhere inside the loop. It is executed only when<o:p></o:p></p> <p class="MsoNormal">all other cases doesn't match.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">10.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("%x",-1<<4);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer: <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">fff0<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation :<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">-1 is internally represented as all 1's. When left shifted four times the least<o:p></o:p></p> <p class="MsoNormal">significant 4 bits are filled with 0's.The %x format specifier specifies that the<o:p></o:p></p> <p class="MsoNormal">integer value be printed as a hexadecimal value.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">11.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>char string[]="Hello World";<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>display(string);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">void display(char *string)<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("%s",string);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Compiler Error : Type mismatch in redeclaration of function display <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Explanation :<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">In third line, when the function display is encountered, the compiler doesn't know<o:p></o:p></p> <p class="MsoNormal">anything about the function display. It assumes the arguments and return types to be<o:p></o:p></p> <p class="MsoNormal">integers, (which is the default type). When it sees the actual function display, the<o:p></o:p></p> <p class="MsoNormal">arguments and type contradicts with what it has assumed previously. Hence a compile<o:p></o:p></p> <p class="MsoNormal">time error occurs.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">12.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int c=- -2;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("c=%d",c);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>c=2;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Here unary minus (or negation) operator is used twice. Same maths<span style=""> </span>rules applies,<o:p></o:p></p> <p class="MsoNormal">ie. minus * minus= plus.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Note: <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">However you cannot give like --2. Because -- operator can<span style=""> </span>only be applied to<o:p></o:p></p> <p class="MsoNormal">variables as a decrement operator (eg., i--). 2 is a constant and not a variable.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">13.<span style=""> </span>#define int char<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int i=65;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>printf("sizeof(i)=%d",sizeof(i));<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>sizeof(i)=1<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Since the #define replaces the string<span style=""> </span>int by the macro char <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">14.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">int i=10;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">i=!i>14;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Printf ("i=%d",i);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">i=0<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">In the expression !i>14 , NOT (!) operator has more precedence than ‘ >’ symbol.<span style=""> </span>!<o:p></o:p></p> <p class="MsoNormal">is a unary logical operator. !i (!10) is 0 (not of true is false).<span style=""> </span>0>14 is false<o:p></o:p></p> <p class="MsoNormal">(zero). <o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">15.<span style=""> </span>#include<stdio.h><o:p></o:p></stdio.h></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">char s[]={'a','b','c','\n','c','\0'};<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">char *p,*str,*str1;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">p=&s[3];<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">str=p;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">str1=s;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("%d",++*p + ++*str1-32);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">77<span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">p is pointing to character '\n'. str1 is pointing to character 'a' ++*p. "p is<o:p></o:p></p> <p class="MsoNormal">pointing to '\n' and that is incremented by one." the ASCII value of '\n' is 10,<o:p></o:p></p> <p class="MsoNormal">which is then incremented to 11. The value of ++*p is 11. ++*str1, str1 is pointing<o:p></o:p></p> <p class="MsoNormal">to 'a' that is incremented by 1 and it becomes 'b'. ASCII value of 'b' is 98.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Now performing (11 + 98 – 32), we get 77("M");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>So we get the output 77 :: "M" (Ascii is 77).<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">16.<span style=""> </span>#include<stdio.h><o:p></o:p></stdio.h></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">int a[2][2][2] = { {10,2,3,4}, {5,6,7,8}<span style=""> </span>};<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">int *p,*q;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">p=&a[2][2][2];<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">*q=***a;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("%d----%d",*p,*q);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">SomeGarbageValue---1<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">p=&a[2][2][2]<span style=""> </span>you declare only two 2D arrays, but you are trying to access the<o:p></o:p></p> <p class="MsoNormal">third 2D(which you are not declared) it will print garbage values. *q=***a starting<o:p></o:p></p> <p class="MsoNormal">address of a is assigned integer pointer. Now q is pointing to starting address of<o:p></o:p></p> <p class="MsoNormal">a. If you print *q, it will print first element of 3D array.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">17.<span style=""> </span>#include<stdio.h><o:p></o:p></stdio.h></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">struct xx<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>int x=3;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>char name[]="hello";<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>};<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">struct xx *s;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("%d",s->x);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("%s",s->name);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Compiler Error<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">You should not initialize variables in declaration<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">18.<span style=""> </span>#include<stdio.h><o:p></o:p></stdio.h></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">struct xx<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">int x;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">struct yy<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">char s;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span>struct xx *p;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">};<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">struct yy *q;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">};<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Compiler Error<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">The structure yy is nested within structure xx. Hence, the elements are of yy are to<o:p></o:p></p> <p class="MsoNormal">be accessed through the instance of structure xx, which needs an instance of yy to<o:p></o:p></p> <p class="MsoNormal">be known. If the instance is created after defining the structure the compiler will<o:p></o:p></p> <p class="MsoNormal">not know about the instance relative to xx. Hence for nested structure yy you have<o:p></o:p></p> <p class="MsoNormal">to declare member.<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">19.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("\nab");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("\bsi");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("\rha");<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">hai<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">\n<span style=""> </span>- newline<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">\b<span style=""> </span>- backspace<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">\r<span style=""> </span>- linefeed<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">20.<span style=""> </span>main()<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">{<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">int i=5;<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">printf("%d%d%d%d%d%d",i++,i--,++i,--i,i);<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">}<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Answer:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">45545<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">Explanation:<o:p></o:p></p> <p class="MsoNormal"><o:p> </o:p></p> <p class="MsoNormal">The arguments in a function call are pushed into the stack from left to right. The<o:p></o:p></p> <p class="MsoNormal">evaluation is by popping out from the stack. and the<span style=""> </span>evaluation is from right to<o:p></o:p></p> <p class="MsoNormal">left, hence the result.<o:p></o:p></p> <p class="MsoNormal"><span style=""> </span><o:p></o:p></p> <div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-27572346649793834912009-04-26T15:26:00.002+05:302009-04-26T15:31:02.950+05:30Basic shell scripting questions<div>Question: How do you find out what’s your shell? - echo $SHELL</div><div><br /></div><div>Question: What’s the command to find out today’s date? - date</div><div><br /></div><div>Question: What’s the command to find out users on the system? - who</div><div><br /></div><div>Question: How do you find out the current directory you’re in? - pwd</div><div><br /></div><div>Question: How do you remove a file? - rm</div><div><br /></div><div>Question: How do you remove a - rm -rf</div><div><br /></div><div>Question: How do you find out your own username? - whoami</div><div><br /></div><div>Question: How do you send a mail message to somebody? - mail somebody@techinterviews.com -s ‘Your subject’ -c ‘cc@techinterviews.com‘</div><div><br /></div><div>Question: How do you count words, lines and characters in a file? - wc</div><div><br /></div><div>Question: How do you search for a string inside a given file? - grep string filename</div><div><br /></div><div>Question: How do you search for a string inside a directory? - grep string *</div><div><br /></div><div>Question: How do you search for a string in a directory with the subdirectories recursed? - grep -r string *</div><div><br /></div><div>Question: What are PIDs? - They are process IDs given to processes. A PID can vary from 0 to 65535.</div><div><br /></div><div>Question: How do you list currently running process? - ps</div><div><br /></div><div>Question: How do you stop a process? - kill pid</div><div><br /></div><div>Question: How do you find out about all running processes? - ps -ag</div><div><br /></div><div>Question: How do you stop all the processes, except the shell window? - kill 0</div><div><br /></div><div>Question: How do you fire a process in the background? - ./process-name &</div><div><br /></div><div>Question: How do you refer to the arguments passed to a shell script? - $1, $2 and so on. $0 is your script name.</div><div><br /></div><div>Question: What’s the conditional statement in shell scripting? - if {condition} then … fi</div><div><br /></div><div>Question: How do you do number comparison in shell scripts? - -eq, -ne, -lt, -le, -gt, -ge</div><div><br /></div><div>Question: How do you test for file properties in shell scripts? - -s filename tells you if the file is not empty, -f filename tells you whether the argument is a file, and not a directory, -d filename tests if the argument is a directory, and not a file, -w filename tests for writeability, -r filename tests for readability, -x filename tests for executability</div><div><br /></div><div>Question: How do you do Boolean logic operators in shell scripting? - ! tests for logical not, -a tests for logical and, and -o tests for logical or.<br /></div><div><br /></div><div>Question: How do you find out the number of arguments passed to the shell script? - $#</div><div><br /></div><div>Question: What’s a way to do multilevel if-else’s in shell scripting? - if {condition} then {statement} elif {condition} {statement} fi</div><div><br /></div><div>Question: How do you write a for loop in shell? - for {variable name} in {list} do {statement} done</div><div><br /></div><div>Question: How do you write a while loop in shell? - while {condition} do {statement} done</div><div><br /></div><div>Question: How does a case statement look in shell scripts? - case {variable} in {possible-value-1}) {statement};; {possible-value-2}) {statement};; esac</div><div><br /></div><div>Question: How do you read keyboard input in shell scripts? - read {variable-name}</div><div><br /></div><div>Question: How do you define a function in a shell script? - function-name() { #some code here return }</div><div><br /></div><div>Question: How does getopts command work? - The parameters to your script can be passed as -n 15 -x 20. Inside the script, you can iterate through the getopts array as while getopts n:x option, and the variable $option contains the value of the entered option.</div><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com1tag:blogger.com,1999:blog-9088987006789845123.post-12701434212146366032009-04-26T15:14:00.002+05:302009-04-26T15:25:33.882+05:30Linux command line Q and A QuestionsQuestion: You need to see the last fifteen lines of the files dog, cat and horse. What command should you use?<br />tail -15 dog cat horse<br />The tail utility displays the end of a file. The -15 tells tail to display the last fifteen lines of each specified file.<br /><br />Question: Who owns the data dictionary?<br />The SYS user owns the data dictionary. The SYS and SYSTEM users are created when the database is created.<br /><br />Question: You routinely compress old log files. You now need to examine a log from two months ago. In order to view its contents without first having to decompress it, use the _________ utility.<br />zcat<br /><br />The zcat utility allows you to examine the contents of a compressed file much the same way that cat displays a file.<br /><br />Question: You suspect that you have two commands with the same name as the command is not producing the expected results. What command can you use to determine the location of the command being run?<br />which<br />The which command searches your path until it finds a command that matches the command you are looking for and displays its full path.<br />You locate a command in the /bin directory but do not know what it does. What command can you use to determine its purpose.<br />whatis<br />The whatis command displays a summary line from the man page for the specified command.<br />You wish to create a link to the /data directory in bob’s home directory so you issue the command ln /data /home/bob/datalink but the command fails. What option should you use in this command line to be successful.<br />Use the -F option<br />In order to create a link to a directory you must use the -F option.<br /><br />Question: When you issue the command ls -l, the first character of the resulting display represents the file’s ___________.<br />type<br />The first character of the permission block designates the type of file that is being displayed.<br /><br />Question: What utility can you use to show a dynamic listing of running processes?<br />top<br />The top utility shows a listing of all running processes that is dynamically updated.<br /><br />Question: Where is standard output usually directed?<br />to the screen or display<br />By default, your shell directs standard output to your screen or display.<br /><br />Question: You wish to restore the file memo.ben which was backed up in the tarfile MyBackup.tar. What command should you type?<br />tar xf MyBackup.tar memo.ben<br />This command uses the x switch to extract a file. Here the file memo.ben will be restored from the tarfile MyBackup.tar.<br /><br />Question: You need to view the contents of the tarfile called MyBackup.tar. What command would you use?<br />tar tf MyBackup.tar<br />The t switch tells tar to display the contents and the f modifier specifies which file to examine.<br /><br />Question: You want to create a compressed backup of the users’ home directories. What utility should you use?<br />tar<br />You can use the z modifier with tar to compress your archive at the same time as creating it.<br /><br />Question: What daemon is responsible for tracking events on your system?<br />syslogd<br />The syslogd daemon is responsible for tracking system information and saving it to specified log files.<br /><br />Question: You have a file called phonenos that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long?<br />split<br />The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.<br /><br />Question: You would like to temporarily change your command line editor to be vi. What command should you type to change it?<br />set -o vi<br />The set command is used to assign environment variables. In this case, you are instructing your shell to assign vi as your command line editor. However, once you log off and log back in you will return to the previously defined command line editor.<br /><br />Question: What account is created when you install Linux?<br />root<br />Whenever you install Linux, only one user account is created. This is the superuser account also known as root.<br /><br />Question: What command should you use to check the number of files and disk space used and each user’s defined quotas?<br />repquota<br />The repquota command is used to get a report on the status of the quotas you have set including the amount of allocated space and amount of used space.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-3236697876442463772009-04-26T15:07:00.002+05:302009-04-26T15:13:45.344+05:30Solaris interview questionsQuestion: List the files in current directory sorted by size ? <br />Answer: - ls -l | grep ^- | sort -nr <br /><br />Question: List the hidden files in current directory ?<br />Answer: - ls -a1 | grep "^\."<br /><br />Question: Delete blank lines in a file ? <br />Answer: - cat sample.txt | grep -v ‘^$’ > new_sample.txt<br /><br />Question: Search for a sample string in particular files ?<br />Answer: - grep “Debug” *.confHere grep uses the string “Debug” to search in all files with extension“.conf” under current directory.<br /><br />Question: Display the last newly appending lines of a file during appendingdata to the same file by some processes ? - tail –f Debug.logHere tail shows the newly appended data into Debug.log by some processes/user.<br /><br />Question: Display the Disk Usage of file sizes under each directory in currentDirectory ? - du -k * | sort –nr (or) du –k . | sort -nr<br />Change to a directory, which is having very long name ? - cd CDMA_3X_GEN*Here original directory name is – “CDMA_3X_GENERATION_DATA”.<br /><br />Question: Display the all files recursively with path under current directory ? - find . -depth -print<br /><br />Question: Set the Display automatically for the current new user ? <br />Answer: - export DISPLAY=`eval ‘who am i | cut -d"(" -f2 | cut -d")" -f1′`Here in above command, see single quote, double quote, grave ascent is used. Observe carefully.<br /><br />Question: Display the processes, which are running under yourusername ? <br />Answer: - ps –aef | grep MaheshvjHere, Maheshvj is the username.<br /><br />Question: List some Hot Keys for bash shell ? <br />Answer: - Ctrl+l – Clears the Screen. Ctrl+r – <br /><br />Question: Does a search in previously given commands in shell. Ctrl+u - Clears the typing before the hotkey. Ctrl+a – Places cursor at the beginning of the command at shell. Ctrl+e – Places cursor at the end of the command at shell. Ctrl+d – Kills the shell. Ctrl+z – Places the currently running process into background.<br /><br />Question: Display the files in the directory by file size ? <br />Answer: - ls –ltr | sort –nr –k 5<br />How to save man pages to a file ? - man <command> | col –b > <output-file>Example : man top | col –b > top_help.txt<br /><br />Question: How to know the date & time for – when script is executed ? <br />Answer: - Add the following script line in shell script.eval echo "Script is executed at `date`" >> timeinfo.infHere, “timeinfo.inf” contains date & time details ie., when script is executed and history related to execution.<br /><br />Question: How do you find out drive statistics ? <br />Answer: - iostat -E<br /><br />Question: Display disk usage in Kilobytes ? <br />Answer: - du -k<br /><br />Question: Display top ten largest files/directories ? <br />Answer: - du -sk * | sort -nr | head<br /><br />Question: How much space is used for users in kilobytes ? <br />Answer: - quot -af<br /><br />Question: How to create null file ? - cat /dev/null > filename1<br />Access common commands quicker ? - ps -ef | grep -i $@<br /><br />Question: Display the page size of memory ? <br />Answer: - pagesize -a<br /><br />Question: Display Ethernet Address arp table ? <br />Answer: - arp -a<br /><br />Question: Display the no.of active established connections to localhost ? - netstat -a | grep EST<br />Question: Display the state of interfaces used for TCP/IP traffice ? <br />Answer: - netstat -i<br /><br />Question: Display the parent/child tree of a process ? <br />Answer: - ptree <pid> Example: ptree 1267<br /><br />Question: Show the working directory of a process ? <br />Answer: - pwdx <pid> Example: pwdx 1267<br /><br />Question: Display the processes current open files ? <br />Answer: - pfiles <pid> Example: pfiles 1267<br /><br />Question: Display the inter-process communication facility status ? <br />Answer: - ipcs<br /><br />Question: Display the top most process utilizing most CPU ? <br />Answer: - top –b 1<br /><br />Question:Alternative for top command ? <br />Answer: - prstat –a<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shivlee Aggarwalhttp://www.blogger.com/profile/15557591804437237343noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-46765678126536614442009-04-03T16:07:00.002+05:302016-02-19T06:03:18.365+05:30ASP.NET Serialization 1. What is serialization?<br /><br />Ans. Serialization is the process of converting an object into a stream of bytes. Deserialization is the opposite process of creating an object from a stream of bytes. Serialization/Deserialization is mostly used to transport objects (e.g. during remoting), or to persist objects (e.g. to a file or database).<br /><br />2. Does the .NET Framework have in-built support for serialization?<br /><br />Ans. There are two separate mechanisms provided by the .NET class library - XmlSerializer and SoapFormatter/BinaryFormatter. Microsoft uses XmlSerializer for Web Services, and uses SoapFormatter/BinaryFormatter for remoting. Both are available for use in your own code.<br /><br />3. I want to serialize instances of my class. Should I use XmlSerializer, SoapFormatter or BinaryFormatter?<br /><br />Ans. It depends. XmlSerializer has severe limitations such as the requirement that the target class has a parameterless constructor, and only public read/write properties and fields can be serialized. However, on the plus side, XmlSerializer has good support for customising the XML document that is produced or consumed. XmlSerializer's features mean that it is most suitable for cross-platform work, or for constructing objects from existing XML documents.<br />SoapFormatter and BinaryFormatter have fewer limitations than XmlSerializer. They can serialize private fields, for example. However they both require that the target class be marked with the [Serializable] attribute, so like XmlSerializer the class needs to be written with serialization in mind. Also there are some quirks to watch out for - for example on deserialization the constructor of the new object is not invoked.<br />The choice between SoapFormatter and BinaryFormatter depends on the application. BinaryFormatter makes sense where both serialization and deserialization will be performed on the .NET platform and where performance is important. SoapFormatter generally makes more sense in all other cases, for ease of debugging if nothing else.<br /><br />4 Can I customise the serialization process?<br /><br />Ans. Yes. XmlSerializer supports a range of attributes that can be used to configure serialization for a particular class. For example, a field or property can be marked with the [XmlIgnore] attribute to exclude it from serialization. Another example is the [XmlElement] attribute, which can be used to specify the XML element name to be used for a particular property or field.<br />Serialization via SoapFormatter/BinaryFormatter can also be controlled to some extent by attributes. For example, the [NonSerialized] attribute is the equivalent of XmlSerializer's [XmlIgnore] attribute. Ultimate control of the serialization process can be acheived by implementing the the ISerializable interface on the class whose instances are to be serialized.<br /><br />5. Why is XmlSerializer so slow?<br /><br />Ans. 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.<br /><br />6. Why do I get errors when I try to serialize a Hashtable?<br /><br />Ans. XmlSerializer will refuse to serialize instances of any class that implements IDictionary, e.g. Hashtable. SoapFormatter and BinaryFormatter do not have this restriction.<br /><br />7. XmlSerializer is throwing a generic "There was an error reflecting MyClass" error. How do I find out what the problem is?<br /><br />Ans. Look at the InnerException property of the exception that is thrown to get a more specific error message.<br /><br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-58007712788444347432009-04-03T16:03:00.002+05:302009-04-03T16:07:08.770+05:30ASP.NET Garbage Collection1 What is garbage collection?<br /><br />Ans. Garbage collection is a system whereby a run-time component takes responsibility for managing the lifetime of objects and the heap memory that they occupy. This concept is not new to .NET - Java and many other languages/runtimes have used garbage collection for some time.<br /><br />2. Is it true that objects don't always get destroyed immediately when the last reference goes away?<br /><br />Ans. Yes. The garbage collector offers no guarantees about the time when an object will be destroyed and its memory reclaimed.<br />There is an interesting thread in the archives, started by Chris Sells, about the implications of non-deterministic destruction of objects in C#: http://discuss.develop.com/archives/wa.exe?A2=ind0007&L=DOTNET&P=R24819<br />In October 2000, Microsoft's Brian Harry posted a lengthy analysis of the problem: http://discuss.develop.com/archives/wa.exe?A2=ind0010A&L=DOTNET&P=R28572<br />Chris Sells' response to Brian's posting is here: http://discuss.develop.com/archives/wa.exe?A2=ind0010C&L=DOTNET&P=R983<br /><br />3. Why doesn't the .NET runtime offer deterministic destruction?<br /><br />Ans. Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next sweep of the heap.<br />Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep.<br /><br />4. Is the lack of deterministic destruction in .NET a problem?<br /><br />Ans. It's certainly an issue that affects component design. If you have objects that maintain expensive or scarce resources (e.g. database locks), you need to provide some way for the client to tell the object to release the resource when it is done. Microsoft recommend that you provide a method called Dispose() for this purpose. However, this causes problems for distributed objects - in a distributed system who calls the Dispose() method? Some form of reference-counting or ownership-management mechanism is needed to handle distributed objects - unfortunately the runtime offers no help with this.<br /><br />5. Does non-deterministic destruction affect the usage of COM objects from managed code?<br /><br />Ans. Yes. When using a COM object from managed code, you are effectively relying on the garbage collector to call the final release on your object. If your COM object holds onto an expensive resource which is only cleaned-up after the final release, you may need to provide a new interface on your object which supports an explicit Dispose() method.<br /><br />6. I've heard that Finalize methods should be avoided. Should I implement Finalize on my class?<br /><br />Ans. An object with a Finalize method is more work for the garbage collector than an object without one. Also there are no guarantees about the order in which objects are Finalized, so there are issues surrounding access to other objects from the Finalize method. Finally, there is no guarantee that a Finalize method will get called on an object, so it should never be relied upon to do clean-up of an object's resources.<br />Microsoft recommend the following pattern:<br />public class CTest : IDisposable<br />{<br /> public void Dispose()<br /> {<br /> ... // Cleanup activities<br /> GC.SuppressFinalize(this);<br /> }<br /><br /> ~CTest() // C# syntax hiding the Finalize() method<br /> {<br /> Dispose();<br /> }<br />}<br />In the normal case the client calls Dispose(), the object's resources are freed, and the garbage collector is relieved of its Finalizing duties by the call to SuppressFinalize(). In the worst case, i.e. the client forgets to call Dispose(), there is a reasonable chance that the object's resources will eventually get freed by the garbage collector calling Finalize(). Given the limitations of the garbage collection algorithm this seems like a pretty reasonable approach.<br /><br />7. Do I have any control over the garbage collection algorithm?<br /><br />Ans. A little. For example, the System.GC class exposes a Collect method - this forces the garbage collector to collect all unreferenced objects immediately.<br />5.8 How can I find out what the garbage collector is doing?<br />Lots of interesting statistics are exported from the .NET runtime via the '.NET CLR xxx' performance counters. Use Performance Monitor to view them.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-77624542141781407492009-04-03T15:47:00.002+05:302009-04-03T16:02:23.310+05:30.NET Assemblies1. What is an assembly?<br /><br />Ans. An assembly is sometimes described as a logical .EXE or .DLL, and can be an application (with a main entry point) or a library. An assembly consists of one or more files (dlls, exes, html files etc), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing.<br />An important aspect of assemblies is that they are part of the identity of a type. The identity of a type is the assembly that houses it combined with the type name. This means, for example, that if assembly A exports a type called T, and assembly B exports a type called T, the .NET runtime sees these as two completely different types. Furthermore, don't get confused between assemblies and namespaces - namespaces are merely a hierarchical way of organising type names. To the runtime, type names are type names, regardless of whether namespaces are used to organise the names. It's the assembly plus the typename (regardless of whether the type name belongs to a namespace) that uniquely indentifies a type to the runtime.<br />Assemblies are also important in .NET with respect to security - many of the security restrictions are enforced at the assembly boundary.<br />Finally, assemblies are the unit of versioning in .NET - more on this below.<br /><br />2. How can I produce an assembly?<br /><br />Ans. The simplest way to produce an assembly is directly from a .NET compiler. For example, the following C# program:<br />public class CTest<br />{<br /> public CTest()<br /> {<br /> System.Console.WriteLine( "Hello from CTest" );<br /> }<br />}<br />can be compiled into a library assembly (dll) like this:<br />csc /t:library ctest.cs<br />You can then view the contents of the assembly by running the "IL Disassembler" tool that comes with the .NET SDK.<br />Alternatively you can compile your source into modules, and then combine the modules into an assembly using the assembly linker (al.exe). For the C# compiler, the /target:module switch is used to generate a module instead of an assembly.<br /><br />3. What is the difference between a private assembly and a shared assembly?<br /><br />Ans. Location and visibility: A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. the .NET framework classes.<br /><br />· Versioning: The runtime enforces versioning constraints only on shared assemblies, not on private assemblies.<br /><br />4. How do assemblies find each other?<br /><br />Ans. By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache.<br /><br />5. How does assembly versioning work?<br /><br />Ans. Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly.<br />The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline - it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file.<br />Remember: versioning is only applied to shared assemblies, not private assemblies.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-84532990546695050792009-04-03T15:47:00.000+05:302016-02-19T06:03:18.495+05:30.NET Assemblies1. What is an assembly?<br /><br />Ans. An assembly is sometimes described as a logical .EXE or .DLL, and can be an application (with a main entry point) or a library. An assembly consists of one or more files (dlls, exes, html files etc), and represents a group of resources, type definitions, and implementations of those types. An assembly may also contain references to other assemblies. These resources, types and references are described in a block of data called a manifest. The manifest is part of the assembly, thus making the assembly self-describing.<br />An important aspect of assemblies is that they are part of the identity of a type. The identity of a type is the assembly that houses it combined with the type name. This means, for example, that if assembly A exports a type called T, and assembly B exports a type called T, the .NET runtime sees these as two completely different types. Furthermore, don't get confused between assemblies and namespaces - namespaces are merely a hierarchical way of organising type names. To the runtime, type names are type names, regardless of whether namespaces are used to organise the names. It's the assembly plus the typename (regardless of whether the type name belongs to a namespace) that uniquely indentifies a type to the runtime.<br />Assemblies are also important in .NET with respect to security - many of the security restrictions are enforced at the assembly boundary.<br />Finally, assemblies are the unit of versioning in .NET - more on this below.<br /><br />2. How can I produce an assembly?<br /><br />Ans. The simplest way to produce an assembly is directly from a .NET compiler. For example, the following C# program:<br />public class CTest<br />{<br /> public CTest()<br /> {<br /> System.Console.WriteLine( "Hello from CTest" );<br /> }<br />}<br />can be compiled into a library assembly (dll) like this:<br />csc /t:library ctest.cs<br />You can then view the contents of the assembly by running the "IL Disassembler" tool that comes with the .NET SDK.<br />Alternatively you can compile your source into modules, and then combine the modules into an assembly using the assembly linker (al.exe). For the C# compiler, the /target:module switch is used to generate a module instead of an assembly.<br /><br />3. What is the difference between a private assembly and a shared assembly?<br /><br />Ans. · Location and visibility: A private assembly is normally used by a single application, and is stored in the application's directory, or a sub-directory beneath. A shared assembly is normally stored in the global assembly cache, which is a repository of assemblies maintained by the .NET runtime. Shared assemblies are usually libraries of code which many applications will find useful, e.g. the .NET framework classes.<br /><br />· Versioning: The runtime enforces versioning constraints only on shared assemblies, not on private assemblies.<br />3.4 How do assemblies find each other?<br />By searching directory paths. There are several factors which can affect the path (such as the AppDomain host, and application configuration files), but for private assemblies the search path is normally the application's directory and its sub-directories. For shared assemblies, the search path is normally same as the private assembly path plus the shared assembly cache.<br />3.5 How does assembly versioning work?<br />Each assembly has a version number called the compatibility version. Also each reference to an assembly (from another assembly) includes both the name and version of the referenced assembly.<br />The version number has four numeric parts (e.g. 5.5.2.33). Assemblies with either of the first two parts different are normally viewed as incompatible. If the first two parts are the same, but the third is different, the assemblies are deemed as 'maybe compatible'. If only the fourth part is different, the assemblies are deemed compatible. However, this is just the default guideline - it is the version policy that decides to what extent these rules are enforced. The version policy can be specified via the application configuration file.<br />Remember: versioning is only applied to shared assemblies, not private assemblies.<br /><br /><div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-92076604568196956172009-04-03T15:40:00.005+05:302009-04-03T15:46:36.889+05:30.NET Basic terminology1 What is the CLR?<br /><br />Ans. CLR = Common Language Runtime. The CLR is a set of standard resources that (in theory) any .NET program can take advantage of, regardless of programming language. Robert Schmidt (Microsoft) lists the following CLR resources in his MSDN PDC# article:<br />· Object-oriented programming model (inheritance, polymorphism, exception handling, garbage collection)<br />· Security model<br />· Type system<br />· All .NET base classes<br />· Many .NET framework classes<br />· Development, debugging, and profiling tools<br />· Execution and code management<br />· IL-to-native translators and optimizers<br />What this means is that in the .NET world, different programming languages will be more equal in capability than they have ever been before, although clearly not all languages will support all CLR services.<br /><br />2. What is the CTS?<br /><br />Ans. CTS = Common Type System. This is the range of types that the .NET runtime understands, and therefore that .NET applications can use. However note that not all .NET languages will support all the types in the CTS. The CTS is a superset of the CLS.<br /><br />3. What is the CLS?<br /><br />Ans. CLS = Common Language Specification. This is a subset of the CTS which all .NET languages are expected to support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET program written in any language.<br />In theory this allows very tight interop between different .NET languages - for example allowing a C# class to inherit from a VB class.<br /><br />4. What is IL?<br /><br />Ans. IL = Intermediate Language. Also known as MSIL (Microsoft Intermediate Language) or CIL (Common Intermediate Language). All .NET source code (of any language) is compiled to IL. The IL is then converted to machine code at the point where the software is installed, or at run-time by a Just-In-Time (JIT) compiler.<br /><br />5. What is C#?<br /><br />Ans. C# is a new language designed by Microsoft to work with the .NET framework. In their "Introduction to C#" whitepaper, Microsoft describe C# as follows:<br />"C# is a simple, modern, object oriented, and type-safe programming language derived from C and C++. C# (pronounced “C sharp”) is firmly planted in the C and C++ family tree of languages, and will immediately be familiar to C and C++ programmers. C# aims to combine the high productivity of Visual Basic and the raw power of C++."<br />Substitute 'Java' for 'C#' in the quote above, and you'll see that the statement still works pretty well :-).<br /><br />6. What does 'managed' mean in the .NET context?<br /><br />Ans. The term 'managed' is the cause of much confusion. It is used in various places within .NET, meaning slightly different things.<br />Managed code: The .NET framework provides several core run-time services to the programs that run within it - for example exception handling and security. For these services to work, the code must provide a minimum level of information to the runtime. Such code is called managed code. All C# and Visual Basic.NET code is managed by default. VS7 C++ code is not managed by default, but the compiler can produce managed code by specifying a command-line switch (/com+).<br />Managed data: This is data that is allocated and de-allocated by the .NET runtime's garbage collector. C# and VB.NET data is always managed. VS7 C++ data is unmanaged by default, even when using the /com+ switch, but it can be marked as managed using the __gc keyword.<br />Managed classes: This is usually referred to in the context of Managed Extensions (ME) for C++. When using ME C++, a class can be marked with the __gc keyword. As the name suggests, this means that the memory for instances of the class is managed by the garbage collector, but it also means more than that. The class becomes a fully paid-up member of the .NET community with the benefits and restrictions that brings. An example of a benefit is proper interop with classes written in other languages - for example, a managed C++ class can inherit from a VB class. An example of a restriction is that a managed class can only inherit from one base class.<br /><br />7. What is reflection?<br /><br />Ans. All .NET compilers produce metadata about the types defined in the modules they produce. This metadata is packaged along with the module (modules in turn are packaged together in assemblies), and can be accessed by a mechanism called reflection. The System.Reflection namespace contains classes that can be used to interrogate the types for a module/assembly.<br />Using reflection to access .NET metadata is very similar to using ITypeLib/ITypeInfo to access type library data in COM, and it is used for similar purposes - e.g. determining data type sizes for marshaling data across context/process/machine boundaries.<br />Reflection can also be used to dynamically invoke methods (see System.Type.InvokeMember), or even create types dynamically at run-time (see System.Reflection.Emit.TypeBuilder).<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-34791071168763472052009-04-03T15:35:00.003+05:302009-04-03T15:40:40.125+05:30What is .NET1. What is .NET?<br /><br />Ans. That's difficult to sum up in a sentence. According to Microsoft, .NET is a "revolutionary new platform, built on open Internet protocols and standards, with tools and services that meld computing and communications in new ways".<br />A more practical definition would be that .NET is a new environment for developing and running software applications, featuring ease of development of web-based services, rich standard run-time services available to components written in a variety of programming languages, and inter-language and inter-machine interoperability.<br />Note that when the term ".NET" is used in this FAQ it refers only to the new .NET runtime and associated technologies. This is sometimes called the ".NET Framework". This FAQ does NOT cover any of the various other existing and new products/technologies that Microsoft are attaching the .NET name to (e.g. SQL Server.NET).<br /><br />2. Does .NET only apply to people building web-sites?<br /><br />Ans. No. If you write any Windows software (using ATL/COM, MFC, VB, or even raw Win32), .NET may offer a viable alternative (or addition) to the way you do things currently. Of course, if you do develop web sites, then .NET has lots to interest you - not least ASP.NET.<br /><br />3. When was .NET announced?<br />Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and delegates were given CDs containing a pre-release version of the .NET framework/SDK and Visual Studio.NET.<br /><br />4. When was the first version of .NET released?<br /><br />Ans. The final version of the 1.0 SDK and runtime was made publicly available around 6pm PST on 15-Jan-2002. At the same time, the final version of Visual Studio.NET was made available to MSDN subscribers.<br /><br />5. What tools can I use to develop .NET applications?<br /><br />Ans. There are a number of tools, described here in ascending order of cost:<br />· .NET Framework SDK: The SDK is free and includes command-line compilers for C++, C#, and VB.NET and various other utilities to aid development.<br />· ASP.NET Web Matrix: This is a free ASP.NET development environment from Microsoft. As well as a GUI development environment, the download includes a 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.<br />· Microsoft Visual C# .NET Standard 2003: This is a cheap (around $100) version of Visual Studio limited to one language and also with limited wizard support. For example, there's no wizard support for class libraries or custom UI controls. Useful for beginners to learn with, or for savvy developers who can work around the deficiencies in the supplied wizards. As well as C#, there are VB.NET and C++ versions.<br />· Microsoft Visual Studio.NET Professional 2003: If you have a license for Visual Studio 6.0, you can get the upgrade. You can also upgrade from VS.NET 2002 for a token $30. Visual Studio.NET includes support for all the MS languages (C#, C++, VB.NET) and has extensive wizard support.<br />At the top end of the price spectrum are the Visual Studio.NET 2003 Enterprise and Enterprise Architect editions. These offer extra features such as Visual Sourcesafe (version control), and performance and analysis tools. Check out the Visual Studio.NET Feature Comparison at http://msdn.microsoft.com/vstudio/howtobuy/choosing.asp.<br /><br />6. What platforms does the .NET Framework run on?<br /><br />Ans. The runtime supports Windows XP, Windows 2000, NT4 SP6a and Windows ME/98. Windows 95 is not supported. Some parts of the framework do not work on all platforms - for example, ASP.NET is only supported on Windows XP and Windows 2000. Windows 98/ME cannot be used for development.<br />IIS is not supported on Windows XP Home Edition, and so cannot be used to host ASP.NET. However, the ASP.NET Web Matrix web server does run on XP Home.<br />The Mono project is attempting to implement the .NET framework on Linux.<br /><br />7. What languages does the .NET Framework support?<br /><br />Ans. MS provides compilers for C#, C++, VB and JScript. Other vendors have announced that they intend to develop .NET compilers for languages such as COBOL, Eiffel, Perl, Smalltalk and Python.<br /><br />8. Will the .NET Framework go through a standardisation process?<br /><br />Ans. From http://msdn.microsoft.com/net/ecma/: "On December 13, 2001, the ECMA General Assembly ratified the C# and common language infrastructure (CLI) specifications into international standards. The ECMA standards will be known as ECMA-334 (C#) and ECMA-335 (the CLI)."<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-54553197646478209652009-04-03T15:33:00.002+05:302009-04-03T15:35:06.881+05:30XML interview Questions Part II1. How to configure the sites in Web server (IIS)?<br /><br />2. Advantages in IIS 6.0?<br /><br />http://www.microsoft.com/windowsserver2003/iis/evaluation/features/default.mspx<br />http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/windowsserver2003/proddocs/datacenter/gs_whatschanged.asp<br /><br />3. IIS Isolation Levels?<br /><br />Ans. Internet Information Server introduced the notion "Isolation Level", which is also present in IIS4 under a different name. IIS5 supports three isolation levels, that you can set from the Home Directory tab of the site's Properties dialog:<br />· Low (IIS Process): ASP pages run in INetInfo.Exe, the main IIS process, therefore they are executed in-process. This is the fastest setting, and is the default under IIS4. The problem is that if ASP crashes, IIS crashes as well and must be restarted (IIS5 has a reliable restart feature that automatically restarts a server when a fatal error occurs).<br />· Medium (Pooled): In this case ASP runs in a different process, which makes this setting more reliable: if ASP crashes IIS won't. All the ASP applications at the Medium isolation level share the same process, so you can have a web site running with just two processes (IIS and ASP process). IIS5 is the first Internet Information Server version that supports this setting, which is also the default setting when you create an IIS5 application. Note that an ASP application that runs at this level is run under COM+, so it's hosted in DLLHOST.EXE (and you can see this executable in the Task Manager).<br />· High (Isolated): Each ASP application runs out-process in its own process space, therefore if an ASP application crashes, neither IIS nor any other ASP application will be affected. The downside is that you consume more memory and resources if the server hosts many ASP applications. Both IIS4 and IIS5 supports this setting: under IIS4 this process runs inside MTS.EXE, while under IIS5 it runs inside DLLHOST.EXE.<br />When selecting an isolation level for your ASP application, keep in mind that out-process settings - that is, Medium and High - are less efficient than in-process (Low). However, out-process communication has been vastly improved under IIS5, and in fact IIS5's Medium isolation level often deliver better results than IIS4's Low isolation. In practice, you shouldn't set the Low isolation level for an IIS5 application unless you really need to serve hundreds pages per second.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-74164334800295944902009-04-03T15:26:00.004+05:302009-04-03T15:32:59.795+05:30XML Interview Questions Part I1. Explain what a DiffGram is, and a good use for one?<br /><br />Ans. A DiffGram is an XML format that is used to identify current and original versions of data elements. When sending and retrieving a DataSet from an XML Web service, the DiffGram format is implicitly used.<br />The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.<br />DiffGram Format<br />The DiffGram format is divided into three sections: the current data, the original (or "before") data, and an errors section, as shown in the following example.<br /><?xml version="1.0"?><br /><diffgr:diffgram<br />xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"<br />xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"<br />xmlns:xsd="http://www.w3.org/2001/XMLSchema"><br /><br /><datainstance><br /></datainstance><br /><br /><diffgr:before><br /></diffgr:before><br /><br /><diffgr:errors><br /></diffgr:errors><br /></diffgr:diffgram><br />The DiffGram format consists of the following blocks of data:<br /><datainstance><br />The name of this element, DataInstance, is used for explanation purposes in this documentation. A DataInstance element represents a DataSet or a row of a DataTable. Instead of DataInstance, the element would contain the name of the DataSet or DataTable. This block of the DiffGram format contains the current data, whether it has been modified or not. An element, or row, that has been modified is identified with the diffgr:hasChanges annotation.<br /><diffgr:before><br />This block of the DiffGram format contains the original version of a row. Elements in this block are matched to elements in the DataInstance block using the diffgr:id annotation.<br /><diffgr:errors><br />This block of the DiffGram format contains error information for a particular row in the DataInstance block. Elements in this block are matched to elements in the DataInstance block using the diffgr:id annotation.<br /><br />2. If I replace my Sqlserver with XML files and how about handling the same?<br /><br />3. Write syntax to serialize class using XML Serializer?<br /><br />(IIS)<br /><br />4. In which process does IIS runs (was asking about the EXE file)<br /><br />inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests among other things. When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request to the actual worker process<br />aspnet_wp.exe.<br /><br />5. Where are the IIS log files stored?<br /><br />Ans. C:\WINDOWS\system32\Logfiles\W3SVC1<br /> OR<br />c:\winnt\system32\LogFiles\W3SVC1<br /><br />6. What are the different IIS authentication modes in IIS 5.0 and Explain? Difference between basic and digest authentication modes?<br /><br />Ans. IIS provides a variety of authentication schemes:<br />· Anonymous (enabled by default)<br />· Basic<br />· Digest<br />· Integrated Windows authentication (enabled by default)<br />· Client Certificate Mapping<br />Anonymous<br />Anonymous authentication gives users access to the public areas of your Web site without prompting them for a user name or password. Although listed as an authentication scheme, it is not technically performing any client authentication because the client is not required to supply any credentials. Instead, IIS provides stored credentials to Windows using a special user account, IUSR_machinename. By default, IIS controls the password for this account. Whether or not IIS controls the password affects the permissions the anonymous user has. When IIS controls the password, a sub authentication DLL (iissuba.dll) authenticates the user using a network logon. The function of this DLL is to validate the password supplied by IIS and to inform Windows that the password is valid, thereby authenticating the client. However, it does not actually provide a password to Windows. When IIS does not control the password, IIS calls the LogonUser() API in Windows and provides the account name, password and domain name to log on the user using a local logon. After the logon, IIS caches the security token and impersonates the account. A local logon makes it possible for the anonymous user to access network resources, whereas a network logon does not.<br />Basic Authentication<br />IIS Basic authentication as an implementation of the basic authentication scheme found in section 11 of the HTTP 1.0 specification.<br />As the specification makes clear, this method is, in and of itself, non-secure. The reason is that Basic authentication assumes a trusted connection between client and server. Thus, the username and password are transmitted in clear text. More specifically, they are transmitted using Base64 encoding, which is trivially easy to decode. This makes Basic authentication the wrong choice to use over a public network on its own.<br />Basic Authentication is a long-standing standard supported by nearly all browsers. It also imposes no special requirements on the server side -- users can authenticate against any NT domain, or even against accounts on the local machine. With SSL to shelter the security credentials while they are in transmission, you have an authentication solution that is both highly secure and quite flexible.<br />Digest Authentication<br />The Digest authentication option was added in Windows 2000 and IIS 5.0. Like Basic authentication, this is an implementation of a technique suggested by Web standards, namely RFC 2069 (superceded by RFC 2617).<br />Digest authentication also uses a challenge/response model, but it is much more secure than Basic authentication (when used without SSL). It achieves this greater security not by encrypting the secret (the password) before sending it, but rather by following a different design pattern -- one that does not require the client to transmit the password over the wire at all.<br />Instead of sending the password itself, the client transmits a one-way message digest (a checksum) of the user's password, using (by default) the MD5 algorithm. The server then fetches the password for that user from a Windows 2000 Domain Controller, reruns the checksum algorithm on it, and compares the two digests. If they match, the server knows that the client knows the correct password, even though the password itself was never sent. (If you have ever wondered what the default ISAPI filter "md5filt" that is installed with IIS 5.0 is used for, now you know.<br />Integrated Windows Authentication<br />Integrated Windows authentication (formerly known as NTLM authentication and Windows NT Challenge/Response authentication) can use either NTLM or Kerberos V5 authentication and only works with Internet Explorer 2.0 and later.<br />When Internet Explorer attempts to access a protected resource, IIS sends two WWW-Authenticate headers, Negotiate and NTLM.<br />· If Internet Explorer recognizes the Negotiate header, it will choose it because it is listed first. When using Negotiate, the browser will return information for both NTLM and Kerberos. At the server, IIS will use Kerberos if both the client (Internet Explorer 5.0 and later) and server (IIS 5.0 and later) are running Windows 2000 and later, and both are members of the same domain or trusted domains. Otherwise, the server will default to using NTLM.<br />· If Internet Explorer does not understand Negotiate, it will use NTLM.<br />So, which mechanism is used depends upon a negotiation between Internet Explorer and IIS.<br />When used in conjunction with Kerberos v5 authentication, IIS can delegate security credentials among computers running Windows 2000 and later that are trusted and configured for delegation. Delegation enables remote access of resources on behalf of the delegated user.<br />Integrated Windows authentication is the best authentication scheme in an intranet environment where users have Windows domain accounts, especially when using Kerberos. Integrated Windows authentication, like digest authentication, does not pass the user's password across the network. Instead, a hashed value is exchanged.<br />Client Certificate Mapping<br />A certificate is a digitally signed statement that contains information about an entity and the entity's public key, thus binding these two pieces of information together. A trusted organization (or entity) called a Certification Authority (CA) issues a certificate after the CA verifies that the entity is who it says it is. Certificates can contain different types of data. For example, an X.509 certificate includes the format of the certificate, the serial number of the certificate, the algorithm used to sign the certificate, the name of the CA that issued the certificate, the name and public key of the entity requesting the certificate, and the CA's signature. X.509 client certificates simplify authentication for larger user bases because they do not rely on a centralized account database. You can verify a certificate simply by examining the certificate.<br />http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsent7/html/vxconIISAuthentication.asp<br /><br />7. Explain the concept of data island?<br />8. How to use XML DOM model on client side using JavaScript.<br />9. What are the ways to create a tree view control using XML, XSL & JavaScript?<br />10. Questions on XPathNavigator, and the other classes in System.XML Namespace?<br />11. What is Use of Template in XSL?<br />12. What is “Well Formed XML” and “Valid XML”<br />13. How you will do SubString in XSL<br />14. Can we do sorting in XSL ? how do you deal sorting columns dynamically in XML.<br />15. What is “Async” property of XML Means ?<br />16. What is XPath Query ?<br />17. Difference Between Element and Node.<br />18. What is CDATA Section.<br />19. DOM & SAX parsers explanation and difference<br />20. What is GetElementbyname method will do?<br />21. What is selectnode method will give?<br />22. What is valid xml document? What a well formed xml document?<br />23. What is the Difference between XmlDocument and XmlDataDocument?<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com0tag:blogger.com,1999:blog-9088987006789845123.post-49672682489441631952009-04-03T15:20:00.004+05:302009-04-03T15:25:51.901+05:30ASP.NET Web Service and Remoting Interview Questions Part II16. What is Remoting?<br /><br />Ans. The process of communication between different operating system processes, regardless of whether they are on the same computer. The .NET remoting system is an architecture designed to simplify communication between objects living in different application domains, whether on the same computer or not, and between different contexts, whether in the same application domain or not.<br /><br />17. Difference between web services & remoting?<br /><br />Ans. ASP.NET Web Services .NET Remoting <br />Protocol Can be accessed only over HTTP Can be accessed over any protocol (including TCP, HTTP, SMTP and so on) <br />State Management Web services work in a stateless environment Provide support for both stateful and stateless environments through Singleton and SingleCall objects <br />Type System Web services support only the datatypes defined in the XSD type system, limiting the number of objects that can be serialized. Using binary communication, .NET Remoting can provide support for rich type system <br />Interoperability Web services support interoperability across platforms, and are ideal for heterogeneous environments. .NET remoting requires the client be built using .NET, enforcing homogenous environment. <br />Reliability Highly reliable due to the fact that Web services are always hosted in IIS Can also take advantage of IIS for fault isolation. If IIS is not used, application needs to provide plumbing for ensuring the reliability of the application. <br />Extensibility Provides extensibility by allowing us to intercept the SOAP messages during the serialization and deserialization stages. Very extensible by allowing us to customize the different components of the .NET remoting framework. <br />Ease-of-Programming Easy-to-create and deploy. Complex to program. <br /><br />18. Though both the .NET Remoting infrastructure and ASP.NET Web services can enable cross-process communication, each is designed to benefit a different target audience. ASP.NET Web services provide a simple programming model and a wide reach. .NET Remoting provides a more complex programming model and has a much narrower reach.<br />As explained before, the clear performance advantage provided by TCPChannel-remoting should make you think about using this channel whenever you can afford to do so. If you can create direct TCP connections from your clients to your server and if you need to support only the .NET platform, you should go for this channel. If you are going to go cross-platform or you have the requirement of supporting SOAP via HTTP, you should definitely go for ASP.NET Web services.<br />Both the .NET remoting and ASP.NET Web services are powerful technologies that provide a suitable framework for developing distributed applications. It is important to understand how both technologies work and then choose the one that is right for your application. For applications that require interoperability and must function over public networks, Web services are probably the best bet. For those that require communications with other .NET components and where performance is a key priority, .NET Remoting is the best choice. In short, use Web services when you need to send and receive data from different computing platforms, use .NET Remoting when sending and receiving data between .NET applications. In some architectural scenarios, you might also be able to use.NET Remoting in conjunction with ASP.NET Web services and take advantage of the best of both worlds.<br />The Key difference between ASP.NET webservices and .NET Remoting is how they serialize data into messages and the format they choose for metadata. ASP.NET uses XML serializer for serializing or Marshalling. And XSD is used for Metadata. .NET Remoting relies on System.Runtime.Serialization.Formatter.Binary and System.Runtime.Serialization.SOAPFormatter and relies on .NET CLR Runtime assemblies for metadata.<br /><br />19. Can you pass SOAP messages through remoting?<br /><br />20. CAO and SAO.<br /><br />Ans. Client Activated objects are those remote objects whose Lifetime is directly Controlled by the client. This is in direct contrast to SAO. Where the server, not the client has complete control over the lifetime of the objects.<br />Client activated objects are instantiated on the server as soon as the client request the object to be created. Unlike as SAO a CAO doesn’t delay the object creation until the first method is called on the object. (In SAO the object is instantiated when the client calls the method on the object)<br /><br />21. singleton and singlecall.<br /><br />Singleton types never have more than one instance at any one time. If an instance exists, all client requests are serviced by that instance.<br />Single Call types always have one instance per client request. The next method invocation will be serviced by a different server instance, even if the previous instance has not yet been recycled by the system.<br /><br />22. What is Asynchronous Web Services?<br /><br />23. Web Client class and its methods?<br /><br />24. Flow of remoting?<br /><br />25. What is the use of trace utility?<br /><br />Ans. Using the SOAP Trace Utility<br />The Microsoft® Simple Object Access Protocol (SOAP) Toolkit 2.0 includes a TCP/IP trace utility, MSSOAPT.EXE. You use this trace utility to view the SOAP messages sent by HTTP between a SOAP client and a service on the server.<br />Using the Trace Utility on the Server<br />To see all of a service's messages received from and sent to all clients, perform the following steps on the server.<br />1. On the server, open the Web Services Description Language (WSDL) file.<br />2. In the WSDL file, locate the <soap:address> element that corresponds to the service and change the location attribute for this element to port 8080. For example, if the location attribute specifies<br /><http://myserver/vdir/service.wsdl> change this attribute to <http://myserver:8080/vdir/service.wsdl>.<br />3. Run MSSOAPT.exe.<br />4. On the File menu, point to New, and either click Formatted Trace (if you don't want to see HTTP headers) or click Unformatted Trace (if you do want to see HTTP headers).<br />5. In the Trace Setup dialog box, click OK to accept the default values.<br />Using the Trace Utility on the Client<br />To see all messages sent to and received from a service, do the following steps on the client.<br />6. Copy the WSDL file from the server to the client.<br />7. Modify location attribute of the <soap:address> element in the local copy of the WSDL document to direct the client to localhost:8080 and make a note of the current host and port. For example, if the WSDL contains <http://myserver/vdir/service.wsdl>, change it to <http://localhost:8080/vdir/service.wsdl> and make note of "MyServer".<br />8. On the client, run MSSOPT.exe.<br />9. On the File menu, point to New, and either click Formatted Trace (if you don't want to see HTTP headers) or click Unformatted Trace (if you do want to see HTTP headers).<br />10. In the Destination host box, enter the host specified in Step 2.<br />11. In the Destination port box, enter the port specified in Step 2.<br />12. Click OK.<div class="blogger-post-footer"><script type="text/javascript"><!--
google_ad_client = "pub-8716701302248821";
/* 468x15, created 5/12/08 */
google_ad_slot = "5004572289";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>Shaveta Aggarwalhttp://www.blogger.com/profile/16345884203149403084noreply@blogger.com1