<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"><id>tag:blogger.com,1999:blog-6675575305312958176</id><updated>2012-03-14T08:10:23.034-07:00</updated><category term="sameer-jagtap" /><category term="sameer jagtap" /><category term="samjik" /><title type="text">Programming-articles</title><subtitle type="html">All articles,notes,interview questions about various programming languages are provided here.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://sameer-programming-articles.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://sameer-programming-articles.blogspot.com/" /><author><name>Sameer</name><uri>http://www.blogger.com/profile/10730451471984312930</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/Programming-articles" /><feedburner:info uri="programming-articles" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>Programming-articles</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:browserFriendly></feedburner:browserFriendly><entry><id>tag:blogger.com,1999:blog-6675575305312958176.post-175703663742971088</id><published>2012-02-09T22:50:00.000-08:00</published><updated>2012-02-09T22:50:49.741-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sameer jagtap" /><title type="text">C,C++ programming questions asked in top IT/software companies</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: small; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px; color: #666362; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 20px;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span itemprop="summary"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Here in this article I have given some questions which are frequently asked in major or top IT companies. These are some of the questions of c and c++ which are mostly asked by the recruiters. prepare yourself with these questions.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;The difficulty level of these c, c++ programming questions which is given below is medium and you will not find much difficulty in solving the same. Many basic and fundamental questions are there to check your fundamentals stability and hold. Go through each and every questions in detail and ask me any doubt if you feel so. &lt;br /&gt;These &lt;b&gt;frequently asked question in technical rounds and technical interview of IT/Software companies&lt;/b&gt; have been prepared for the preparation of students who are going to attend the interviews.&lt;br /&gt;&lt;br /&gt;1. The virtual functions in C++ is analogous to _____ statements in C &lt;br /&gt;[ A ]  Switch&lt;br /&gt;[ B ]  Go to&lt;br /&gt;[ C ]  For&lt;br /&gt;[ D ]  While&lt;br /&gt;Answer : B &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;2. When the calling function calls called function, the function should have a &lt;br /&gt;[ A ]  Prototype&lt;br /&gt;[ B ]  Data member&lt;br /&gt;[ C ]  Object&lt;br /&gt;[ D ]  Static member&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;3. Constructors are used in C++ to &lt;br /&gt;[ A ]  Declare an object&lt;br /&gt;[ B ]  Initialize an object&lt;br /&gt;[ C ]  Destroy the object&lt;br /&gt;[ D ]  Modify the object&lt;br /&gt;Answer : B &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;4 .The default constructor can be called with &lt;br /&gt;[ A ]  Parameters&lt;br /&gt;[ B ]  No parameters&lt;br /&gt;[ C ]  Arguments&lt;br /&gt;[ D ]  Integers&lt;br /&gt;Answer : B &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;5. In the following program the function is defined as&lt;br /&gt;Void g()&lt;br /&gt;{&lt;br /&gt;Car a; &lt;br /&gt;Car b();&lt;br /&gt;} &lt;br /&gt;[ A ]  Function&lt;br /&gt;[ B ]  Object&lt;br /&gt;[ C ]  Class&lt;br /&gt;[ D ]  Variable&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;6. A function abc is defined as (Assume h, g are declared as integers)&lt;br /&gt;Void abc(int x = 0, int y = 0) { Printf ("%d, %d", x, y); } Which of the following function calls is/are legal? &lt;br /&gt;[ A ]  abc ();&lt;br /&gt;[ B ]  abc (h);&lt;br /&gt;[ C ]  abc (h, h);&lt;br /&gt;[ D ]  abc (h, g);&lt;br /&gt;Answer : D &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;7. Function prototyping means &lt;br /&gt;[ A ]  Checking if the function is declared before its use&lt;br /&gt;[ B ]  Checking of the function has a forward reference&lt;br /&gt;[ C ]  Checking of the function call confirms to the declaration in type and number&lt;br /&gt;[ D ]  Checking if the function has no reference&lt;br /&gt;Answer : C &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;8. By passing values to the called functions by reference using swap &lt;br /&gt;[ A ]  Changes are made by the passed parameters&lt;br /&gt;[ B ]  No changes are made by the passed parameters&lt;br /&gt;[ C ]  Exchanged their values by the parameters &lt;br /&gt;[ D ]  Values are not exchanged by the parameters&lt;br /&gt;Answer : C &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;9. Pass-by-value won't work in C++, of the destination type is &lt;br /&gt;[ A ]  Abstract base class&lt;br /&gt;[ B ]  Derived class&lt;br /&gt;[ C ]  Static class&lt;br /&gt;[ D ]  Extended class&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;10. The standard output stream object in C++ is &lt;br /&gt;[ A ]  Printf&lt;br /&gt;[ B ]  Cout&lt;br /&gt;[ C ]  Cin&lt;br /&gt;[ D ]  Println&lt;br /&gt;Answer : B &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;11. The standard input is in header file in C++ &lt;br /&gt;[ A ]  &lt;br /&gt;[ B ]  &amp;lt;# iostream.h&amp;gt;&lt;br /&gt;[ C ]  &lt;br /&gt;[ D ]  &lt;br /&gt;Answer : A&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;12. The global object is used by &lt;br /&gt;[ A ]  The entire program&lt;br /&gt;[ B ]  Only part of the program&lt;br /&gt;[ C ]  Not used by the program&lt;br /&gt;[ D ]  The functions&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;13. The use of the break statement in a switch statement is &lt;br /&gt;[ A ]  Optional&lt;br /&gt;[ B ]  Mandatory&lt;br /&gt;[ C ]  Not allowed&lt;br /&gt;[ D ]  To check an error&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;14. The statement to read a decimal value from the keyboard, into the integer variable sum is &lt;br /&gt;[ A ]  cin &amp;gt;&amp;gt; sum;&lt;br /&gt;[ B ]  cin &amp;gt;&amp;gt; "sum";&lt;br /&gt;[ C ]  cout &amp;lt;&amp;lt; sum;&lt;br /&gt;[ D ]  cout &amp;lt;&amp;lt; "sum";&lt;br /&gt;Answer : B &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;15. In C++, the goto statement causes control to &lt;br /&gt;[ A ]  Function&lt;br /&gt;[ B ]  A label&lt;br /&gt;[ C ]  A variable&lt;br /&gt;[ D ]  An operator&lt;br /&gt;Answer : B &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;16. Overloaded functions in C++ &lt;br /&gt;[ A ]  Are a group of functions with the same name&lt;br /&gt;[ B ]  All have the same number and type of arguments&lt;br /&gt;[ C ]  May fail unexpectedly due to stress&lt;br /&gt;[ D ]  Cause compilation problems&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;17. In C++ functions, a default argument has a value that &lt;br /&gt;[ A ]  May be supplied by the calling program (or) the function&lt;br /&gt;[ B ]  May have a constant value&lt;br /&gt;[ C ]  May have a variable value&lt;br /&gt;[ D ]  May not be supplied by the calling program&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;18. An enumerated data type brings together a group of &lt;br /&gt;[ A ]  Constant values integers with user-defined names&lt;br /&gt;[ B ]  Related data types&lt;br /&gt;[ C ]  Items of different data types&lt;br /&gt;[ D ]  Similar types of data&lt;br /&gt;Answer : A &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;19. How many values can be returned from a function &lt;br /&gt;[ A ]  2&lt;br /&gt;[ B ]  1&lt;br /&gt;[ C ]  4&lt;br /&gt;[ D ]  5&lt;br /&gt;Answer : B &lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; color: black; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #666362; line-height: 20px;"&gt;20. Operator overloading is &lt;br /&gt;[ A ]  Making C++ operators work with objects&lt;br /&gt;[ B ]  Giving new meanings to existing C++ operators&lt;br /&gt;[ C ]  Making new C++ operators&lt;br /&gt;[ D ]  Both (a) and (b)&lt;br /&gt;Answer : D &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6675575305312958176-175703663742971088?l=sameer-programming-articles.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Programming-articles/~4/-KN_MQfHqHo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://sameer-programming-articles.blogspot.com/feeds/175703663742971088/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://sameer-programming-articles.blogspot.com/2012/02/cc-programming-questions-asked-in-top.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6675575305312958176/posts/default/175703663742971088" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6675575305312958176/posts/default/175703663742971088" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Programming-articles/~3/-KN_MQfHqHo/cc-programming-questions-asked-in-top.html" title="C,C++ programming questions asked in top IT/software companies" /><author><name>Sameer</name><uri>http://www.blogger.com/profile/10730451471984312930</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://sameer-programming-articles.blogspot.com/2012/02/cc-programming-questions-asked-in-top.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-6675575305312958176.post-1256218995154563900</id><published>2012-02-09T08:06:00.000-08:00</published><updated>2012-02-09T08:06:34.412-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sameer-jagtap" /><title type="text">Recent C Interview Questions &amp; Answers</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is the difference between Structure and Union?&lt;/strong&gt; &lt;br /&gt;A : The Main difference&amp;nbsp; is Structure Allocate&amp;nbsp; memory as per  the Data type. But Union Allocate the Memory in max size of Declare variable&amp;nbsp; to all. &lt;br /&gt;The instance of unions can access on the&amp;nbsp; one member at a time. The  memory allocated for the instance is the size of largest member. But  instance of a structure has memory for all members separately and all  the members can be accessed independently.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is File Mode?. Explain types Of file mode?.&lt;br /&gt;&lt;/strong&gt;A : The mode in which mode we want to open the file. Types of modes are read mode, write mode.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is Pointer?.which is one of the most useful in Structure or Unoin?.&lt;/strong&gt; &lt;br /&gt;&amp;nbsp;A : Pointer is the variable which holds the address of another  variable. Union are&amp;nbsp; useful because&amp;nbsp; of no memory&amp;nbsp; wastage but structures  are&amp;nbsp; frequently used than unions.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What’s the difference between global static and static variable?&lt;/strong&gt; &lt;br /&gt;A : Global variables can be define anywhere in the program and they can be use any&amp;nbsp; time's . &lt;br /&gt;Static variables defined inside the functions and the value of static variables can not change in the program.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp;&amp;nbsp; : What is an abstract base class?&lt;/strong&gt; &lt;br /&gt;A&amp;nbsp;&amp;nbsp; : A class that has at least one pure virtual function. It can not&amp;nbsp;  be instantiated as there is no definition exists for pure virtual  function. Abstract classes are used for achieving polymorphism.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : Difference between a do statement and a while statement? &lt;br /&gt;&lt;/strong&gt;A: A do statement checks at the end of a loop to see whether  the next iteration of a loop should occur. The do statement will always  execute the body of a loop at least once.&amp;nbsp; &lt;br /&gt;A while statement checks at the beginning of a loop to see whether the next loop iteration should occur.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp;&amp;nbsp; : Explain the meaning of "Segmentation violation"?&lt;/strong&gt;&lt;br /&gt;A&amp;nbsp;&amp;nbsp; : A segmentation violation is&amp;nbsp;&amp;nbsp; usually indicates an attempt to access memory which does not&amp;nbsp; even exist.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : What is&amp;nbsp; the scope of static variables.&lt;br /&gt;&lt;/strong&gt;A&amp;nbsp;&amp;nbsp; : The scope of a static variable is&amp;nbsp; a local to the  block in which the variable is defined. However, the value of the static  variable persists between two function calls.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;  &lt;span&gt;&lt;strong&gt;Q : What is&amp;nbsp; the difference between malloc() and calloc() function?&lt;/strong&gt;&lt;br /&gt;A: Both functions are used to dynamically allocate the memory. The  difference is that calloc initializes the allocated memory to&amp;nbsp; zero  or Null while malloc contains garbage values.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : What is NULL pointer?&lt;/strong&gt;&lt;br /&gt;A:&amp;nbsp; A null pointer does not point to any object. NULL and zero&amp;nbsp; are  interchangable in pointer contexts. Usage of NULL should be considered a  gentle reminder that a pointer is involved. It is only the&amp;nbsp; pointer  contexts that NULL and 0 are equivalent. NULL should not be used when  another kind of 0 is required.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp;&amp;nbsp; : Describe the advantages of using macro?&lt;/strong&gt;&lt;br /&gt;A&amp;nbsp;&amp;nbsp; : In modular programming, using functions is advisable when a  certain code is repeated several times in a program. However, every time  a function is called the control gets transferred to that function and  then back to the calling function. This consumes a lot of execution  time. One way to save this time is by using macros. Macros substitute a  function call by the definition of that function. This saves  execution time to a great extent.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : what is meant by the pointer?&lt;/strong&gt;&lt;br /&gt;A : Pointer is a variable that can store the address of another variable&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What are the characteristics of arrays in C?&lt;/strong&gt; &lt;br /&gt;•&amp;nbsp;A : An array holds elements that have the same data type&lt;br /&gt;•&amp;nbsp;Array elements are stored in subsequent memory locations&lt;br /&gt;•&amp;nbsp;Array name represents the address of the starting element&lt;br /&gt;•&amp;nbsp;Two-dimentional array elements are stored row by row in subsequent memory locations.&lt;br /&gt;•&amp;nbsp;Array size should be mentioned in the declaration. Array size must be a constant expression and not a variable&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What are the different storage classes in C?&lt;/strong&gt; &lt;br /&gt;A :There are three types of storage classes in c&amp;nbsp;automatic, static and allocated. &lt;br /&gt;Variable having block scope and without static specifier have  automatic storage duration. Variables with block scope, and with  static specifier have static scope. Global variables (i.e, file scope)  with or without the the static specifier also have static scope. &lt;br /&gt;Memory obtained from calls to malloc(), alloc() or realloc() belongs to allocated storage class.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : Write a program to interchange 2 variables without using the third one.&lt;/strong&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;/span&gt;  &lt;span&gt;A : a=7;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   b=2;&lt;br /&gt;a = a + b;&lt;br /&gt;b = a - b;&lt;br /&gt;a = a - b;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is a static memory allocation?&lt;/strong&gt; &lt;br /&gt;A : Static memory allocation: The compiler allocates the required  memory space for a declared variable. By using the address of operator,  the reserved address is obtained and this address may be assigned to a  pointer variable. Since most of the declared variable have static  memory, this way of assigning pointer value to a pointer variable is  known as static memory allocation. Memory is assigned during compilation  time.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is a dynamic memory allocation?&lt;/strong&gt; &lt;br /&gt;A : Dynamic memory allocation: It uses functions such as malloc( ) or  calloc( ) to get memory dynamically. If these functions are used to get  the memory dynamically and the values returned by these functions are  assingned to the pointer variables, such assignments are known as  dynamic memory allocation. memory is assigned during run time.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;&amp;nbsp;Q :What is constructor or ctor?&lt;/strong&gt;&lt;br /&gt;&amp;nbsp;A :Constructor creates an object and initializes it. It also creates v  table for the virtual functions. It is different from other methods in a  class.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is destructor?&lt;/strong&gt;&lt;br /&gt;A : Destructor usually deletes the any extra resources allocated by the object.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is default constructor?&lt;br /&gt;&lt;/strong&gt;A : Constructor with no arguments or all the arguments has default values.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : What is inheritance?&lt;/strong&gt;&lt;br /&gt;A&amp;nbsp; : Inheritance allows one class to reuse the state and behavior of  another class. The derived class inherits the properties and method  implementations of the base class and extends it by the&amp;nbsp; overriding  methods and adding the additional properties and methods.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : What is Polymorphism?&lt;/strong&gt;&lt;br /&gt;A&amp;nbsp; : Polymorphism allows a client to treat different objects in  the same way even if they were created from different classes and  exhibit different behaviors. You can use implementation inheritance to  achieve polymorphism in languages such as C++ and Java. &lt;br /&gt;Base class object's pointer can invoke methods in derived class objects.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6675575305312958176-1256218995154563900?l=sameer-programming-articles.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Programming-articles/~4/gvez1AiBGwU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://sameer-programming-articles.blogspot.com/feeds/1256218995154563900/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://sameer-programming-articles.blogspot.com/2012/02/recent-c-interview-questions-answers_09.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6675575305312958176/posts/default/1256218995154563900" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6675575305312958176/posts/default/1256218995154563900" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Programming-articles/~3/gvez1AiBGwU/recent-c-interview-questions-answers_09.html" title="Recent C Interview Questions &amp; Answers" /><author><name>Sameer</name><uri>http://www.blogger.com/profile/10730451471984312930</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://sameer-programming-articles.blogspot.com/2012/02/recent-c-interview-questions-answers_09.html</feedburner:origLink></entry><entry><id>tag:blogger.com,1999:blog-6675575305312958176.post-5232836365772451834</id><published>2012-02-08T22:30:00.000-08:00</published><updated>2012-02-08T22:30:03.895-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="samjik" /><title type="text">Recent C++ Interview questions &amp; Answers.</title><content type="html">&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : Explain in void pointer using C++?&lt;/strong&gt;&lt;br /&gt;A : In C++, void represents the absence of type, so void the pointers  are pointers that point to a value that has no type. The void pointers  can point to any data type.&lt;br /&gt;We can declare void pointer as follows.&lt;br /&gt;Void *p;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is the function overloading in C++?&lt;/strong&gt;&lt;br /&gt;A :&amp;nbsp; You can have the multiple functions with same name using function  overloading facility of C++. You can use same name for multiple  functions when all these functions are doing same thing.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is virtual function?&lt;/strong&gt;&lt;br /&gt;Answer - Virtual function is the member function of a class that can  be overridden in its derived class. It is declared with virtual keyword.  Virtual function call is resolved at run-time (dynamic binding) whereas  the non-virtual member functions are resolved at compile time (static  binding).&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is&amp;nbsp; Null object in C++?&lt;/strong&gt; &lt;br /&gt;A : Null Object&amp;nbsp; is an object of some class whose purpose is to  indicate that a real object of that class does not exist. One common use  for a null object is a return value from a member of function that is  supposed to return an object with some specified properties but cannot  find such an object.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is virtual function? where is it used?&lt;br /&gt;&lt;/strong&gt;A : Virtual function is a member of function that is  declared by with in a base class and redefined by the derived class. to  make a function virtual prefix the function name by the "virtual"  keyword. It helps in polymorphism.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : what is a template&lt;/strong&gt;&lt;br /&gt;A template function defines a set of operations to performed on the  various data types This data is passed to the function as an argument&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What do you mean by the inheritance? &lt;br /&gt;&lt;/strong&gt;A : The Inheritance is the process by which one can aquire the properties of another object&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : Explain the scope resolution operator?&lt;br /&gt;&lt;/strong&gt;A: The scope resolution operator is a&amp;nbsp; permits of 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.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is&amp;nbsp; parameterized type?&lt;/strong&gt;&lt;br /&gt;A :&amp;nbsp; : A template is a parameterized construct or type containing the  generic code that can use or manipulate any type. It is called the  parameterized because an actual type is a parameter of the code body.  Polymorphism may be achieved through parameterized types. This type of  polymorphism is called parameteric polymorphism. Parameteric  polymorphism is the mechanism by which the same code is used on  different types passed as parameters.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : Explain the scope resolution operator?&lt;/strong&gt;&lt;br /&gt;A :Resolution operator 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.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : Name of the some pure object oriented languages?&lt;/strong&gt;&lt;br /&gt;A : Some pure object oriented languages are&lt;br /&gt;•&amp;nbsp;Smalltalk, &lt;br /&gt;•&amp;nbsp;Java, &lt;br /&gt;•&amp;nbsp;Eiffel, &lt;br /&gt;•&amp;nbsp;Sather.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : Differentiate between a C++ struct and C++ class?&lt;/strong&gt;&lt;br /&gt;A : 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.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : Why do C++ compilers need the name mangling?&lt;/strong&gt;&lt;br /&gt;A : Name mangling is the rule of according to which is the C++ changes  function's name into function signature before passing the  function to a linker. This is how the linker differentiates between  different functions with the same name.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;  &lt;span&gt;&lt;strong&gt;Q : What is&amp;nbsp; protocol class?&lt;/strong&gt;&lt;br /&gt;A : An abstract class is a protocol class if:&lt;br /&gt;1.Protocol&amp;nbsp; neither contains nor inherits from the classes that  contain member data, non-virtual functions, or private (or protected)  members of any kind.&lt;br /&gt;2. It has a non-inline virtual destructor defined with an empty implementation,&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : What is the difference between the message and method?&lt;br /&gt;&lt;/strong&gt;A: Method: Provides response to a message.It is an implementation of an operation..&lt;br /&gt;Message: Objects communicate by sending the messages to each other.A message is sent to invoke a method.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q&amp;nbsp; : What is an adaptor class ?&lt;/strong&gt;&lt;br /&gt;A&amp;nbsp; : A class that has no functionality of its own. It is the member  functions that hide the use of a third party software component or an object  with the non-compatible interface or a non- object- oriented  implementation.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;br /&gt;&lt;strong&gt;Q : What’s the difference between char a[] = “string”; and char *p = “string”;?&lt;/strong&gt; &lt;br /&gt;A : In the first case six bytes are allocated to the variable , where as in the second case if *p is assigned to the  some other value the allocate memory can change.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What is&amp;nbsp; conversion constructor?&lt;/strong&gt; &lt;br /&gt;A : A conversion constructor accepts one argument of a different type.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;  &lt;span style="font-size: small;"&gt;&lt;span&gt;&lt;strong&gt;Q : What’s&amp;nbsp; an explicit constructor?&lt;/strong&gt; &lt;br /&gt;A : A conversion constructor declared with the explicit keyword. The  compiler does’nt use an explicit constructor to implement an implied  conversion of types. It is reserved explicitly for  construction.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6675575305312958176-5232836365772451834?l=sameer-programming-articles.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Programming-articles/~4/KfJ6DtLVVbc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://sameer-programming-articles.blogspot.com/feeds/5232836365772451834/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://sameer-programming-articles.blogspot.com/2012/02/recent-c-interview-questions-answers_08.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6675575305312958176/posts/default/5232836365772451834" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6675575305312958176/posts/default/5232836365772451834" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/Programming-articles/~3/KfJ6DtLVVbc/recent-c-interview-questions-answers_08.html" title="Recent C++ Interview questions &amp; Answers." /><author><name>Sameer</name><uri>http://www.blogger.com/profile/10730451471984312930</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://sameer-programming-articles.blogspot.com/2012/02/recent-c-interview-questions-answers_08.html</feedburner:origLink></entry></feed>

