{"id":170,"date":"2020-04-03T09:26:01","date_gmt":"2020-04-03T09:26:01","guid":{"rendered":"https:\/\/temp.ashkerala.com\/?p=170"},"modified":"2020-04-03T09:26:01","modified_gmt":"2020-04-03T09:26:01","slug":"c-mcq-13","status":"publish","type":"post","link":"https:\/\/temp.ashkerala.com\/?p=170","title":{"rendered":"C++ MCQ-13"},"content":{"rendered":"<p><strong>Q.46\u00a0\u00a0 Given a class named Book, which of the following is not a valid constructor? \u00a0<\/strong><br \/> (A)\u00a0 Book ( ) { }\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 (B)\u00a0 Book ( Book b) { }<br \/> (C)\u00a0 Book ( Book &amp;b) { }\u00a0\u00a0 (D)\u00a0 Book (char* author, char* title) { }<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q47\u00a0 Which of the statements is true in a protected derivation of a derived class from a base class?<\/strong><br \/> (A)\u00a0 Private members of the base class become protected members of the derived class \u00a0<br \/> (B) Protected members of the base class become public members of the derived class<br \/> (C) Public members of the base class become protected members of the derived class \u00a0<br \/> (D) Protected derivation does not affect private and protected members of the derived class.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q48\u00a0 Which of the following statements is NOT valid about operator overloading? \u00a0<\/strong><br \/> (A)\u00a0 Only existing operators can be overloaded.\u00a0 \u00a0<br \/> (B)\u00a0 Overloaded operator must have at least one operand of its class type.<br \/> (C)\u00a0 The overloaded operators follow the syntax rules of the original operator.<br \/> (D)\u00a0 none of the above. \u00a0<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans:D<br \/> \u00a0<br \/> Q.49\u00a0 Exception handling is targeted at \u00a0<\/strong><br \/> (A) Run-time error\u00a0 (B) Compile time error<br \/> (C) Logical error\u00a0 (D) All of the above.<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0 Ans:A<br \/> \u00a0<br \/> Q.50\u00a0\u00a0 A pointer to the base class can hold address of <\/strong>\u00a0<br \/> (A) only base class object\u00a0 \u00a0<br \/> (B) only derived class object<br \/> (C) base class object as well as derived class object \u00a0<br \/> (D) None of the above<\/p>\n<p> <strong>\u00a0Ans:C<br \/> \u00a0<br \/> Q.51\u00a0\u00a0 Function templates can accept<\/strong><br \/> (A)\u00a0 any type of parameters\u00a0 \u00a0<br \/> (B)\u00a0 only one parameter<br \/> (C)\u00a0 only parameters of the basic type<br \/> (D)\u00a0 only parameters of the derived type<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q.52\u00a0\u00a0 How many constructors can a class have?<\/strong><br \/> (A)\u00a0 0\u00a0 (B)\u00a0 1<br \/> (C)\u00a0 2\u00a0 (D)\u00a0 any number \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q.53\u00a0\u00a0 The new operator\u00a0<\/strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (A)\u00a0\u00a0 returns a pointer to the variable \u00a0<br \/> (B)\u00a0\u00a0 creates a variable called new<br \/> (C)\u00a0 obtains memory for a new variable\u00a0 \u00a0<br \/> (D)\u00a0 tells how much memory is available<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q.54\u00a0 Consider the following statements:<\/strong><br \/> <strong>\u00a0\u00a0 int x = 22,y=15;<br \/> \u00a0\u00a0 x = (x&gt;y) ? (x+y) : (x-y); \u00a0<br \/> \u00a0\u00a0 What will be the value of x after executing these statements?<\/strong><br \/> (A)\u00a0\u00a0 22\u00a0 (B)\u00a0 37<br \/> (C)\u00a0\u00a0 7\u00a0\u00a0 (D)\u00a0 Error. Cannot be executed<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.55\u00a0 An exception is caused by<\/strong><br \/> (A)\u00a0 a hardware problem\u00a0 (B) a problem in the operating system<br \/> (C)\u00a0 a syntax error\u00a0\u00a0\u00a0\u00a0\u00a0 (D)\u00a0 a run-time error<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D \u00a0<br \/> \u00a0<br \/> Q.56\u00a0 A template class<\/strong><br \/> (A)\u00a0 is designed to be stored in different containers\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (B) works with different data types<br \/> (C)\u00a0 generates objects which must be identical\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (D)\u00a0 generates classes with different numbers of member functions.<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans:B<\/strong><\/p>\n<p> <strong>Q.57\u00a0 Which of the following is the valid class declaration header for the derived class d with base<\/strong><br \/> classes b1 and b2?<br \/> (A)\u00a0 class d : public b1, public b2 (B)\u00a0 class d : class b1, class b2<br \/> (C)\u00a0 class d : public b1, b2\u00a0 (D)\u00a0 class d : b1, b2<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans:A<br \/> \u00a0<br \/> Q.58\u00a0 A library function exit() causes an exit from \u00a0<\/strong><br \/> (A)\u00a0 the loop in which it occurs\u00a0 (B)\u00a0 the block in which it occurs<br \/> (C)\u00a0 the function in which it occurs\u00a0 (D)\u00a0 the program in which it occurs \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q.59\u00a0 RunTime polymorphism is achieved by ___________<\/strong><br \/> (A) friend function\u00a0 (B) virtual function<br \/> (C) operator overloading\u00a0 (D) function overloading<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.60 Declaration of a pointer reserves memory space <\/strong>\u00a0<br \/> (A)\u00a0 for the object.<br \/> (B)\u00a0 for the pointer.<br \/> (C)\u00a0 both for the object and the pointer.<br \/> (D)\u00a0 none of these.<br \/> \u00a0<\/p>\n<p><strong>\u00a0\u00a0 Ans:B<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q.46\u00a0\u00a0 Given a class named Book, which of the following is not a valid constructor? \u00a0 (A)\u00a0 Book ( ) { }\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 (B)\u00a0 Book ( Book b) { } (C)\u00a0 Book ( Book &amp;b) { }\u00a0\u00a0 (D)\u00a0 Book (char* author, char* title) { } \u00a0 \u00a0 \u00a0 Ans:B \u00a0 Q47\u00a0 Which&#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-170","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\/170","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=170"}],"version-history":[{"count":0,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/posts\/170\/revisions"}],"wp:attachment":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=170"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=170"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=170"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}