<?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&#8217;s</title>
	<atom:link href="http://archanareddy20.wordpress.com/category/faqs/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&#8217;s</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>Normalization in DBMS</title>
		<link>http://archanareddy20.wordpress.com/2007/06/26/normalization-in-dbms/</link>
		<comments>http://archanareddy20.wordpress.com/2007/06/26/normalization-in-dbms/#comments</comments>
		<pubDate>Tue, 26 Jun 2007 07:57:00 +0000</pubDate>
		<dc:creator>archanareddy20</dc:creator>
				<category><![CDATA[faq's]]></category>

		<guid isPermaLink="false">http://archanareddy20.wordpress.com/2007/06/26/normalization-in-dbms/</guid>
		<description><![CDATA[Normalization
Normalization is a design technique that is widely used as a guide in designing relational databases. Normalization is essentially a two step process that puts data into tabular form by removing repeating groups and then removes duplicated data from the relational tables.
Normalization theory is based on the concepts of normal forms. A relational table is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=37&subd=archanareddy20&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Normalization</p>
<p>Normalization is a design technique that is widely used as a guide in designing relational databases. Normalization is essentially a two step process that puts data into tabular form by removing repeating groups and then removes duplicated data from the relational tables.</p>
<p>Normalization theory is based on the concepts of normal forms. A relational table is said to be a particular normal form if it satisfied a certain set of constraints. There are currently five normal forms that have been defined. In this section, we will cover the first three normal forms that were defined by E. F. Codd.<br />Basic Concepts</p>
<p>The goal of normalization is to create a set of relational tables that are free of redundant data and that can be consistently and correctly modified. This means that all tables in a relational database should be in the third normal form (3NF). A relational table is in 3NF if and only if all non-key columns are (a) mutually independent and (b) fully dependent upon the primary key. Mutual independence means that no non-key column is dependent upon any combination of the other columns. The first two normal forms are intermediate steps to achieve the goal of having all tables in 3NF. In order to better understand the 2NF and higher forms, it is necessary to understand the concepts of functional dependencies and lossless decomposition.<br />Functional Dependencies</p>
<p>The concept of functional dependencies is the basis for the first three normal forms. A column, Y, of the relational table R is said to be functionally dependent upon column X of R if and only if each value of X in R is associated with precisely one value of Y at any given time. X and Y may be composite. Saying that column Y is functionally dependent upon X is the same as saying the values of column X identify the values of column Y. If column X is a primary key, then all columns in the relational table R must be functionally dependent upon X.</p>
<p>A short-hand notation for describing a functional dependency is:</p>
<p>   R.x —&gt;; R.y</p>
<p>which can be read as in the relational table named R, column x functionally determines (identifies) column y.</p>
<p>Full functional dependence applies to tables with composite keys. Column Y in relational table R is fully functional on X of R if it is functionally dependent on X and not functionally dependent upon any subset of X. Full functional dependence means that when a primary key is composite, made of two or more columns, then the other columns must be identified by the entire key and not just some of the columns that make up the key.<br />Overview</p>
<p>Simply stated, normalization is the process of removing redundant data from relational tables by decomposing (splitting) a relational table into smaller tables by projection. The goal is to have only primary keys on the left hand side of a functional dependency. In order to be correct, decomposition must be lossless. That is, the new tables can be recombined by a natural join to recreate the original table without creating any spurious or redundant data.<br />Sample Data</p>
<p>Data taken from Date [Date90] is used to illustrate the process of normalization. A company obtains parts from a number of suppliers. Each supplier is located in one city. A city can have more than one supplier located there and each city has a status code associated with it. Each supplier may provide many parts. The company creates a simple relational table to store this information that can be expressed in relational notation as:</p>
<p>   FIRST (s#, status, city, p#, qty)</p>
<p>where<br />s#  supplier identifcation number (this is the primary key)<br />status  status code assigned to city<br />city  name of city where supplier is located<br />p#  part number of part supplied<br />qty&gt;  quantity of parts supplied to date</p>
<p>In order to uniquely associate quantity supplied (qty) with part (p#) and supplier (s#), a composite primary key composed of s# and p# is used.<br />First Normal Form</p>
<p>A relational table, by definition, is in first normal form. All values of the columns are atomic. That is, they contain no repeating values. Figure1 shows the table FIRST in 1NF.</p>
<p>Figure 1: Table in 1NF</p>
<p>Although the table FIRST is in 1NF it contains redundant data. For example, information about the supplier&#8217;s location and the location&#8217;s status have to be repeated for every part supplied. Redundancy causes what are called update anomalies. Update anomalies are problems that arise when information is inserted, deleted, or updated. For example, the following anomalies could occur in FIRST:</p>
<p>   * INSERT. The fact that a certain supplier (s5) is located in a particular city (Athens) cannot be added until they supplied a part.<br />   * DELETE. If a row is deleted, then not only is the information about quantity and part lost but also information about the supplier.<br />   * UPDATE. If supplier s1 moved from London to New York, then six rows would have to be updated with this new information.</p>
<p>Second Normal Form</p>
<p>The definition of second normal form states that only tables with composite primary keys can be in 1NF but not in 2NF.</p>
<p>   A relational table is in second normal form 2NF if it is in 1NF and every non-key column is fully dependent upon the primary key.</p>
<p>That is, every non-key column must be dependent upon the entire primary key. FIRST is in 1NF but not in 2NF because status and city are functionally dependent upon only on the column s# of the composite key (s#, p#). This can be illustrated by listing the functional dependencies in the table:<br />s#<br /> —&gt; city, status<br />city<br /> —&gt; status<br />(s#,p#)<br /> —&gt;qty</p>
<p>The process for transforming a 1NF table to 2NF is:</p>
<p>  1. Identify any determinants other than the composite key, and the columns they determine.<br />  2. Create and name a new table for each determinant and the unique columns it determines.<br />  3. Move the determined columns from the original table to the new table. The determinate becomes the primary key of the new table.<br />  4. Delete the columns you just moved from the original table except for the determinate which will serve as a foreign key.<br />  5. The original table may be renamed to maintain semantic meaning.</p>
<p>To transform FIRST into 2NF we move the columns s#, status, and city to a new table called SECOND. The column s# becomes the primary key of this new table. The results are shown below in Figure 2.</p>
<p>Figure 2: Tables in 2NF</p>
<p>Tables in 2NF but not in 3NF still contain modification anomalies. In the example of SECOND, they are:</p>
<p>   INSERT. The fact that a particular city has a certain status (Rome has a status of 50) cannot be inserted until there is a supplier in the city.</p>
<p>   DELETE. Deleting any row in SUPPLIER destroys the status information about the city as well as the association between supplier and city.</p>
<p>Third Normal Form</p>
<p>The third normal form requires that all columns in a relational table are dependent only upon the primary key. A more formal definition is:</p>
<p>   A relational table is in third normal form (3NF) if it is already in 2NF and every non-key column is non transitively dependent upon its primary key. In other words, all nonkey attributes are functionally dependent only upon the primary key.</p>
<p>Table PARTS is already in 3NF. The non-key column, qty, is fully dependent upon the primary key (s#, p#). SUPPLIER is in 2NF but not in 3NF because it contains a transitive dependency. A transitive dependency is occurs when a non-key column that is a determinant of the primary key is the determinate of other columns. The concept of a transitive dependency can be illustrated by showing the functional dependencies in SUPPLIER:<br />SUPPLIER.s#<br /> —&gt; SUPPLIER.status<br />SUPPLIER.s#<br /> —&gt; SUPPLIER.city<br />SUPPLIER.city<br /> —&gt; SUPPLIER.status</p>
<p>Note that SUPPLIER.status is determined both by the primary key s# and the non-key column city. The process of transforming a table into 3NF is:</p>
<p>  1.<br />     Identify any determinants, other the primary key, and the columns they determine.<br />  2. Create and name a new table for each determinant and the unique columns it determines.<br />  3. Move the determined columns from the original table to the new table. The determinate becomes the primary key of the new table.<br />  4.<br />     Delete the columns you just moved from the original table except for the determinate which will serve as a foreign key.<br />  5. The original table may be renamed to maintain semantic meaning.</p>
<p>To transform SUPPLIER into 3NF, we create a new table called CITY_STATUS and move the columns city and status into it. Status is deleted from the original table, city is left behind to serve as a foreign key to CITY_STATUS, and the original table is renamed to SUPPLIER_CITY to reflect its semantic meaning. The results are shown in Figure 3 below.</p>
<p>Figure 3: Tables in 3NF</p>
<p>The results of putting the original table into 3NF has created three tables. These can be represented in &#8220;psuedo-SQL&#8221; as:</p>
<p>PARTS (#s, p#, qty)<br />Primary Key (s#,#p)<br />Foreign Key (s#) references SUPPLIER_CITY.s#</p>
<p>SUPPLIER_CITY(s#, city)<br />Primary Key (s#)<br />Foreign Key (city) references CITY_STATUS.city</p>
<p>CITY_STATUS (city, status)<br />Primary Key (city)<br />Advantages of Third Normal Form</p>
<p>The advantage of having relational tables in 3NF is that it eliminates redundant data which in turn saves space and reduces manipulation anomalies. For example, the improvements to our sample database are:</p>
<p>   INSERT. Facts about the status of a city, Rome has a status of 50, can be added even though there is not supplier in that city. Likewise, facts about new suppliers can be added even though they have not yet supplied parts.</p>
<p>   DELETE. Information about parts supplied can be deleted without destroying information about a supplier or a city. UPDATE. Changing the location of a supplier or the status of a city requires modifying only one row.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/archanareddy20.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/archanareddy20.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/archanareddy20.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/archanareddy20.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/archanareddy20.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/archanareddy20.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/archanareddy20.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/archanareddy20.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/archanareddy20.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/archanareddy20.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/archanareddy20.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/archanareddy20.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=archanareddy20.wordpress.com&blog=1543902&post=37&subd=archanareddy20&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://archanareddy20.wordpress.com/2007/06/26/normalization-in-dbms/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>