<?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/"
	>

<channel>
	<title>Interview Mantra &#187; Interview Questions</title>
	<atom:link href="http://www.interviewmantra.net/category/interview-questions/feed" rel="self" type="application/rss+xml" />
	<link>http://www.interviewmantra.net</link>
	<description>Your mantra to job success</description>
	<lastBuildDate>Wed, 01 Feb 2012 04:42:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Winners of C Quiz Contest and Key</title>
		<link>http://www.interviewmantra.net/2011/09/winners-of-c-quiz-contest-and-key.html</link>
		<comments>http://www.interviewmantra.net/2011/09/winners-of-c-quiz-contest-and-key.html#comments</comments>
		<pubDate>Tue, 20 Sep 2011 15:00:39 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Quiz]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[quiz]]></category>
		<category><![CDATA[results]]></category>
		<category><![CDATA[winners]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=1861</guid>
		<description><![CDATA[Congratulations to the five winners of the C Quiz Contest. In all 50 people responded to this contest. Out of which only 7 people got all the answers right. The earliest five responses have been chosen as winning entries. Key for the quiz contest in C language]]></description>
			<content:encoded><![CDATA[<p></p><p>Congratulations to the five winners of the <a href="http://www.interviewmantra.net/2011/09/c-quiz-challenge-prize-for-fastest-correct-response.html">C Quiz Contest</a>.</p>
<p><a href="http://www.interviewmantra.net/2011/09/c-quiz-challenge-prize-for-fastest-correct-response.html"><img class="aligncenter size-full wp-image-1875" title="Winners of the contest are Mrityunjay Kumar Ranjan, Suman Halder, Vaibhav Tiwari, Sneha Pandey and Vijay Joshi" src="http://www.interviewmantra.net/wp-content/uploads/2011/09/winnners1.jpg" alt="Winners of the contest are Mrityunjay Kumar Ranjan, Suman Halder, Vaibhav Tiwari, Sneha Pandey and Vijay Joshi" width="530" height="236" /></a><span id="more-1861"></span></p>
<p>In all 50 people responded to this contest. Out of which only 7 people got all the answers right. The earliest five responses have been chosen as winning entries.</p>
<p><a style="margin: 12px auto 6px auto; font-family: Helvetica,Arial,Sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: normal; font-size-adjust: none; font-stretch: normal; display: block; text-decoration: underline;" title="View Key for a quiz in C language on Scribd" href="http://www.scribd.com/doc/65611540/Key-for-a-quiz-in-C-language">Key for the quiz contest in C language</a> <object id="doc_50179" style="outline: none;" width="100%" height="600" name="doc_50179" type="application/x-shockwave-flash" data="http://d1.scribdassets.com/ScribdViewer.swf"><param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#ffffff" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="FlashVars" value="document_id=65611540&amp;access_key=key-frp28dbpcrtyzfsvoje&amp;page=1&amp;viewMode=list" /><embed id="doc_50179" type="application/x-shockwave-flash" width="100%" height="600" src="http://d1.scribdassets.com/ScribdViewer.swf?document_id=65611540&amp;access_key=key-frp28dbpcrtyzfsvoje&amp;page=1&amp;viewMode=list" name="doc_50179" allowscriptaccess="always" allowfullscreen="true" wmode="opaque" bgcolor="#ffffff"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2011/09/winners-of-c-quiz-contest-and-key.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Update for C Quiz Challenge</title>
		<link>http://www.interviewmantra.net/2011/09/update-for-c-quiz-challenge.html</link>
		<comments>http://www.interviewmantra.net/2011/09/update-for-c-quiz-challenge.html#comments</comments>
		<pubDate>Fri, 16 Sep 2011 01:30:45 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[quiz]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=1840</guid>
		<description><![CDATA[Recently, we had posted a Quiz Contest on C language. So far we have received received 30 responses. And we are shocked to know that only 1 out of the 30 people,  got all the answers correct! According to us, the questions in this contest are far from being tough. They simply test basic concepts [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Recently, we had posted a <a href="http://www.interviewmantra.net/2011/09/c-quiz-challenge-prize-for-fastest-correct-response.html">Quiz Contest on C language</a>.</p>
<p>So far we have received received 30 responses. And we are shocked to know that only 1 out of the 30 people,  got all the answers correct! According to us, the questions in this contest are far from being tough. They simply test basic concepts of C language.</p>
<p>Not to forget, this quiz contest is like an open book test. You have Google, text books, lecturers and friends with you to check your answers. You even have <a href="http://sourceforge.net/projects/codeblocks/files/Binaries/10.05/Windows/codeblocks-10.05mingw-setup.exe">free compilers and IDEs</a> for C to check the output.</p>
<p>It is so hard to believe that there are so few Indian students who can get all the questions right. Guys, try harder. Before you send your answer, check and double check if your answers are correct. To win this contest you must get ALL the 20 questions right.</p>
<p>Take this as a challenge and forward it to all your friends who are interested in C programming.</p>
<p><strong>Update: </strong>This contest is now closed. Key and Winners will be announced soon.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2011/09/update-for-c-quiz-challenge.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C Quiz Challenge &#8212; prizes for fastest &amp; correct response</title>
		<link>http://www.interviewmantra.net/2011/09/c-quiz-challenge-prize-for-fastest-correct-response.html</link>
		<comments>http://www.interviewmantra.net/2011/09/c-quiz-challenge-prize-for-fastest-correct-response.html#comments</comments>
		<pubDate>Thu, 15 Sep 2011 01:30:15 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[challenge]]></category>
		<category><![CDATA[quiz]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=1823</guid>
		<description><![CDATA[Instructions This quiz has 20 questions – 19 multiple choice questions &#38; 1 text answer question Each multiple choice question has only one possible answer This Quiz Contest is targeted for freshers who have recently passed out of college. The first five people who send accurate answers at the earliest are rewarded. The winners would [...]]]></description>
			<content:encoded><![CDATA[<p></p><h2>Instructions</h2>
<ul>
<li>This quiz has 20 questions – 19 multiple choice questions &amp; 1 text answer question</li>
<li>Each multiple choice question has only one possible answer</li>
<li>This Quiz Contest is targeted for freshers who have recently passed out of college.</li>
<li>The first five people who send accurate answers at the earliest are rewarded.</li>
<li>The winners would be mock interviewed by Sridhar Jammalamadaka on phone.</li>
<li>To send your answers, send an email to <a href="mailto:sridhar@interviewmantra.net">sridhar@interviewmantra.net</a> in the format 1)A, 2)B, 3)C ……. 19)B, 20) (text answer)</li>
<li>Winners will be intimated via email and results will be announced on <a href="../">www.interviewmantra.net</a></li>
<li>If you want an offline copy of the quiz questions, click on Download PDF icon below.</li>
</ul>
<p><a href="http://www.interviewmantra.net/2009/11/beat-nervousness-job-interviews.html">Mock interview</a> is one of the best ways to prepare for an actual job interview. Mock interviews help you to find out how well you can fare in a real job interview. Mock interviews help you to boost your confidence and give a smooth performance at the real interview.</p>
<p>Your time starts now!!!!</p>
<h2>This contest is closed now. <a href="http://www.interviewmantra.net/2011/09/winners-of-c-quiz-contest-and-key.html">Winners Announced</a>.</h2>
<p><a href="http://www.interviewmantra.net/wp-content/uploads/2011/09/C-Quiz-challenge.pdf"><img class="alignnone size-full wp-image-1889" title="Download C Quiz as PDF" src="http://www.interviewmantra.net/wp-content/uploads/2011/09/Quiz.png" alt="Download C Quiz as PDF" width="55" height="55" />Download Quiz</a></p>
<p><a href="http://www.interviewmantra.net/wp-content/uploads/2011/09/interviewmantra-Key.pdf"><img class="size-full wp-image-1885 alignnone" title="Download Key for C Quiz Contest" src="http://www.interviewmantra.net/wp-content/uploads/2011/09/images.jpg" alt="Download Key for C Quiz Contest" width="55" height="55" />Download Key</a></p>
<h2>Questions</h2>
<p><strong>1)            The correct order of compilation of a C program is</strong></p>
<p>i) Compile source code to object code<br />
ii) Link object code and libraries<br />
iii) Create binary or executable file<br />
iv) Process Preprocessor directives</p>
<p>A)     i → ii → iii → iv<br />
B)      iv →  i → ii  → iii<br />
C)      i → iv → ii →  iii</p>
<p><strong>2)            Which of the following data type can be used for storing a floating point constant?</strong></p>
<p>A)     long int<br />
B)     double<br />
C)     unsigned char</p>
<p><strong>3)            What is the result of running the following code snippet?</strong></p>
<pre class="brush: cpp; title: ; notranslate">
float result;
result = 5/2;
printf(&quot;%.1f&quot;,result);
</pre>
<p>A)     2.0<br />
B)     2.5<br />
C)     0</p>
<p><strong>4)            What is the result of running the following code snippet</strong></p>
<pre class="brush: cpp; title: ; notranslate">
if(0)
printf(&quot;The Sun rises in the East&quot;);
else
printf(&quot;The Sun rises in the West&quot;);
</pre>
<p>A)     The Sun rises in the East<br />
B)     The Sun rises in the West<br />
C)     Compilation Error</p>
<p><strong>5)            What is the value of variable ‘<em>i’</em> after running the following statements?</strong></p>
<pre class="brush: cpp; title: ; notranslate">
int i = 10;
i = i / 2;
i = i % 2;
</pre>
<p>A)     0<br />
B)     1<br />
C)     2</p>
<p><strong>6)            The purpose of the function <em>int toupper (int c) </em>as<em> </em>defined in ctype.h is to </strong></p>
<p>A)     Convert the input string stored in variable <strong><em>c</em></strong> to upper case<br />
B)     Convert the input character stored in variable <strong><em>c</em></strong> to upper case<br />
C)     None of the above</p>
<p><strong>7)            The difference between the user defined constants ‘Z’ and “Z” is</strong></p>
<p>A)      ‘Z’ is a string constant whereas “Z” is a character constant<br />
B)      ‘Z’ is a character constant whereas “Z” is a string constant<br />
C)      There is no difference</p>
<p><strong>8)            Output of running the following code snippet is</strong></p>
<pre class="brush: cpp; title: ; notranslate">
int i;
for ( i = 0; i &lt; 3; i++ )
{
if(i == 2)
{
printf(&quot;%d\t&quot;,i);
}
}
</pre>
<p>A)     0              1              2              3<br />
B)     0              1              2<br />
C)     2</p>
<p><strong>9)            The conversion character for printing an integer in hexadecimal number using <em>printf</em> is</strong></p>
<p>A)     %x<br />
B)     %d<br />
C)     %o</p>
<p><strong>10)          Output of following code snippet</strong></p>
<pre class="brush: cpp; title: ; notranslate">
float marks[10] = {53,66,36,36,53,23,64,12,53,88};
float *marksPtr = marks;
marksPtr = marksPtr + 4;
printf(&quot;%.0f&quot;, *marksPtr);
</pre>
<p>A)     0<br />
B)     53<br />
C)     36<br />
D)     Garbage value</p>
<p><strong>11)          Which of the following is the correct way to allocate space for an array of 15 float variables?</strong></p>
<p>A)     float  *floatArray = (float *)  malloc ( 15 );<br />
B)     float  floatArray = (float *)  malloc ( 15 );<br />
C)     float  *floatArray = (float *)  malloc ( 15 * sizeof(float) );<br />
D)     float  *floatArray =  15 * malloc (sizeof(float) );</p>
<p><strong>12)          The following C statement causes an infinite loop (true/false):</strong></p>
<pre class="brush: cpp; title: ; notranslate">while (1);</pre>
<p>A)     true<br />
B)     false</p>
<p><strong>13)          Output of the following code snippet is:</strong></p>
<pre class="brush: cpp; title: ; notranslate">
int array[] = {1,2,3,4,5};
printf(&quot;%d&quot;, array[5]);
</pre>
<p>A)     0<br />
B)      4<br />
C)      5<br />
D)     Garbage value</p>
<p><strong>14)          Output of following statement is:</strong></p>
<pre class="brush: cpp; title: ; notranslate">
#define NUM 5
int main()
{
NUM++;
printf(&quot;%d&quot;, NUM);
return 0;
}
</pre>
<p>A)     5<br />
B)     6<br />
C)     Compilation error</p>
<p><strong>15)          Output of the following statement is</strong></p>
<pre class="brush: cpp; title: ; notranslate">
int i = 5;
if(i = 5)
{
puts(&quot;Structured programming language&quot;);
}
else
{
puts(&quot;Object oriented programming language&quot;);
}
</pre>
<p>A)     Structured programming language<br />
B)     Object oriented programming language<br />
C)     Compilation error</p>
<p><strong>16)          Which of the following is a true statement?</strong></p>
<p>A)     Strings in C are char arrays terminated by ‘\0’<br />
B)     Strings in C are char arrays terminated by NULL<br />
C)     Strings in C are char arrays terminated by EOF</p>
<p><strong>17)          Which of the following is a NOT a true statement?</strong></p>
<p>A)     The base address of an array is same as the name of the array<br />
B)     The base address of an array is address of the first element in the array<br />
C)     The base address of a static array can be modified</p>
<p><strong>18)          Which of the following is true about break statement in C?</strong></p>
<p>A)     break statement exits out of the innermost loop nested around it<br />
B)     break statement exits out of all the outer loops nested around it<br />
C)     break statement skips one iteration and continues looping</p>
<p><strong>19)          Output of the following program is:</strong></p>
<pre class="brush: cpp; title: ; notranslate">
int main()
{
int i =0;
modify(i);
printf(&quot;%d&quot;, i );
return 0;
}

int modify(int z)
{
return (++z);
}
</pre>
<p>A)     0<br />
B)      1</p>
<p><strong>20)          Point out at least two errors in the following code snippet</strong></p>
<pre class="brush: cpp; title: ; notranslate">
float a;
scanf(&quot;Enter number: %f&quot;, a );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2011/09/c-quiz-challenge-prize-for-fastest-correct-response.html/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Why should I hire you? &#8212; Frequently asked interview question</title>
		<link>http://www.interviewmantra.net/2011/08/why-should-i-hire-you.html</link>
		<comments>http://www.interviewmantra.net/2011/08/why-should-i-hire-you.html#comments</comments>
		<pubDate>Fri, 26 Aug 2011 14:00:00 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[HR]]></category>
		<category><![CDATA[Interview Questions]]></category>
		<category><![CDATA[Interview Tips]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/2009/10/new-tips-to-tackle-the-question-why-should-i-hire-you/</guid>
		<description><![CDATA[Here is a tricky Interview question that is asked in almost every interview: &#8220;Why should I hire you?&#8221; The trouble with this question is that this is a trap. The interviewer evaluates your attitude and self confidence while simultaneously evaluating your honesty and spontaneity. If you are not prepared with this question prior to the [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Here is a tricky Interview question that is asked in almost every interview: <strong>&#8220;Why should I hire you?&#8221;</strong></p>
<p>The trouble with this question is that this is a trap. The interviewer evaluates your attitude and self confidence while simultaneously evaluating your honesty and spontaneity.</p>
<p>If you are not prepared with this question prior to the interview, and lack spontaneity, you are in a big trouble. You could end up giving a plain salted bloated answer such as, &#8220;Er, Em, I think I should be selected, well&#8230; because&#8230;. I am a really good programmer. Because, em&#8230;. I can code really well.&#8221;<span id="more-322"></span></p>
<p>If you over-prepared for this question, you may end up giving an impressive sounding answer that was probably already given by other applicants. The employer may conclude that you are not honest and are not good at spontaneous answers.</p>
<p>So, what qualifies to be a perfect answer for this question? What kind of answer may impress an employer who is bored of listening to the repetitive flowery answers borrowed from the internet and books?</p>
<p>Brian Kruegar with <a href="http://www.collegegrad.com/">collegegrad.com</a> has a good piece of advice to offer for tackling this tricky question. Check out this <a href="http://www.youtube.com/watch?v=deuYRMIkG-c">youtube video</a>.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/deuYRMIkG-c&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x234900&amp;color2=0x4e9e00" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/deuYRMIkG-c&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x234900&amp;color2=0x4e9e00" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2011/08/why-should-i-hire-you.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write “career objective” for your resume</title>
		<link>http://www.interviewmantra.net/2011/02/how-to-write-career-objective-for-your-resume.html</link>
		<comments>http://www.interviewmantra.net/2011/02/how-to-write-career-objective-for-your-resume.html#comments</comments>
		<pubDate>Mon, 14 Feb 2011 02:00:35 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[HR]]></category>
		<category><![CDATA[Interview Tips]]></category>
		<category><![CDATA[Resume Tips]]></category>
		<category><![CDATA[Freshers]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=1595</guid>
		<description><![CDATA[Interviewers use the Career Objective section as a an ice breaker to start conversation with the candidate. It is the first thing that an interviewer notices when he scans your resume. As a first question in the interview, you are likely to be asked to explain your career objective. You are expected to give an [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Interviewers use the <strong>Career Objective</strong> section as a an ice breaker to start conversation with the candidate. It is the first thing that an interviewer notices when he scans your resume. As a first question in the interview, you are likely to be asked to explain your career objective. You are expected to give an answer convincing the interviewer that you have a serious plan for your professional life. If you fail to explain career objective in your resume, your rejection chances increase manifold.</p>
<p>From your answer, the interviewer tries to get a mental picture about you, as a future professional. The interviewer tries to understand: what is this candidate’s attitude towards work? Is she ambitious? Is she passionate? Does she have work ethic, or does she care for nothing than money?</p>
<p>Here are some points to keep in mind while writing career objective:</p>
<ul>
<li>Keep      it simple. A good career objective doesn’t mean usage of flowery words.</li>
<li>Write      about your dream job environment. What would you do when you are given an      offer to work for a dream company, to work in your favorite technologies?</li>
<li>Any spelling mistake or grammatical mistake or formatting mistake there would give him a really bad impression about you.</li>
<li>Try      not to copy career objective from other resumes. Be original, write your      own. Come on, can’t you write a single line in English describing “Your”      career objective??!!</li>
</ul>
<p>I do understand that if you have never written career objective yourself before, it seems pretty difficult to write it. Remember, it is a simple briefing of what you want from your work life.</p>
<p>Here are some questions that you could use to construct your career objective:</p>
<ul>
<li>How do      you want to work? Do you want to work hard or do you want to work with      passion or do you want to work for making a difference?</li>
<li>What      do you want to achieve in your professional life? Do you want to become an      expert in a technical field or do you want to grow as a professional or do you want to innovate something?</li>
<li>What      type of work environment are you looking forward for? Do you want to work      in a place where you are given space to be creative or do you want to work      in a company with preset standards?</li>
<li>Which      role do you want to work for? What role are you aiming to reach in the      near future?</li>
</ul>
<p>Here are a couple of good examples for career objective:</p>
<ul>
<li>To      become a web 2.0 expert</li>
<li>To      give my best to my employer organization</li>
<li>To apply      and enhance the technical skills I learnt in college in a corporate      application</li>
<li>To      work for a multi national company and climb the corporate ladder to the      highest position possible</li>
</ul>
<p>I just got reminded of an incident. A friend of mine had written his career objective as “To become a successful professional”. The first question he was put by the interviewer was, “What is success according to you?”</p>
<p>My friend had a tough time convincing the interviewer about what success means to him.</p>
<p>So, understand that career objective leads to various questions and be prepared for it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2011/02/how-to-write-career-objective-for-your-resume.html/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>3 Qualities that recruiters look for in freshers</title>
		<link>http://www.interviewmantra.net/2010/07/3-qualities-that-recruiters-look-for-in-freshers.html</link>
		<comments>http://www.interviewmantra.net/2010/07/3-qualities-that-recruiters-look-for-in-freshers.html#comments</comments>
		<pubDate>Wed, 28 Jul 2010 14:00:28 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[HR]]></category>
		<category><![CDATA[Interview Tips]]></category>
		<category><![CDATA[Freshers]]></category>
		<category><![CDATA[placement]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=1406</guid>
		<description><![CDATA[Are you a fresher curious to know the psychology of a recruiter? Read on. The recruiter&#8217;s aim in taking an interview is to filter candidates and choose the best fit candidates that are beneficial to the company. To choose from, there are thousands of freshers holding the same degree, falling in a common range of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Are you a fresher curious to know the psychology of a recruiter? Read on.</p>
<p>The recruiter&#8217;s aim in taking an interview is to filter candidates and choose the best fit candidates that are beneficial to the company.</p>
<p>To choose from, there are thousands of freshers holding the same degree, falling in a common range of academic score of 60-75% from all over the country.</p>
<p>How would a recruiter differentiate between one candidate and another? After all, the job applicants to an entry level position are fresh college pass-outs with no industrial experience.</p>
<p>How would a recruiter discern good candidate from a large crowd of students?</p>
<p>I had asked this question to couple of experienced recruiters. All of them consensually told that they looked for the following three qualities in students.</p>
<h2>
<ol>
<li>Fluent at Communication</li>
<li>​​​Reasonably good at Aptitude</li>
<li>Ability to apply logic in real life</li>
</ol>
</h2>
<p>Fluent communication in a team is an important pre-requisite   for any employee. In many occasions employees would have to directly talk to the clients of the company. So, fluency in English communication is a key skill.</p>
<p>The Aptitude of the candidate is analyzed by recruiters by asking questions from competitive tests such as CAT, GRE, etc. Aptitude could be broadly divided into two sub-categories – Qualitative aptitude and Quantitative aptitude; the R.S Agarwal kind of questions.</p>
<p>Good at theory doesn&#8217;t mean good at practical. Recruiters know that very well. In their experience, they might have seen many freshers who were selected based on their theoretical knowledge, who later fail badly in putting theory to practice. Interviewers are going to present you real life scenarios and would ask you to suggest a solution.</p>
<p>For example, a recruiter could ask an electronics engineer to design an electronic device that could dynamically change the duration of traffic lights based on the traffic.</p>
<p>The interviewer could ask a computer science graduate to design a simple database for maintaining personal, salary and project information of employees in a company.</p>
<p>So, if you are a <a href="http://www.interviewmantra.net/2010/07/the-first-step-in-job-search-for-freshers.html">fresher trying for jobs</a>, keep these three points in mind and be sure to prove the interviewer that you possess these qualities. If you succeed, the job is yours!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2010/07/3-qualities-that-recruiters-look-for-in-freshers.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tata Technologies Looking for C/C++/Java programmers</title>
		<link>http://www.interviewmantra.net/2010/06/tata-technologies-c-cpp-java-programmers.html</link>
		<comments>http://www.interviewmantra.net/2010/06/tata-technologies-c-cpp-java-programmers.html#comments</comments>
		<pubDate>Fri, 04 Jun 2010 13:05:04 +0000</pubDate>
		<dc:creator>guest</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Job Search Tips]]></category>
		<category><![CDATA[IT]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=1285</guid>
		<description><![CDATA[Tata Technologies Ltd. is hiring 40 professionals for Pune Location.  Headquartered in Singapore,   Tata Technologies Limited is a leader in engineering services outsourcing with over 4,000 highly skilled employees. Do you meet the following criteria? If yes, send your resume asap to sridhar@interviewmantra.net Possess 2 to 5 years of IT Experience. Education &#8211; BE [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://www.tatatechnologies.com/">Tata Technologies Ltd.</a> is hiring 40 professionals for Pune Location.  Headquartered in Singapore,   Tata Technologies Limited is a leader in engineering services outsourcing with over  4,000 highly skilled employees.</p>
<p>Do you meet the following criteria? If yes, send your resume asap to <a href="mailto:sridhar@interviewmantra.net?subject=Job Application for Tata Technologies">sridhar@interviewmantra.net</a></p>
<ul>
<li>Possess 2 to 5 years of IT Experience.</li>
<li>Education &#8211; BE or MCA.</li>
<li>Programming experience  in <strong>C/C++/</strong><strong> Java</strong> (Swings, Servlets, JSP, strong OO skills).</li>
<li>Knowledge of Teamcenter  ITK programming is a huge advantage.</li>
<p><a href="mailto:sridhar@interviewmantra.net?subject=Job Application for Tata Technologies"><img title="Apply Job" src="http://www.interviewmantra.net/wp-content/uploads/2010/06/apply_now.jpg" alt="" width="50" height="50" /></a>
</ul>
<p><em>Note that this requirement is for Indian National only. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2010/06/tata-technologies-c-cpp-java-programmers.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HR Interview Questions — Categorized</title>
		<link>http://www.interviewmantra.net/2010/04/hr-interview-questions-categorized-pdf.html</link>
		<comments>http://www.interviewmantra.net/2010/04/hr-interview-questions-categorized-pdf.html#comments</comments>
		<pubDate>Sun, 18 Apr 2010 04:00:05 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[HR]]></category>
		<category><![CDATA[Interview Questions]]></category>
		<category><![CDATA[Download eBook]]></category>
		<category><![CDATA[hr]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=990</guid>
		<description><![CDATA[This post categorizes the frequently asked questions in HR interviews. You can save these questions for later review by downloading the pdf of HR interview questions. HR Questions: Stability at work How long would you expect to work for us if hired? What are your career options right now? What will this job give that [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>This post categorizes the frequently asked questions in HR interviews. You can save these questions for later review by downloading the <a href="http://www.interviewmantra.net/wp-content/uploads/2010/04/HR-interview-questions.pdf">pdf of HR interview questions</a>.</p>
<h1>HR Questions:</h1>
<h2>Stability at work</h2>
<ol>
<li>How long would you expect to work for us if hired?</li>
<li>What are your career options right now?</li>
<li>What will this job give that your previous job doesn&#8217;t?</li>
<li>What is the profile that you are looking for, how will this 	company  give you while previous doesn&#8217;t?</li>
<li>Why are you leaving your current position? (Or) Why are you 	looking  for a job change?  (Or) What is the reason you are leaving 	previous  organization?</li>
<li>If another company offers you better salary than 	us, what will be  your reaction?</li>
<li>Where do you see yourself 5 years from now? (Or) What are 	your  short term goals?</li>
</ol>
<h2>Work ethic questions</h2>
<ol>
<li>What is more important to you: the money or the work?</li>
<li>If you won $10 million in lottery, would you still work?</li>
<li>Tell me about a time when you were accountable for a mistake 	you  made. Did you take responsibility for the mistake?</li>
<li>Describe your work ethic.</li>
<li>What is your philosophy towards work?</li>
<li>Are you willing to put the interests of the organization ahead of  your own?</li>
</ol>
<h2>Personality test questions</h2>
<ol>
<li>What are your greatest strengths?</li>
<li>What would your previous supervisor say your strongest point is?</li>
<li>What are your greatest weaknesses?</li>
<li>Do you have any blind spots?</li>
<li>What do your co-workers say about you?</li>
<li>Tell me about a situation when your work was criticized? (Or) 	How  do you handle criticism?</li>
<li>What makes you angry at work?</li>
<li>Do you get angry with your team mates if they don&#8217;t 	cooperate?</li>
<li>What irritates you about co-workers?</li>
<li>Tell me about a time when you helped resolve a dispute between  fellow team mates.</li>
<li>Tell me about the most fun you have had on the job.</li>
<li>Tell me honestly about your boss&#8217;s strengths and weaknesses.</li>
<li>Tell me about a problem you had with a supervisor.</li>
<li>Do you prefer to work alone or do you work better in groups?</li>
<li>Looking back, what would you differently in your life?</li>
<li>What was the toughest decision in your life you ever had to 	made?</li>
<li>What are your professional goals?</li>
<li>What have you done to improve your knowledge in the last year?</li>
<li>Do you consider yourself successful? Why?</li>
<li>Who has inspired you in life and why?</li>
</ol>
<h2>Compatibility Questions</h2>
<ol>
<li>Technically, what kind of work would you prefer?</li>
<li>Would you lie for the company?</li>
<li>Briefly describe an ideal position for you?</li>
<li>Describe your ideal company, location and job?</li>
<li>What kind of person would you refuse to work with?</li>
<li>Why do you want to join this industry?</li>
<li>What makes you the best candidate for this position?</li>
<li>What motivates you to do your best at work?</li>
<li>What was the toughest part of your last job?</li>
<li>What have you learned from mistakes on the job?</li>
<li>What has disappointed you about a job?</li>
<li>What do you expect from this organization?</li>
<li>What has been your biggest professional disappointment?</li>
<li>What position do you prefer on a team working on a project?</li>
<li>How do you propose to compensate for your lack of experience?</li>
<li>Do you think you are overqualified for this position?</li>
<li>Would you be willing to relocate if required?</li>
<li>Are you willing to work overtime? Nights? Weekends?</li>
</ol>
<h2>Communication skills</h2>
<ol>
<li>Tell me about your hobbies and pastimes?</li>
<li>Which is the most unforgettable moment in your life?</li>
<li>How do you overcome stress at work?</li>
<li>What according to you, are the skills required to be 	successful in  IT industry?</li>
<li>If you were hiring a person for this job, what would you look for?</li>
<li>Why should I hire you? (Or) Why do you think you are the best 	 candidate?</li>
<li>Explain how you would be an asset to this organization.</li>
<li>Can you describe your previous company&#8217;s work culture?</li>
</ol>
<h2>Ego Questions</h2>
<ol>
<li>What is the main role of a HR in an organization?</li>
<li>Why do you want to work for this organization?</li>
<li>What do you know about this organization?</li>
<li>Can you list the clientèle of this organization?</li>
<li>On a scale of 10, rate me as an interviewer.</li>
</ol>
<h2>Salary Negotiation Questions</h2>
<ol>
<li>The Salary question – How much do you want?</li>
<li>What kind of salary do you need?</li>
</ol>
<h2>Tacit Questions</h2>
<ol>
<li>Is the candidate over qualified for this position?</li>
<li>Will this candidate be satisfied with the profile and nature 	of  work offered to him?</li>
<li>If I offer a job, is there a chance this person will quit and 	start  his own business?</li>
<li>Is this person too outspoken or too reticent?</li>
<li>The company where candidate is currently working seems to be 	an  unpopular brand. Will this hire affect my company&#8217;s brand image?</li>
<li>Will this person be able to pick up the work assigned to him?</li>
<li>Is this person lacking any basic skills or manners?</li>
<li>Is there anything that this candidate is trying to hide from 	us?</li>
</ol>
<h2>Background check questions</h2>
<ol>
<li>Tell me about yourself.</li>
<li>Questions  related to passport and 	visa.</li>
<li>Questions related to previous 	 month Salary slips.</li>
</ol>
<h2>Rationale behind asking these questions</h2>
<p><strong>Stability at Work</strong> The reason why the employee is  quitting  current job is of utmost  importance for HR managers. They  want to know  why exactly the employee  was motivated to quit the  current job. They  want to make sure that the  employee doesn&#8217;t decide  to quit the company  before working for an year  or two. So this  category of questions are  indirect ways of asking the  question, “How  long will you stay with us  after hiring you?”</p>
<p><strong>Work ethic questions</strong> are asked to check the whether the   candidates posses values such as Loyalty to  the company, reliability   and accountability at work. Is work just another menial task that   fetches you money or do you enjoy your work? Is money your only priority   at work place?</p>
<p><strong>Ego Questions</strong>. In interviews, some HRs  ask a few irrelevant  questions such as “What is the role and importance  of HR Manager in an  organization?”, to make themselves feel important  and to satisfy their  ego. Other questions that fall in this category  are those that ask about  their employer organization such as “What do  you know about this  company?”, “Why would you like to join this  company”, to make themselves  feel better from inside for working for  that company. You should try to  exaggerate and lift the interviewer&#8217;s  ego by answering in a boasting  and optimistic manner.</p>
<p><strong>Communication  skills</strong>. There are some questions that have no  relation to the job  position being offered, sometimes these questions  are personal. They go  something like “whom do you like more your mother  or father and why?&#8221;  Such questions are asked to get the candidate  talking, to determine how  good their speaking, persuasion and  presentation skills are. These  questions are especially important for  the job positions that involve  communication with customers.</p>
<p><strong>Compatibility questions</strong> are  asked by HRs to confirm if the  candidate is a good fit into the  corporate culture. For example, if the  job requires the candidate to  work in night shifts, and the candidate  doesn&#8217;t have prior experience  working in a night shift, this might  become potential problem for the  candidate in future which may result in  employee&#8217;s frustration and  eventually resignation from that job.</p>
<p><strong>Personality  test questions </strong>is a category of interview  questions which includes  all the questions that the interviewer asks to  know about the  candidate&#8217;s strengths &amp; weaknesses, personal vision  &amp; goals,  values  , attitude towards work, people and organization.  How good a  candidate is who has no clarity about his/her professional  goals? How  good is a candidate who has problems working smoothly with  people?</p>
<p><strong>Aptitude  questions</strong> are being asked by the interviewers to  determine the  smartness of the candidate. Since HR managers&#8217; job role is  often  disconnected with technical stuff, they don&#8217;t and can&#8217;t ask  technical  questions to the interview candidate. They test people by  asking  puzzles or role play questions. Puzzles in general, because they   indicate to certain extent, the problem solving ability of an   individual. Role play questions are asked to check how you behave in a   particular scenario that they are familiar with. For example, the hiring   manager may ask you to pretend to be receiving a call from an angry   customer and you are supposed to pacify him by assuring him that his   issue would be looked into immediately.</p>
<p><strong>Salary negotiation  questions</strong> are of utmost importance for the  candidates who appear  for the interview. 90% of time, the reason for job  change is for a  better pay check. So the candidate is most eager to  answer these  questions. From HR perspective, these questions are asked  to find out  whether the company can match the financial requirements of  the job  candidate.</p>
<p><strong>Tacit questions</strong> are the most dangerous of all  these categories  of interview questions. They are usually the unspoken  concerns of the  interviewer that lead to rejection of candidates. They  are also few of  the most frequent causes for a job rejection.</p>
<p><strong>Background  check questions</strong> are being asked to avoid hiring the   spurious  professionals, to check misrepresentation of facts, to check   whether  the candidate is not faking any details on his resume – such as   fake  degree or fake experience or fake salary slips etc. And in some    places, where there are region specific things to ensure that the    candidate legally qualifies to be hired. Issues such as citizenship,    visa status etc.</p>
<p>HR interview questions can be broadly classified into the following categories.</p>
<h2>HR Question Categories:</h2>
<ul>
<li>Stability at work</li>
<li>Work ethic test questions
<ul>
<li>Loyalty</li>
<li>Ownership</li>
<li>Dedication</li>
<li>Money mindedness</li>
</ul>
</li>
<li>Personality test questions
<ul>
<li>Strengths and Weaknesses</li>
<li>Honesty</li>
<li>Personal vision &amp; values</li>
<li>Attitude towards work</li>
<li>Attitude towards people</li>
<li>Attitude towards organization</li>
</ul>
</li>
<li>Compatibility Questions
<ul>
<li>Compatibility with company 		culture</li>
<li>Compatibility with job 		role or project</li>
</ul>
</li>
<li>Aptitude questions
<ul>
<li>Puzzles</li>
<li>Case studies</li>
</ul>
</li>
<li>Communication skills
<ul>
<li>Speaking skills</li>
<li>Presentation skills</li>
<li>Persuasive skills</li>
<li>Customer handling skills</li>
</ul>
</li>
<li>Ego questions
<ul>
<li>Praise the HR</li>
<li>Praise the Company</li>
</ul>
</li>
<li>Salary Negotiation Questions</li>
<li>Tacit Questions</li>
<li>Background check questions
<ul>
<li>Check previous work history</li>
<li>Check authenticity of work 		experience</li>
<li>Clarify other region-specific 		issues</li>
</ul>
</li>
</ul>
<p>Human Resource Managers have simple concerns on behalf their employer  organization. Their interviews are usually much easier to generalize  than the technical ones. That&#8217;s because HR managers have very simple  objectives &#8212; they want to check whether the candidate is loyal, honest,  convincing, smart and sane. In simple words, a HR manager wants to  avoid a bad hire. From their previous experiences, they knows what kind  of people they don&#8217;t want to hire.</p>
<p>Hiring new candidates is very responsible task for the Hiring  Managers and Human Resource Managers. Their decision whether to hire or  not to hire a candidate, can add value to the company, shape its future,  bring new energy and enthusiasm to the existing work force.</p>
<p>A bad hire can prove very expensive to the company. If the candidate  that they hire is not capable enough to perform his/her daily activities  at work, the team for which he/she works will have to suffer working  with that non-performing resource until new hiring takes place. At  times, it gets very difficult for the companies to fire people based on  employee&#8217;s poor performance, owing to many factors such as the company  policies, loss of morale among the fellow employees, etc.</p>
<p>Even though the company takes a bold step to fire the unwanted  resource, replacing this poorly performing resource is tough, as fresh  hiring means additional costs to the company and wastage of time of the  hiring managers for conducting interviews. Not only that, the hiring  managers would be held accountable for the bad hire that took place.  Which could mean that if the hiring managers do a bad hire, they may  lose their reputation among their superiors which may lead to a bad  performance review in their annual appraisal.</p>
<p>To avoid all these complications, a responsible hiring manager asks  himself/herself the following questions before confirming a candidate  with an job offer.</p>
<ul>
<li>Is this person authentic?</li>
<li>Will this person work for the 	company at least for the next few  years?</li>
<li>Will the company be able to 	recover the costs incurred to him by  the company?</li>
<li>Does this person have ethics at 	work?</li>
<li>Is this person sane?</li>
<li>Does this person fit into our 	company culture?</li>
<li>Is this person smart?</li>
<li>Can this person speak well?</li>
<li>Why should I care to hire this 	person?</li>
<li>Can we financially afford to hire 	this person?</li>
<li>Do we have any concerns related to 	this person&#8217;s profile?</li>
</ul>
<h2>References:</h2>
<ul>
<blockquote>
<li><a href="http://www.interviewmantra.net/2009/12/would-you-hire-samuel.html">HR question &amp; answers</a></li>
<li><a href="http://www.techpreparation.com/64-hr-interview-questions-answers1.htm">Techpreparation.com</a></li>
<li><a href="http://www.coolinterview.com/type.asp?iType=177">Coolinterview.com</a></li>
</blockquote>
</ul>
<h2><a href="http://www.interviewmantra.net/wp-content/uploads/2010/04/HR-interview-questions.pdf">Download HR questions in this article as PDF</a></h2>
<p><em>Comment , if you would like to add a question to this list. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2010/04/hr-interview-questions-categorized-pdf.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C++ Hard Interview Questions – part2</title>
		<link>http://www.interviewmantra.net/2010/04/cpp-hard-interview-questions-part2.html</link>
		<comments>http://www.interviewmantra.net/2010/04/cpp-hard-interview-questions-part2.html#comments</comments>
		<pubDate>Wed, 14 Apr 2010 12:00:57 +0000</pubDate>
		<dc:creator>Saurabh Manchanda</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Interview Questions]]></category>
		<category><![CDATA[c++ interview questions]]></category>
		<category><![CDATA[cpp interview questions]]></category>
		<category><![CDATA[RAII]]></category>
		<category><![CDATA[RTTI]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=899</guid>
		<description><![CDATA[In websites such as coolinterview.com, geekinterview.com, you will find plethora of technical interview questions. But all the questions there are posted and answered by the users. You might have found that some questions mentioned there are of any use. Also you will most of the answers not much reliable. We at interviewmantra, extensively research for [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>In websites such as <a href="http://www.coolinterview.com">coolinterview.com</a>, <a href="http://www.geekinterview.com">geekinterview.com</a>, you will find plethora of technical interview questions. But all the questions there are posted and answered by the users. You might have found that some questions mentioned there are of any use. Also you will most of the answers not much reliable. We at interviewmantra, extensively research for good interview questions, categorize them according to difficulty, answer each of them in detail, make sure that the answers are correct to the best of our knowledge. Here is the last 5 questions in <a href="http://www.interviewmantra.net/tag/c-interview-questions">this series of C++ interview questions</a>. Hope these are of use to you for interview preparation. </p>
<h3>6. What&#8217;s the knack with vector&lt;bool&gt;?</h3>
<p>The std::vector&lt;bool&gt; is a specialization of the std::vector&lt;&gt; class template, i.e., when an object of vector&lt;bool&gt; is created, it uses a specialized and highly optimized version of the vector&lt;&gt; template, instead of instantiating the template for the bool type. The vector&lt;bool&gt; stores boolean data as bits and not as bool variables (which could take a whole byte to store a single true or a false).</p>
<p>The vector&lt;bool&gt;  is optimized on space, rather than on speed, unlike the vector&lt;&gt; template. Moreover, this optimization has been forced upon the users because of the specialization. Also, the vector&lt;bool&gt; items are not addressable and the specialization defines the iterator in a form different than that of vector&lt;&gt; which is not random-access. For more info, check <a href="http://www.informit.com/guides/content.aspx?g=cplusplus&amp;seqNum=98" target="_blank">here</a></p>
<h3>7. What is the difference between assignment operator and a copy constructor?</h3>
<p>As the names suggest, the copy constructor is used to &#8220;construct an object&#8221;. The new object is an exact copy of another object that is already constructed. The assignment operator is used to &#8220;assign an object&#8221; with the value(s) of some other object. Hence, the assignment operator is something that comes into action when we have an object to the LHS of the &#8216;=&#8217; operator and some expression to the RHS.</p>
<p><strong>For Example:</strong><br />
For some type T and &#8220;params&#8221; for the object&#8217;s constructor,</p>
<pre class="brush: cpp; title: ; notranslate">{
   T x (params1, ...);
   T y (params2, ...);

   T z = x; /* Copy : z created with the value of x */
   y = x+z; /* Assignment : y gets the value equivalent to x+z */
}</pre>
<p>If a programmer doesn&#8217;t write a copy constructor or an assignment operator, then the compiler provides one. The copy constructor provided by the compiler does a <a href="http://www.interviewmantra.net/2010/02/cpp-hard-interview-questions-part1.html#copy" target="_blank">shallow-copy</a> of the objects and, hence, could lead to problems. And, when the programmer overloads the assignment operator for a particular class, s/he must take care of <a href="http://www.interviewmantra.net/2010/02/cpp-hard-interview-questions-part1.html#Self" target="_blank">self-assignment</a> and free the resources before the assignment is done.</p>
<h3>8. Why we would use exception handling rather than different return values to signal an error?</h3>
<p>The probability of a program failing is never zero and, when when such conditions arise, different steps shall be taken. Two options are &#8211; Returning an Error code and using Exception Handling.<br />
Returning an error-code is fine but has some problems associated with it:</p>
<ol>
<li>The error-code returned is generally of type &#8220;int&#8221;. The problem here is that if certain integer values are associated with error-codes, then the function would have to exclude those from the valid return values, which isn&#8217;t feasible in all situations.</li>
<li>Even if the above is feasible, the code would require code to check the return value for each call and this would cause code bloat.</li>
<li>Some error codes are used to signal that the system is in non-recoverable state and needs to exit. This might not be a good thing to be done at all times, for example, if the code that generates the error and terminates the program is part of a library and is being run as a part of a system that can&#8217;t be terminated.</li>
</ol>
<p>The above problems are not seen while using Exception handling because it separates the error-handling code from the program logic. This also makes the code clean and readable.</p>
<h3>9. What is RAII?</h3>
<p>Resource Acquisition Is Initialization or RAII is a design pattern that helps in creating objects, on the heap, that are safely destructed. The RAII technique requires a wrapper to be used to hold the resource so that when the wrapper object goes out of scope or an exception is thrown, the resource is freed.</p>
<p><strong>For Example:</strong></p>
<pre class="brush: cpp; title: ; notranslate">#include&lt;exception&gt;
#include&lt;iostream&gt;
#include&lt;string&gt;

struct someClass{};

class Wrap
{
   someClass* ptr;
public:
   Wrap() : ptr(0){}
   Wrap(someClass* obptr): ptr(obptr){}

   void setNull()
   {
      if(ptr)
         delete ptr;
      ptr=0;
   }

   void changeRsrc(someClass* obptr)
   {
      if(ptr)
         delete ptr;
      ptr=obptr;
   }

 someClass&amp; operator*()   { return *ptr;}
 someClass* operator-&gt;()  { return ptr;}
 ~Wrap(){ std::cout&lt;&lt;&quot;Destructor\n&quot;;delete ptr; ptr=0;}
};

void  Foo()
{
 /* someClass *somePtr = new someClass; */

 Wrap wObj(new someClass);
 /* Some Operations on someClass object using wObj */

 throw std::exception();
}

int main()
{
 try
 {
    Foo();
 }catch(std::exception&amp;){std::cout&lt;&lt;&quot;Exception caught\n&quot;;}
}</pre>
<p>Here, the class Wrap implements the RAII. When Foo() throws an exception, the wObj, being on the stack, invokes its destructor which frees the memory space taken up by the object of someClass. If the somePtr would have been used, then the space allocated by it would not have been freed.<br />
The <strong>auto_ptr</strong> is a class template, available in C++, that implements the RAII.</p>
<h3>10. What is RTTI? What are its uses?</h3>
<p>The RTTI or Run-Time Type Identification is a feature of C++ that helps in storing and retrieving type information of the objects at runtime. This information can be used for safely typecasting objects, and to fetch and utilize the type information to set the flow of the program at runtime.</p>
<p>The RTTI requires the classes in use to be <strong>&#8220;polymorphic&#8221;</strong> in nature, which means that there should be at least one virtual function defined in it. The system is used with the help of <strong>dynamic_cast&lt;&gt;</strong> and the <strong>typeid</strong> operator.</p>
<p>The typeid operator is available under the &#8220;typeinfo&#8221; header and can be used to find out the class to which a particular object belongs to, at runtime. The value returned by the operator is implementation-defined and hence, can be different across compilers. Thus, for portability sake, the operator can be used in the following manner:</p>
<pre class="brush: cpp; title: ; notranslate">#include&lt;iostream&gt;
#include&lt;typeinfo&gt;

struct dummyBase
{virtual ~dummyBase(){}};

struct dummyDer: dummyBase{};

void check(dummyBase* a)
{
   if(typeid(*a)==typeid(dummyBase))
      std::cout&lt;&lt;&quot;It is a dummyBase object\n&quot;;

   else if(typeid(*a)==typeid(dummyDer))
      std::cout&lt;&lt;&quot;It is a dummyDer object\n&quot;;
}

int main()
{
   dummyDer d;
   dummyBase b;
   dummyBase*ptr;

   ptr=&amp;d;
   check(ptr);

   ptr=&amp;b;
   check(ptr);
}</pre>
<p>If only the object information is required and no cast is to be done, then one must use the typeid operator and not the dynamic_cast because the former takes constant-time to return the value.</p>
<p>The dynamic_cast&lt;&gt; operator is what actually utilizes the RTTI system. The dynamic_cast&lt;&gt; is safe because if the cast is not possible, it sets the pointer to NULL instead of returning a bad pointer and in case of a reference, it throws the std::bad_cast exception. The cast knows about the hierarchy of the particular object that helps it do its work correctly and can be used to cast up, down or laterally.</p>
<p><strong>For Example:</strong></p>
<pre class="brush: cpp; title: ; notranslate">#include&lt;iostream&gt;

struct ITop
{
   virtual void funcTop()=0;
   virtual ~ITop(){}
};

struct ILeft: ITop
{
   void funcTop(){ std::cout&lt;&lt;&quot;ILeft funcTop\n&quot;;}
   virtual void funcLeft()=0;
};

struct IRight: ITop
{
   void funcTop(){ std::cout&lt;&lt;&quot;IRight funcTop\n&quot;;}
   virtual void funcRight()=0;
};

struct Left: ILeft
{
   void funcLeft(){ std::cout&lt;&lt;&quot;Left heir\n&quot;;}
};

struct Right: IRight
{
   void funcRight(){ std::cout&lt;&lt;&quot;Right heir\n&quot;;}
};

void Foo(ITop* elem)
{
   elem-&gt;funcTop();

   if(ILeft* ptrL = dynamic_cast&lt;ILeft*&gt;(elem))
      ptrL-&gt;funcLeft();
   else if(IRight* ptrR = dynamic_cast&lt;IRight*&gt;(elem))
      ptrR-&gt;funcRight();
}

int main()
{
   ITop* ptr[]={new Left, new Right};

   Foo(ptr[0]);
   Foo(ptr[1]);

   delete ptr[0];
   delete ptr[1];
}</pre>
<p>In the above code, the function Foo() checks the type of &#8216;elem&#8217; and finds out where does the object lie in the hierarchy and accordingly, invokes either the funcLeft() or the funcRight().</p>
<p><a href="http://www.objectmentor.com/resources/articles/acv.pdf">Here</a> is one good use of RTTI.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2010/04/cpp-hard-interview-questions-part2.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Core Java interview questions</title>
		<link>http://www.interviewmantra.net/2010/04/core-java-interview-questions.html</link>
		<comments>http://www.interviewmantra.net/2010/04/core-java-interview-questions.html#comments</comments>
		<pubDate>Sun, 11 Apr 2010 05:54:56 +0000</pubDate>
		<dc:creator>Sridhar Jammalamadaka</dc:creator>
				<category><![CDATA[Interview Questions]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.interviewmantra.net/?p=1143</guid>
		<description><![CDATA[Can you explain the OOPS concepts – Encapsulation, Abstraction, Inheritance and Polymorphism? How can you achieve Polymorphism using Java? What are access modifiers? What does the access modifier &#8216;protected&#8217; signify? What is the difference between an abstract class and an interface? Can you describe a business scenario where you will have to choose between an [...]]]></description>
			<content:encoded><![CDATA[<p></p><ol>
<li>Can you explain the OOPS concepts – Encapsulation, Abstraction, Inheritance and Polymorphism?</li>
<li>How can you achieve Polymorphism using Java?</li>
<li>What are access modifiers?</li>
<li>What does the access modifier &#8216;protected&#8217; signify?</li>
<li>What is the difference between an abstract class and an interface?</li>
<li>Can you describe a business scenario where you will have to choose between an abstract class and an interface?</li>
<li>What are Collections in Java?</li>
<li>Can you name few Collection classes in Java?</li>
<li>What is the difference between an ArrayList and a Vector?</li>
<li>What is the difference between HashMap and a HashTable?</li>
<li>What is the use of Properties class in Java?</li>
<li>Explain how to use Java class StringTokenizer</li>
<li>What is the difference between .equals and == operator?</li>
<li>Can we declare a try block with a finally block and without a catch?</li>
<li>How does the order of exceptions in catch block matter?</li>
<li>How to write a user defined Exception?</li>
<li>What is the difference between an Error and an Exception?</li>
</ol>
<p>These questions were compiled by <a href="http://rocksolutions.wordpress.com/">Rakesh Kumar Vashisht</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.interviewmantra.net/2010/04/core-java-interview-questions.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.interviewmantra.net @ 2012-02-05 14:49:01 -->
