{"id":171,"date":"2020-04-03T09:26:25","date_gmt":"2020-04-03T09:26:25","guid":{"rendered":"https:\/\/temp.ashkerala.com\/?p=171"},"modified":"2020-04-03T09:26:25","modified_gmt":"2020-04-03T09:26:25","slug":"c-mcq-14","status":"publish","type":"post","link":"https:\/\/temp.ashkerala.com\/?p=171","title":{"rendered":"C++ MCQ-14"},"content":{"rendered":"<p><strong>Q.61\u00a0 An array element is accessed using<\/strong><br \/> (A)\u00a0 a FIFO approach\u00a0 (B)\u00a0 an index number<br \/> (C)\u00a0 the operator\u00a0 (D)\u00a0 a member name<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.62\u00a0\u00a0 If there is a pointer p to object of a base class and it contains the address of an object of a<br \/> derived class and both classes contain a virtual member function abc(), then the statement \u00a0<br \/> \u00a0\u00a0\u00a0\u00a0\u00a0 p-&gt;abc(); will cause the version of abc() in the __________class to be executed.<\/strong><br \/> (A)\u00a0 Base Class\u00a0 (B)\u00a0 Derived class<br \/> (C)\u00a0 Produces compile time error\u00a0 (D)\u00a0 produces runtime error \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.63\u00a0\u00a0 A pure virtual function is a virtual function that\u00a0\u00a0\u00a0<\/strong>\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (A)\u00a0 has no body\u00a0 (B)\u00a0 returns nothing<br \/> (C)\u00a0 is used in base class\u00a0 (D)\u00a0 both (A) and (C) \u00a0<\/p>\n<p> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q.64\u00a0\u00a0 A static function<\/strong><br \/> (A) should be called when an object is destroyed.<br \/> (B) is closely connected with and individual object of a class.<br \/> (C)\u00a0 can be called using the class name and function name.<br \/> (D)\u00a0 is used when a dummy object must be created.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q.65\u00a0\u00a0 We can output text to an object of class ostream using the insertion operator&lt;&lt; because<\/strong><br \/> (A)\u00a0 the ostream class is a stream \u00a0<br \/> (B)\u00a0 the insertion operator works with all classes.<br \/> (C)\u00a0 we are actually outputting to cout.<br \/> (D)\u00a0 the insertion operator is overloaded in ostream.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q.66\u00a0\u00a0 The statement f1.write((char*)&amp;obj1, sizeof(obj1));<\/strong><br \/> (A) writes the member function of obj1 to f1.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (B) Writes the data in obj1 to f1.<br \/> (C) Writes the member function and the data of obj1 to f1.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (D) Writes the address of obj1 to f1.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.67\u00a0\u00a0 To convert from a user defined class to a basic type, you would most likely use.<\/strong><br \/> (A) A built-in conversion function.\u00a0 \u00a0<br \/> (B) A one-argument constructor.<br \/> (C) A conversion function that\u0393\u00c7\u00d6s a member of the class. \u00a0<br \/> (D) An overloaded \u0393\u00c7\u00ff=\u0393\u00c7\u00ff operator.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q.68\u00a0 Which of the following is not the characteristic of constructor.<\/strong><br \/> (A)\u00a0 They should be declared in the public section.<br \/> (B)\u00a0 They do not have return type.<br \/> (C)\u00a0 They can not be inherited.<br \/> (D)\u00a0 They can be virtual.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q.69\u00a0\u00a0 Name the header file to be included for the use of built in function isalnum()<\/strong><br \/> (A) string.h\u00a0 (B) process.h<br \/> (C) ctype.h\u00a0 (D) dos.h<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q.70\u00a0\u00a0 What is the output of given code fragment?<\/strong><br \/> <strong>\u00a0\u00a0 int f=1, i=2;<br \/> \u00a0\u00a0 while(++i&lt;5)<br \/> \u00a0\u00a0 f* =i;<br \/> \u00a0\u00a0 cout&lt;&lt;f;<\/strong><br \/> (A) 12\u00a0 (B)\u00a0 24<br \/> (C) 6\u00a0\u00a0 (D) 3<br \/> \u00a0<br \/> <strong>\u00a0 Ans:A<br \/> \u00a0<br \/> Q.71\u00a0 A class defined within another class is:<\/strong><br \/> (A)\u00a0 Nested class\u00a0 (B)\u00a0 Inheritance<br \/> (C)\u00a0 Containership\u00a0 (D)\u00a0 Encapsulation<br \/> \u00a0 \u00a0<br \/> <strong>\u00a0 Ans:A<\/strong><br \/> \u00a0<br \/> <strong>Q.72\u00a0\u00a0 What will be the values of x, m and n after the execution of the following statements? \u00a0<br \/> int x, m, n; \u00a0<br \/> m = 10; \u00a0<br \/> n = 15; \u00a0<br \/> x = ++m\u00a0 +\u00a0 n++;<\/strong><br \/> (A)\u00a0 x=25, m=10, n=15\u00a0 (B)\u00a0 x=26, m=11, n=16<br \/> (C)\u00a0 x=27, m=11, n=16\u00a0 (D)\u00a0 x=27, m=10, n=15 \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:B<br \/> \u00a0<br \/> Q.73\u00a0\u00a0 Which of the following will produce a value 10 if x = 9.7?\u00a0\u00a0\u00a0\u00a0<\/strong>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0<br \/> (A)\u00a0 floor(x)\u00a0 (B)\u00a0 abs(x)<br \/> (C)\u00a0 log(x)\u00a0\u00a0\u00a0 (D)\u00a0 ceil(x) \u00a0<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<br \/> \u00a0<br \/> Q74\u00a0 The major goal of inheritance in c++ is:\u00a0<\/strong>\u00a0\u00a0 \u00a0<br \/> (A) To facilitate the conversion of data types.<br \/> (B)\u00a0 To help modular programming.<br \/> (C)\u00a0 To extend the capabilities of a class.<br \/> (D)\u00a0 To hide the details of base class.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:C<br \/> \u00a0<br \/> Q.75\u00a0\u00a0 Consider the following class definitions:<br \/> \u00a0\u00a0 class a<br \/> \u00a0\u00a0 {<br \/> \u00a0\u00a0 };<br \/> \u00a0\u00a0 class b: protected a \u00a0<br \/> \u00a0\u00a0 {<br \/> \u00a0\u00a0 };<br \/> \u00a0\u00a0 What happens when we try to compile this class?<\/strong><br \/> (A) Will not compile because class body of a is not defined.<br \/> (B) Will not compile because class body of b is not defined.<br \/> (C) Will not compile because class a is not public inherited.<br \/> (D) Will compile successfully.<br \/> \u00a0<br \/> <strong>\u00a0 Ans:D<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Q.61\u00a0 An array element is accessed using (A)\u00a0 a FIFO approach\u00a0 (B)\u00a0 an index number (C)\u00a0 the operator\u00a0 (D)\u00a0 a member name \u00a0 \u00a0 Ans:B \u00a0 Q.62\u00a0\u00a0 If there is a pointer p to object of a base class and it contains the address of an object of a derived class and both classes contain&#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-171","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\/171","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=171"}],"version-history":[{"count":0,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/posts\/171\/revisions"}],"wp:attachment":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}