{"id":167,"date":"2020-04-03T09:24:43","date_gmt":"2020-04-03T09:24:43","guid":{"rendered":"https:\/\/temp.ashkerala.com\/?p=167"},"modified":"2020-04-03T09:24:43","modified_gmt":"2020-04-03T09:24:43","slug":"c-mcq-10","status":"publish","type":"post","link":"https:\/\/temp.ashkerala.com\/?p=167","title":{"rendered":"C++ MCQ-10"},"content":{"rendered":"<p><strong>Q.16\u00a0\u00a0 If we create a file by \u0393\u00c7\u00ffifstream\u0393\u00c7\u00d6, then the default mode of the file is _________\u00a0 \u00a0<\/strong><br \/> (A)\u00a0 ios :: out\u00a0 (B)\u00a0 ios :: in<br \/> (C)\u00a0 ios :: app\u00a0 (D)\u00a0 ios :: binary<br \/> \u00a0<br \/> <strong>\u00a0 Ans: B<br \/> \u00a0<br \/> Q.17\u00a0\u00a0 A variable defined within a block is visible\u00a0\u00a0<\/strong> \u00a0<br \/> \u00a0\u00a0 (A) from the point of definition onward in the program.\u00a0\u00a0 \u00a0<br \/> \u00a0\u00a0 (B) from the point of definition onward in the function.<br \/> \u00a0\u00a0 (C) from the point of definition onward in the block.\u00a0 \u00a0<br \/> \u00a0\u00a0 (D) throughout the function.<br \/> <strong>\u00a0<br \/> \u00a0\u00a0 Ans: C\u00a0 \u00a0<br \/> \u00a0<br \/> Q.18\u00a0\u00a0 The break statement causes an exit\u00a0\u00a0\u00a0<\/strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (A) from the innermost loop only.\u00a0 (B) only from the innermost switch.<br \/> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 (C) from all loops &amp; switches.\u00a0 (D) from the innermost loop or switch.<br \/> <strong>\u00a0 \u00a0<br \/> \u00a0 Ans: D<br \/> \u00a0<br \/> Q.19\u00a0\u00a0 Which of the following cannot be legitimately passed to a function<\/strong><br \/> \u00a0(A)\u00a0 A constant.\u00a0 (B) A variable.<br \/> \u00a0(C)\u00a0 A structure.\u00a0 (D) A header file. \u00a0<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: D<br \/> \u00a0<br \/> Q.20\u00a0 A property which is not true for classes is that they\u00a0<\/strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (A)\u00a0\u00a0 are removed from memory when not in use.\u00a0 \u00a0<br \/> (B)\u00a0\u00a0 permit data to be hidden from other classes.<br \/> (C)\u00a0\u00a0 bring together all aspects of an entity in one place. \u00a0<br \/> (D)\u00a0\u00a0 Can closely model objects in the real world.<br \/> \u00a0\u00a0\u00a0 \u00a0<br \/> <strong>\u00a0\u00a0 Ans: C<br \/> \u00a0<br \/> Q.21\u00a0 You can read input that consists of multiple lines of text using<\/strong> \u00a0<br \/> (A)\u00a0\u00a0 the normal cout &lt;&lt; combination. \u00a0<br \/> (B)\u00a0\u00a0 the cin.get( ) function with one argument.<br \/> (C)\u00a0\u00a0 the cin.get( ) function with two arguments. \u00a0<br \/> (D)\u00a0\u00a0 the cin.get( ) function with three arguments.<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: C<br \/> \u00a0<br \/> Q.22\u00a0\u00a0 The keyword friend does not appear in\u00a0<\/strong> \u00a0<br \/> (A)\u00a0\u00a0 the class allowing access to another class.\u00a0 \u00a0<br \/> (B)\u00a0\u00a0 the class desiring access to another class.<br \/> (C)\u00a0\u00a0 the private section of a class. \u00a0<br \/> (D)\u00a0\u00a0 the public section of a class.<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: C<br \/> \u00a0<br \/> Q.23\u00a0\u00a0 The process of building new classes from existing one is called<\/strong><br \/> (A)\u00a0 Structure.\u00a0 (B)\u00a0 Inheritance.<br \/> (C)\u00a0 Polymorphism.\u00a0 (D)\u00a0 Template.<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: B<br \/> \u00a0<br \/> Q.24\u00a0 If you wanted to sort many large objects or structures, it would be most efficient to <\/strong>\u00a0<br \/> \u00a0\u00a0 \u00a0<br \/> (A)\u00a0\u00a0\u00a0 place them in an array &amp; sort the array.\u00a0 \u00a0<br \/> (B)\u00a0\u00a0\u00a0 place pointers to them in an array &amp; sort the array.<br \/> (C)\u00a0\u00a0\u00a0 place them in a linked list and sort the linked list. \u00a0<br \/> (D)\u00a0\u00a0\u00a0 place references to them in an array and sort the array.<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0\u00a0 Ans: C<br \/> \u00a0<br \/> Q.25\u00a0\u00a0 Which statement gets affected when i++ is changed to ++i?<\/strong>\u00a0 \u00a0<br \/> \u00a0\u00a0 (A) i = 20; i++;\u00a0\u00a0 \u00a0<br \/> \u00a0\u00a0 (B) for (i = 0; i&lt;20; i++) { }<br \/> \u00a0\u00a0 (C) a = i++; \u00a0<br \/> \u00a0\u00a0 (D) while (i++ = 20) cout &lt;&lt;i;<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: A<br \/> \u00a0<br \/> Q.26\u00a0\u00a0 A friend function to a class, C cannot access\u00a0<\/strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> \u00a0\u00a0\u00a0 (A) private data members and member functions.<br \/> \u00a0\u00a0\u00a0 (B) public data members and member functions.<br \/> \u00a0\u00a0\u00a0 (C) protected data members and member functions. \u00a0<br \/> \u00a0\u00a0\u00a0 (D) the data members of the derived class of C.<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0 Ans: D<br \/> \u00a0<br \/> Q.27\u00a0 The operator that cannot be overloaded is\u00a0\u00a0<\/strong> \u00a0<br \/> (A)\u00a0 ++\u00a0 (B) ::<br \/> (C)\u00a0 ( )\u00a0 (D) ~ \u00a0<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: B\u00a0 \u00a0<br \/> \u00a0<br \/> Q.28\u00a0\u00a0 A struct is the same as a class except that<\/strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (A)\u00a0\u00a0 there are no member functions.\u00a0 \u00a0<br \/> (B)\u00a0\u00a0 all members are public.<br \/> (C)\u00a0\u00a0 cannot be used in inheritance hierarchy. \u00a0<br \/> (D)\u00a0\u00a0 it does have a this pointer.<br \/> \u00a0\u00a0\u00a0 \u00a0<br \/> <strong>\u00a0 Ans: C<br \/> \u00a0<br \/> Q.29\u00a0 Pure virtual functions <\/strong>\u00a0<br \/> (A) have to be redefined in the inherited class.\u00a0 \u00a0<br \/> (B) cannot have public access specification.<br \/> (C) are mandatory for a virtual class. \u00a0<br \/> (D) None of the above.<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: A<br \/> \u00a0<br \/> Q.30\u00a0 Additional information sent when an exception is thrown may be placed in \u00a0<\/strong><br \/> (A)\u00a0 the throw keyword.\u00a0 \u00a0<br \/> (B)\u00a0 the function that caused the error.<br \/> (C)\u00a0 the catch block. \u00a0<br \/> (D)\u00a0 an object of the exception class.<br \/> \u00a0<br \/> <strong>\u00a0\u00a0 Ans: C<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q.16\u00a0\u00a0 If we create a file by \u0393\u00c7\u00ffifstream\u0393\u00c7\u00d6, then the default mode of the file is _________\u00a0 \u00a0 (A)\u00a0 ios :: out\u00a0 (B)\u00a0 ios :: in (C)\u00a0 ios :: app\u00a0 (D)\u00a0 ios :: binary \u00a0 \u00a0 Ans: B \u00a0 Q.17\u00a0\u00a0 A variable defined within a block is visible\u00a0\u00a0 \u00a0 \u00a0\u00a0 (A) from the point of&#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-167","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\/167","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=167"}],"version-history":[{"count":0,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/posts\/167\/revisions"}],"wp:attachment":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}