<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Freshers jobs, Todays jobs &#38; Walkins, Experienced &#38; BPO jobs, ebooks, C,C++,SQL,SAP,Oracle &#187; faq</title>
	<atom:link href="http://archanareddy20.wordpress.com/category/faq/feed/" rel="self" type="application/rss+xml" />
	<link>http://archanareddy20.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 29 Oct 2007 06:27:00 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='archanareddy20.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/169003c4a083d4efb5a2a83b62e2b284?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Freshers jobs, Todays jobs &#38; Walkins, Experienced &#38; BPO jobs, ebooks, C,C++,SQL,SAP,Oracle &#187; faq</title>
		<link>http://archanareddy20.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://archanareddy20.wordpress.com/osd.xml" title="Freshers jobs, Todays jobs &amp; Walkins, Experienced &amp; BPO jobs, ebooks, C,C++,SQL,SAP,Oracle" />
		<item>
		<title>C++ faq&#8217;s and interview Questions &#8211; 3</title>
		<link>http://archanareddy20.wordpress.com/2007/07/17/c-faqs-and-interview-questions-3/</link>
		<comments>http://archanareddy20.wordpress.com/2007/07/17/c-faqs-and-interview-questions-3/#comments</comments>
		<pubDate>Tue, 17 Jul 2007 07:18:00 +0000</pubDate>
		<dc:creator>archanareddy20</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[faq's]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://archanareddy20.wordpress.com/2007/07/17/c-faqs-and-interview-questions-3/</guid>
		<description><![CDATA[7. How do I refer to a name of class or function that is defined within a namespace?Ans: There are two ways in which we can refer to a name of class or function that is defined within a namespace:Using scope resolution operator through the using keyword.This is shown in following example:namespace name1{class sample1{ // [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=107&subd=archanareddy20&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>7. How do I refer to a name of class or function that is defined within a namespace?<br />Ans: There are two ways in which we can refer to a name of class or function that is defined within a namespace:<br />Using scope resolution operator through the using keyword.<br />This is shown in following example:<br />namespace name1<br />{<br />class sample1<br />{ // code } ;<br />}<br />namespace name2 {<br />class sample2 { // code } ; }<br />using namespace name2 ;<br />void main( )<br />{<br />name1::sample1 s1 ;<br />sample2 s2 ;<br />}<br />Here, class sample1 is referred using the scope resolution operator. On the other hand we can directly refer to class sample2 because of the statement using namespace name2 ; the using keyword declares all the names in the namespace to be in the current scope. So we can use the names without any qualifiers.<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br /><!-- google_ad_client = "pub-4800743051762209"; google_ad_output = "textlink"; google_ad_format = "ref_text"; google_cpa_choice = "CAEaCPE0Qicm8BvfUAU"; //--></p>
<p>8. While overloading a binary operator can we provide default values?<br />Ans: No!. This is because even if we provide the default arguments to the parameters of the overloaded operator function we would end up using the binary operator incorrectly. This is explained in the following example:<br />sample operator + ( sample a, sample b = sample (2, 3.5f ) )<br />{ }<br />void main( )<br />{<br />sample s1, s2, s3 ;<br />s3 = s1 + ; // error<br />}<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;9. How do I carry out conversion of one object of user-defined type to another?<br />Ans: To perform conversion from one user-defined type to another we need to provide conversion function. Following program demonstrates how to provide such conversion function.<br />class circle<br />{<br />private :<br />int radius ;<br />public:<br />circle ( int r = 0 )<br />{<br />radius = r ;<br />}<br />} ;<br />class rectangle<br />{<br />private :<br />int length, breadth ;<br />public :<br />rectangle( int l, int b )<br />{<br />length = l ;<br />breadth = b ;<br />}<br />operator circle( )<br />{<br />return circle ( length ) ;<br />}<br />} ;<br />void main( )<br />{<br />rectangle r ( 20, 10 ) ;<br />circle c;<br />c = r ;<br />}</p>
<p>Here, when the statement c = r ; is executed the compiler searches for an overloaded assignment operator in the class circle which accepts the object of type rectangle. Since there is no such overloaded assignment operator, the conversion operator function that converts the rectangle object to the circle object is searched in the rectangle class. We have provided such a conversion function in the rectangle class. This conversion operator function returns a circle object. By default conversion operators have the name and return type same as the object type to which it converts to. Here the type of the object is circle and hence the name of the operator function as well as the return type is circle.<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />10. How do I write code that allows to create only one instance of a class?<br />Ans: This is shown in following code snippet.</p>
<p>class sample<br />{<br />static sample *ptr ;<br />private:<br />sample( )<br />{<br />}<br />public:<br />static sample* create( )<br />{<br />if ( ptr == NULL )<br />ptr = new sample ;<br />return ptr ;<br />}<br />} ;<br />sample *sample::ptr = NULL ;<br />void main( )<br />{<br />sample *a = sample::create( ) ;<br />sample *b = sample::create( ) ;<br />}</p>
<p>Here, the class sample contains a static data member ptr, which is a pointer to the object of same class. The constructor is private which avoids us from creating objects outside the class. A static member function called create( ) is used to create an object of the class. In this function the condition is checked whether or not ptr is NULL, if it is then an object is created dynamically and its address collected in ptr is returned. If ptr is not NULL, then the same address is returned. Thus, in main( ) on execution of the first statement one object of sample gets created whereas on execution of second statement, b holds the address of the first object. Thus, whatever number of times you call create( ) function, only one object of sample class will be available.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/archanareddy20.wordpress.com/107/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/archanareddy20.wordpress.com/107/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/archanareddy20.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/archanareddy20.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/archanareddy20.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/archanareddy20.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/archanareddy20.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/archanareddy20.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/archanareddy20.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/archanareddy20.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/archanareddy20.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/archanareddy20.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=107&subd=archanareddy20&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://archanareddy20.wordpress.com/2007/07/17/c-faqs-and-interview-questions-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/89cc4b2a872a17e79aaf0f7b63efdd47?s=96&#38;d=identicon" medium="image">
			<media:title type="html">archanareddy20</media:title>
		</media:content>
	</item>
		<item>
		<title>C++ faq&#8217;s and interview Questions &#8211; 2</title>
		<link>http://archanareddy20.wordpress.com/2007/07/16/c-faqs-and-interview-questions-2/</link>
		<comments>http://archanareddy20.wordpress.com/2007/07/16/c-faqs-and-interview-questions-2/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 11:07:00 +0000</pubDate>
		<dc:creator>archanareddy20</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[faq's]]></category>
		<category><![CDATA[monster jobs]]></category>
		<category><![CDATA[naukri jobs]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://archanareddy20.wordpress.com/2007/07/16/c-faqs-and-interview-questions-2/</guid>
		<description><![CDATA[1. Can we declare a static function as virtual?Ans: No. The virtual function mechanism is used on the specific object that determines which virtual function to call. Since the static functions are not any way related to objects, they cannot be declared as virtual.&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
2. Can user-defined object be declared as static data member of another [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=104&subd=archanareddy20&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>1. Can we declare a static function as virtual?<br />Ans: No. The virtual function mechanism is used on the specific object that determines which virtual function to call. Since the static functions are not any way related to objects, they cannot be declared as virtual.<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>2. Can user-defined object be declared as static data member of another class?<br />Ans: Yes. The following code shows how to initialize a user-defined object.    <br /> #include     <br />class test   <br /> {    <br /> int i ;     <br /> public :    <br /> test ( int ii = 0 )     <br />{      i = ii ;       }     <br />} ;   <br /> class sample   <br /> {     <br />static test s ;     <br />} ;    <br />test sample::s ( 26 ) ;    <br /> Here we have initialized the object s by calling the one-argument constructor. We can use the same convention to initialize the object by calling multiple-argument constructor.<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>3. What is forward referencing and when should it be used?<br />Ans: Consider the following program:                        <br />class test                     <br /> {                      <br /> public :                      <br /> friend void fun ( sample, test ) ;          <br /> } ;                     <br /> class sample      <br />{                       <br />public :           <br />            friend void fun ( sample, test ) ;    <br />                   } ;                  <br />    void fun ( sample s, test t )       <br />               {                        // code                         }  <br />                    void main( )             <br />         {                    <br />   sample s ;                  <br />    test t ;                     <br /> fun ( s, t ) ;                 <br />      }<br />This program would not compile. It gives an error that sample is undeclared identifier in the statement friend void fun ( sample, test ) ; of the class test. This is so because the class sample is defined below the class                         test and we are using it before its definition. To overcome this error we need to give forward reference of                         the class sample before the definition of class test. The following statement is the forward reference of                         class sample. Forward referencing is generally required when we make a class or a function as a friend.<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>4. The istream_withassign class has been derived from the istream class and overloaded assignment                               operator has been added to it. The _withassign classes are much like their base classes except                               that they include overloaded assignment operators. Using these operators the objects of the                               _withassign classes can be copied. The istream, ostream, and iostream classes are made uncopyable                               by making their overloaded copy constructor and assignment operators private.<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>5. How do I write my own zero-argument manipulator that should work same as hex?<br />Ans: This is shown in following program.<br />#include<br />ostream&amp; myhex ( ostream &amp;o )<br />{<br />o.setf ( ios::hex) ;<br />return o ;<br />}<br />void main( )<br />{<br />cout &lt;&lt; endl &lt;&lt; myhex &lt;&lt; 2000 ;<br />}<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>6. We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p? <br />   #include    <br /> void main( )     {       <br /> const char *p ;        <br />p = &#8220;A const pointer&#8221; ;  <br />      cout &lt;&lt; p ;   <br /> }    <br /> Ans: The output of the above program is &#8216;A const pointer&#8217;. This is because in this program p is declared as &#8216;const char*&#8217; which means that value stored at p will be constant and not p and so  the program works properly<br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/archanareddy20.wordpress.com/104/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/archanareddy20.wordpress.com/104/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/archanareddy20.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/archanareddy20.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/archanareddy20.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/archanareddy20.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/archanareddy20.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/archanareddy20.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/archanareddy20.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/archanareddy20.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/archanareddy20.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/archanareddy20.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=104&subd=archanareddy20&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://archanareddy20.wordpress.com/2007/07/16/c-faqs-and-interview-questions-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/89cc4b2a872a17e79aaf0f7b63efdd47?s=96&#38;d=identicon" medium="image">
			<media:title type="html">archanareddy20</media:title>
		</media:content>
	</item>
		<item>
		<title>C++ Design Pattern: What is a Singleton class?</title>
		<link>http://archanareddy20.wordpress.com/2007/07/16/c-design-pattern-what-is-a-singleton-class/</link>
		<comments>http://archanareddy20.wordpress.com/2007/07/16/c-design-pattern-what-is-a-singleton-class/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 03:13:00 +0000</pubDate>
		<dc:creator>archanareddy20</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[faq's]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[singleton class]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://archanareddy20.wordpress.com/2007/07/16/c-design-pattern-what-is-a-singleton-class/</guid>
		<description><![CDATA[Q: What is a singleton class?A: A class whose number of instances that can be instantiated is limited to one is called a singleton class. Thus, at any given time only one instance can exist, no more.
Q: Can you give me an example, where it is used?A: The singleton design pattern is used whenever the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=102&subd=archanareddy20&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Q: What is a singleton class?<br />A: A class whose number of instances that can be instantiated is limited to one is called a singleton class. Thus, at any given time only one instance can exist, no more.</p>
<p>Q: Can you give me an example, where it is used?<br />A: The singleton design pattern is used whenever the design requires only one instance of a class. Some examples:<br />Application classes. There should only be one application class. (Note: Please bear in mind, MFC class &#8216;CWinApp&#8217; is not implemented as a singleton class)<br />Logger classes. For logging purposes of an application there is usually one logger instance required.</p>
<p>Q: How could a singleton class be implemented?A: There are several ways of creating a singleton class. The most simple approach is shown below:</p>
<p>Code:<br /><span style="color:#990000;">class CMySingleton<br />{<br />public:<br />static CMySingleton&amp; Instance()<br />{<br />static CMySingleton singleton;<br />return singleton;<br />}<br />// Other non-static member functions<br />private:<br />CMySingleton() {}; // Private constructor<br />CMySingleton(const CMySingleton&amp;); // Prevent copy-construction<br />CMySingleton&amp; operator=(const CMySingleton&amp;); // Prevent assignment<br />};</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/archanareddy20.wordpress.com/102/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/archanareddy20.wordpress.com/102/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/archanareddy20.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/archanareddy20.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/archanareddy20.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/archanareddy20.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/archanareddy20.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/archanareddy20.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/archanareddy20.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/archanareddy20.wordpress.com/102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/archanareddy20.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/archanareddy20.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=102&subd=archanareddy20&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://archanareddy20.wordpress.com/2007/07/16/c-design-pattern-what-is-a-singleton-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/89cc4b2a872a17e79aaf0f7b63efdd47?s=96&#38;d=identicon" medium="image">
			<media:title type="html">archanareddy20</media:title>
		</media:content>
	</item>
		<item>
		<title>C++ faq&#8217;s and interview Questions</title>
		<link>http://archanareddy20.wordpress.com/2007/07/13/c-faqs-and-interview-questions/</link>
		<comments>http://archanareddy20.wordpress.com/2007/07/13/c-faqs-and-interview-questions/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 06:03:00 +0000</pubDate>
		<dc:creator>archanareddy20</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[faq's]]></category>
		<category><![CDATA[interview questions]]></category>
		<category><![CDATA[jobs]]></category>

		<guid isPermaLink="false">http://archanareddy20.wordpress.com/2007/07/13/c-faqs-and-interview-questions/</guid>
		<description><![CDATA[1.       Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible ?There is nothing like Virtual Constructor. The Constructor cant be virtual as the constructor is a code which is responsible for creating a instance of a class and it cant be delegated to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=95&subd=archanareddy20&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><span style="font-size:85%;">1.       Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible ?There is nothing like Virtual Constructor. The Constructor cant be virtual as the constructor is a code which is responsible for creating a instance of a class and it cant be delegated to any other object by virtual keyword means. </span></p>
<p><span style="font-size:85%;">2.       What about Virtual Destructor?Yes there is a Virtual Destructor. A destructor can be virtual as it is possible as at runtime depending on the type of object baller is balling to , proper destructor will be called. </span></p>
<p><span style="font-size:85%;">3.       What is Pure Virtual Function? Why and when it is used ?The abstract class whose pure virtual method has to be implemented by all the classes which derive on these. Otherwise it would result in a compilation error.This construct should be used when one wants to ensure that all the derived classes implement the method defined as pure virtual in base class. </span></p>
<p><span style="font-size:85%;">4.       What is problem with Runtime type identification?The run time type identification comes at a cost of performance penalty. Compiler maintains the class. </span></p>
<p><span style="font-size:85%;">5.       How Virtual functions call up is maintained?Through Look up tables added by the compile to every class image. This also leads to performance penalty. </span></p>
<p><span style="font-size:85%;">6.       Can inline functions have a recursion?No.Syntax wise It is allowed. But then the function is no longer Inline. As the compiler will never know how deep the recursion is at compilation time. </span></p>
<p><span style="font-size:85%;">7.       How do you link a C++ program to C functions?By using the extern &#8220;C&#8221; linkage specification around the C function declarations.Programmers should know about mangled function names and type-safe linkages. Then they should explain how the extern &#8220;C&#8221; linkage specification statement turns that feature off during compilation so that the linker properly links function calls to C functions. </span></p>
<p><span style="font-size:85%;">8.       Explain the scope resolution operator?It permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope. </span></p>
<p><span style="font-size:85%;">9.       How many ways are there to initialize an int with a constant?1. int foo = 123;2. int bar(123); </span></p>
<p><span style="font-size:85%;">10.    What is your reaction to this line of code? delete this;It is not a good programming Practice.A good programmer will insist that you should absolutely never use the statement if the class is to be used by other programmers and instantiated as static, extern, or automatic objects. That much should be obvious.The code has two built-in pitfalls. First, if it executes in a member function for an extern, static, or automatic object, the program will probably crash as soon as the delete statement executes. There is no portable way for an object to tell that it was instantiated on the heap, so the class cannot assert that its object is properly instantiated. Second, when an object commits suicide this way, the using program might not know about its demise. As far as the instantiating program is concerned, the object remains in scope and continues to exist even though the object did itself in. Subsequent dereferencing of the baller can and usually does lead to disaster. I think that the language rules should disallow the idiom, but that&#8217;s another matter. </span></p>
<p><span style="font-size:85%;">11.    What is the difference between a copy constructor and an overloaded assignment operator?A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class. </span></p>
<p><span style="font-size:85%;">12.    When should you use multiple inheritance?There are three acceptable answers:- &#8220;Never,&#8221; &#8220;Rarely,&#8221; and &#8220;When the problem domain cannot be accurately modeled any other way.&#8221;<br />Consider an Asset class, Building class, Vehicle class, and CompanyCar class. All company cars are vehicles. Some company cars are assets because the organizations own them. Others might be leased. Not all assets are vehicles. Money accounts are assets. Real estate holdings are assets. Some real estate holdings are buildings. Not all buildings are assets. Ad infinitum. When you diagram these relationships, it becomes apparent that multiple inheritance is a likely and intuitive way to model this common problem domain. The applicant should understand, however, that multiple inheritance, like a chainsaw, is a useful tool that has its perils, needs respect, and is best avoided except when nothing else will do.</span></p>
<p><span style="font-size:85%;">13.    What is a virtual destructor?The simple answer is that a virtual destructor is one that is declared with the virtual attribute.The behavior of a virtual destructor is what is important. If you destroy an object through a baller or reference to a base class, and the base-class destructor is not virtual, the derived-class destructors are not executed, and the destruction might not be comple </span></p>
<p><span style="font-size:85%;">14.    Can a constructor throw a exception? How to handle the error when the constructor fails?The constructor never throws a error. </span></p>
<p><span style="font-size:85%;">15.    What are the debugging methods you use when came across a problem?Debugging with tools like :<br />GDB, DBG, Forte, Visual Studio.<br />Analyzing the Core dump.<br />Using tusc to trace the last system call before crash.<br />Putting Debug statements in the program source code.</span></p>
<p><span style="font-size:85%;">16.    How the compilers arranges the various sections in the executable image?The executable had following sections:-<br />Data Section (uninitialized data variable section, initialized data variable section )<br />Code Section<br />Remember that all static variables are allocated in the initialized variable section.</span></p>
<p><span style="font-size:85%;">17.    Explain the ISA and HASA class relationships. How would you implement each in a class design?A specialized class &#8220;is&#8221; a specialization of another class and, therefore, has the ISA relationship with the other class.This relationship is best implemented by embedding an object of the Salary class in the Employee class. </span></p>
<p><span style="font-size:85%;">18.    When is a template a better solution than a base class?When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the generality) to the designer of the container or manager class. </span></p>
<p><span style="font-size:85%;">19.    What are the differences between a C++ struct and C++ class?The default member and base-class access specifies are different.This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specified and private base-class inheritance. </span></p>
<p><span style="font-size:85%;">20.    How do you know that your class needs a virtual destructor?If your class has at least one virtual function, you should make a destructor for this class virtual. This will allow you to delete a dynamic object through a baller to a base class object. If the destructor is non-virtual, then wrong destructor will be invoked during deletion of the dynamic object. </span></p>
<p><span style="font-size:85%;">21.    What is the difference between new/delete and malloc/free?Malloc/free do not know about constructors and destructors. New and delete create and destroy objects, while malloc and free allocate and deallocate memory. </span></p>
<p><span style="font-size:85%;">22.    What happens when a function throws an exception that was not specified by an exception specification for this function?Unexpected() is called, which, by default, will eventually trigger abort(). </span></p>
<p><span style="font-size:85%;">23.    Can you think of a situation where your program would crash without reaching the breakball, which you set at the beginning of main()?C++ allows for dynamic initialization of global variables before main() is invoked. It is possible that initialization of global will invoke some function. If this function crashes the crash will occur before main() is entered. </span></p>
<p><span style="font-size:85%;">24.    What issue do auto_ptr objects address?If you use auto_ptr objects you would not have to be concerned with heap objects not being deleted even if the exception is thrown. </span></p>
<p><span style="font-size:85%;">25.    Is there any problem with the following:char *a=NULL; char&amp; p = *a;?The result is undefined. You should never do this. A reference must always refer to some object. </span></p>
<p><span style="font-size:85%;">26.    Why do C++ compilers need name mangling?Name mangling is the rule according to which C++ changes function&#8217;s name into function signature before passing that function to a linker. This is how the linker differentiates between different functions with the same name.</span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/archanareddy20.wordpress.com/95/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/archanareddy20.wordpress.com/95/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/archanareddy20.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/archanareddy20.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/archanareddy20.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/archanareddy20.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/archanareddy20.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/archanareddy20.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/archanareddy20.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/archanareddy20.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/archanareddy20.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/archanareddy20.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=95&subd=archanareddy20&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://archanareddy20.wordpress.com/2007/07/13/c-faqs-and-interview-questions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/89cc4b2a872a17e79aaf0f7b63efdd47?s=96&#38;d=identicon" medium="image">
			<media:title type="html">archanareddy20</media:title>
		</media:content>
	</item>
		<item>
		<title>SCJP faq</title>
		<link>http://archanareddy20.wordpress.com/2007/07/03/scjp-faq/</link>
		<comments>http://archanareddy20.wordpress.com/2007/07/03/scjp-faq/#comments</comments>
		<pubDate>Tue, 03 Jul 2007 08:58:00 +0000</pubDate>
		<dc:creator>archanareddy20</dc:creator>
				<category><![CDATA[SCJP]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[faq's]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://archanareddy20.wordpress.com/2007/07/03/scjp-faq/</guid>
		<description><![CDATA[The following links may clear some of the common doubts about SCJP Exam. I am planning to add some additional Frequently Asked Questions not listed in the following links. So please check this page often to get the updated FAQ.
SCJP   Certification   FAQ
Deepak&#8217;s SCJP2 Certification FAQ.
http://deepak.htmlplanet.com/certi.html#one
A very good SCJP2 certification faq from [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=55&subd=archanareddy20&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The following links may clear some of the common doubts about SCJP Exam. I am planning to add some additional Frequently Asked Questions not listed in the following links. So please check this page often to get the updated FAQ.</p>
<p>SCJP   Certification   FAQ</p>
<p>Deepak&#8217;s SCJP2 Certification FAQ.</p>
<p><a href="http://deepak.htmlplanet.com/certi.html#one">http://deepak.htmlplanet.com/certi.html#one</a></p>
<p>A very good SCJP2 certification faq from javaprepare.com. Worth to read.</p>
<p><a href="http://www.javaprepare.com/faq.html">http://www.javaprepare.com/faq.html</a></p>
<p>Digital cat&#8217;s How-do-I</p>
<p><a href="http://www.digitalfocus.com/faq/">http://www.digitalfocus.com/faq/</a></p>
<p>Dave&#8217;s SCJP faq. He shares his experience in this faq section. Don&#8217;t miss it.</p>
<p><a href="http://www.dchung.com/java/javacertificati%20on.html">http://www.dchung.com/java/javacertificati on.html</a></p>
<p>Java   FAQ</p>
<p>comp.lang.java FAQ (HTML; Elliotte Rusty Harold)</p>
<p><a href="http://metalab.unc.edu/javafaq/javafaq.html">http://metalab.unc.edu/javafaq/javafaq.html</a></p>
<p>Peter van der Linden&#8217;s Java Programmers&#8217; FAQ. This is the largest and most up-to-date FAQ</p>
<p><a href="http://www.best.com/~pvdl/javafa%20q.txt">http://www.best.com/~pvdl/javafa q.txt</a></p>
<p><a href="http://www.blogger.com/www.javaranch.com">www.javaranch.com</a></p>
<p><a href="http://www.jchq.net/">http://www.jchq.net/</a></p>
<p><a href="http://java.about.com/compute/java/msubf%20reebooks.htm?REDIR_404=yes&amp;">http://java.about.com/compute/java/msubf reebooks.htm?REDIR_404=yes&amp;</a></p>
<p><a href="http://members.tripod.com/~mpTOOLS/ring.html">http://members.tripod.com/~mpTOOLS/ring.html</a></p>
<p><a href="http://www.javaranch.com/ring.html">http://www.javaranch.com/ring.html</a></p>
<p><a href="http://www.taxon.demon.nl/JW/javawoman.html">http://www.taxon.demon.nl/JW/javawoman.html</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/archanareddy20.wordpress.com/55/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/archanareddy20.wordpress.com/55/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/archanareddy20.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/archanareddy20.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/archanareddy20.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/archanareddy20.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/archanareddy20.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/archanareddy20.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/archanareddy20.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/archanareddy20.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/archanareddy20.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/archanareddy20.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=55&subd=archanareddy20&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://archanareddy20.wordpress.com/2007/07/03/scjp-faq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/89cc4b2a872a17e79aaf0f7b63efdd47?s=96&#38;d=identicon" medium="image">
			<media:title type="html">archanareddy20</media:title>
		</media:content>
	</item>
		<item>
		<title>C++ FAQ&#8217;s</title>
		<link>http://archanareddy20.wordpress.com/2007/06/22/c-faqs/</link>
		<comments>http://archanareddy20.wordpress.com/2007/06/22/c-faqs/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 07:14:00 +0000</pubDate>
		<dc:creator>archanareddy20</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[faq]]></category>
		<category><![CDATA[faq's]]></category>

		<guid isPermaLink="false">http://archanareddy20.wordpress.com/2007/06/22/c-faqs/</guid>
		<description><![CDATA[Bjarne Stroustrup&#8217;s C++ Style and Technique FAQ
http://www.research.att.com/~bs/bs_faq2.html
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=24&subd=archanareddy20&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Bjarne Stroustrup&#8217;s C++ Style and Technique FAQ</p>
<p><a href="http://www.research.att.com/~bs/bs_faq2.html">http://www.research.att.com/~bs/bs_faq2.html</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/archanareddy20.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/archanareddy20.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/archanareddy20.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/archanareddy20.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/archanareddy20.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/archanareddy20.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/archanareddy20.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/archanareddy20.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/archanareddy20.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/archanareddy20.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/archanareddy20.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/archanareddy20.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=24&subd=archanareddy20&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://archanareddy20.wordpress.com/2007/06/22/c-faqs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/89cc4b2a872a17e79aaf0f7b63efdd47?s=96&#38;d=identicon" medium="image">
			<media:title type="html">archanareddy20</media:title>
		</media:content>
	</item>
	</channel>
</rss>