{"id":161,"date":"2020-04-03T09:21:33","date_gmt":"2020-04-03T09:21:33","guid":{"rendered":"https:\/\/temp.ashkerala.com\/?p=161"},"modified":"2020-04-03T09:21:33","modified_gmt":"2020-04-03T09:21:33","slug":"c-mcq-4","status":"publish","type":"post","link":"https:\/\/temp.ashkerala.com\/?p=161","title":{"rendered":"C++ MCQ -4"},"content":{"rendered":"<p>Question 1:<br \/> \u00a0<br \/> cin extraction stops execution as soon as it finds any blank space character<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 true<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 false<br \/> \u00a0<br \/> Question 2:<br \/> \u00a0<br \/> Observe the following statements and decide what do they do.<br \/> \u00a0<br \/> string mystring;<br \/> \u00a0<br \/> getline(cin, mystring);<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 reads a line of string from cin into mystring<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 reads a line of string from mystring into cin<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 cin can\u0393\u00c7\u00d6t be used this way<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 none of above<br \/> \u00a0<br \/> Question 3:<br \/> \u00a0<br \/> Regarding stringstream identify the invalid statement<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 stringstream is defined in the header file &lt;sstream&gt;<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 It allows string based objects treated as stream<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 It is especially useful to convert strings to numerical values and vice versa.<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 None of above<br \/> \u00a0<br \/> Question 4:<br \/> \u00a0<br \/> Which of the header file must be included to use stringstream?<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;iostream&gt;<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;string&gt;<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;sstring&gt;<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;sstream&gt;<br \/> \u00a0<br \/> Question 5:<br \/> \u00a0<br \/> Which of the following header file does not exist?<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;iostream&gt;<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;string&gt;<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;sstring&gt;<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;sstream&gt;<br \/> \u00a0<br \/> Question 6:<br \/> \u00a0<br \/> If you use same variable for two getline statements<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Both the inputs are stored in that variable<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 The second input overwrites the first one<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The second input attempt fails since the variable already got its value<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 You can not use same variable for two getline statements<br \/> \u00a0<br \/> \u00a0<br \/> Question 7:<br \/> \u00a0<br \/> The \u0393\u00c7\u00a3return 0;\u0393\u00c7\u00a5 statement in main function indicates<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The program did nothing; completed 0 tasks<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 The program worked as expected without any errors during its execution<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 not to end the program yet.<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 None of above<br \/> \u00a0<br \/> Question 8:<br \/> \u00a0<br \/> Which of the following is not a reserve keyword in C++?<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 mutable<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 default<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 readable<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 volatile<br \/> \u00a0<br \/> Question 9:<br \/> \u00a0<br \/> The size of following variable is not 4 bytes in 32 bit systems<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 int<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 long int<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 short int<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 float<br \/> \u00a0<br \/> Question 10:<br \/> \u00a0<br \/> Identify the correct statement regarding scope of variables<br \/> \u00a0<br \/> a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Global variables are declared in a separate file and accessible from any program.<br \/> b.\u00a0\u00a0\u00a0\u00a0\u00a0 Local variables are declared inside a function and accessible within the function only.<br \/> c.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Global variables are declared inside a function and accessible from anywhere in program.<br \/> d.\u00a0\u00a0\u00a0\u00a0\u00a0 Local variables are declared in the main body of the program and accessible only from functions.<\/p>\n<p> 1.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 a. True<\/p>\n<p> 2.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 a. Reads a line of string from cin into mystring<\/p>\n<p> 3.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 d. None of above<\/p>\n<p> 4.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 d. &lt;sstream&gt;<\/p>\n<p> 5.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c. &lt;sstring&gt;<\/p>\n<p> 6.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 b. The second input overwrites the first one<\/p>\n<p> 7.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 b. The program worked as expected without any errors during its execution<\/p>\n<p> 8.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c. readable<\/p>\n<p> 9.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 c. short int<\/p>\n<p> 10\u00a0\u00a0\u00a0\u00a0\u00a0 b. Local variables are declared inside a function and accessible within the function on<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Question 1: \u00a0 cin extraction stops execution as soon as it finds any blank space character \u00a0 a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 true b.\u00a0\u00a0\u00a0\u00a0\u00a0 false \u00a0 Question 2: \u00a0 Observe the following statements and decide what do they do. \u00a0 string mystring; \u00a0 getline(cin, mystring); \u00a0 a.\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 reads a line of string from cin into mystring b.\u00a0\u00a0\u00a0\u00a0\u00a0 reads a&#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-161","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\/161","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=161"}],"version-history":[{"count":0,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=\/wp\/v2\/posts\/161\/revisions"}],"wp:attachment":[{"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/temp.ashkerala.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}