{"id":172,"date":"2020-04-03T09:26:49","date_gmt":"2020-04-03T09:26:49","guid":{"rendered":"https:\/\/temp.ashkerala.com\/?p=172"},"modified":"2020-04-03T09:26:49","modified_gmt":"2020-04-03T09:26:49","slug":"c-mcq-15","status":"publish","type":"post","link":"https:\/\/temp.ashkerala.com\/?p=172","title":{"rendered":"C++ MCQ-15"},"content":{"rendered":"<p><strong>Q.76\u00a0\u00a0 Which of the following expressions is illegal?<\/strong><br \/> (A)\u00a0 ( ) 6 10 .\u00a0 (B)\u00a0 (false &amp;&amp; true)<br \/> (C)\u00a0 bool (x) = (bool)10;\u00a0 (D)\u00a0 float y = 12.67; \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q.77\u00a0 The actual source code for implementing a template function is created when <\/strong>\u00a0<br \/> (A) The declaration of function appears.<br \/> (B) The function is invoked.<br \/> (C) The definition of the function appears.\u00a0\u00a0 \u00a0<br \/> (D) None of the above.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.78\u00a0 An exception is caused by<\/strong><br \/> (A)\u00a0 a runtime error.\u00a0 \u00a0<br \/> (B)\u00a0 a syntax error.<br \/> (C)\u00a0 a problem in the operating system.<br \/> (D)\u00a0 a hardware problem.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:A<br \/> \u00a0<br \/> Q.79\u00a0\u00a0 Which of the following statements are true in c++?<\/strong><br \/> (A) Classes can not have data as public members.\u00a0 \u00a0<br \/> (B) Structures can not have functions as members.<br \/> (C) Class members are public by default. \u00a0<br \/> (D) None of these.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.80\u00a0\u00a0 What would be the output of the following program?<br \/> \u00a0\u00a0 int main()<br \/> \u00a0\u00a0 {<br \/> \u00a0\u00a0 int x,y=10,z=10;<br \/> \u00a0\u00a0\u00a0 x = (y = =z);<br \/> \u00a0\u00a0 cout&lt;&lt;x;<br \/> \u00a0\u00a0 return 0;<br \/> \u00a0\u00a0 }<\/strong><br \/> (A) 1\u00a0 (B)\u00a0 0<br \/> (C) 10\u00a0 (D) Error<br \/> \u00a0<\/p>\n<p><strong>Ans:A<br \/> \u00a0<br \/> Q.81\u00a0 What is the error in the following code?<br \/> \u00a0\u00a0 class t<br \/> \u00a0\u00a0 {<br \/> \u00a0\u00a0 virtual void print();<br \/> \u00a0\u00a0 }<\/strong><br \/> (A)\u00a0 No error. \u00a0<br \/> (B)\u00a0 Function print() should be declared as static.<br \/> (C)\u00a0 Function print() should be defined. \u00a0<br \/> (D)\u00a0 Class t should contain data members.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:A<br \/> \u00a0<br \/> Q.82\u00a0\u00a0 What will be the output of following program? \u00a0<\/strong><br \/> <strong>#include&lt;iostream.h&gt;<br \/> void main()<br \/> {<br \/> float x;<br \/> x=(float)9\/2;<br \/> cout&lt;&lt;x;<br \/> } \u00a0<\/strong><br \/> \u00a0<br \/> (A)\u00a0\u00a0 4.5\u00a0 (B)\u00a0 4.0<br \/> (C)\u00a0\u00a0 4\u00a0\u00a0\u00a0 (D)\u00a0 5\u00a0 \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:A<br \/> \u00a0<br \/> Q.83\u00a0\u00a0 A white space is <\/strong>:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> \u00a0\u00a0 (A)\u00a0 blank space\u00a0 (B)\u00a0 new line<br \/> \u00a0\u00a0 (C)\u00a0 tab\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (D)\u00a0 all of the above \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q.84\u00a0 The following can be declared as friend in a class\u00a0\u00a0\u00a0<\/strong> \u00a0<br \/> (A)\u00a0 an object\u00a0 (B)\u00a0 a class<br \/> (C)\u00a0 a public data member\u00a0 (D) a private data member<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.85\u00a0 What would be the output of the following?<br \/> \u00a0\u00a0 #include&lt;iostream.h&gt;<br \/> \u00a0\u00a0 void main()<br \/> \u00a0\u00a0 {<br \/> \u00a0\u00a0 char *ptr=\u0393\u00c7\u00a3abcd\u0393\u00c7\u00a5<br \/> \u00a0\u00a0 char ch;<br \/> \u00a0\u00a0 ch = ++*ptr++;<br \/> \u00a0\u00a0 ut&lt;&lt;ch;<br \/> \u00a0\u00a0 }<\/strong><br \/> \u00a0<br \/> (A)\u00a0 a\u00a0 (B)\u00a0 b<br \/> (C)\u00a0 c\u00a0 (D)\u00a0 d<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.86\u00a0\u00a0 A copy constructor takes<\/strong><br \/> (A)\u00a0 no argument\u00a0\u00a0\u00a0 (B)\u00a0 one argument<br \/> (C)\u00a0 two arguments\u00a0 (D)\u00a0 arbitrary no. of arguments<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0\u00a0 Ans:B<br \/> \u00a0<br \/> Q87\u00a0 Overloading a postfix increment operator by means of a member function takes\u00a0 <\/strong>\u00a0<br \/> (A)\u00a0 no argument\u00a0\u00a0\u00a0 (B)\u00a0 one argument<br \/> (C)\u00a0 two arguments\u00a0 (D)\u00a0 three arguments<br \/> \u00a0<br \/> <strong>\u00a0 Ans:A<br \/> \u00a0<br \/> Q88\u00a0 Which of the following ways are legal to access a class data member using this pointer?<\/strong><br \/> (A)\u00a0 this.x\u00a0\u00a0\u00a0 (B)\u00a0 *this.x<br \/> (C)\u00a0 *(this.x) (D)\u00a0 (*this).x<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q.89\u00a0 If we store the address of a derived class object into a variable whose type is a pointer to the<br \/> base class, then the object, when accessed using this pointer.<\/strong><br \/> (A) continues to act like a derived class object.\u00a0 \u00a0<br \/> (B) Continues to act like a derived class object if virtual functions are called.<br \/> (C) Acts like a base class object. \u00a0<br \/> (D) Acts like a base class, if virtual functions are called.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.90\u00a0 Which of the following declarations are illegal?<\/strong><br \/> (A) void *ptr;\u00a0 (B)\u00a0 char *str = \u0393\u00c7\u00a3hello\u0393\u00c7\u00a5;<br \/> (C) char str = \u0393\u00c7\u00a3hello\u0393\u00c7\u00a5;\u00a0 (D) const *int p1;<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C <\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q.76\u00a0\u00a0 Which of the following expressions is illegal? (A)\u00a0 ( ) 6 10 .\u00a0 (B)\u00a0 (false &amp;&amp; true) (C)\u00a0 bool (x) = (bool)10;\u00a0 (D)\u00a0 float y = 12.67; \u00a0 \u00a0 \u00a0 Ans:C \u00a0 Q.77\u00a0 The actual source code for implementing a template function is created when \u00a0 (A) The declaration of function appears. (B) The&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[15],"tags":[],"class_list":["post-172","post","type-post","status-publish","format-standard","hentry","category-c-and-c-programming-language"],"_links":{"self":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/posts\/172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=172"}],"version-history":[{"count":0,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/posts\/172\/revisions"}],"wp:attachment":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}