{"id":9493,"date":"2025-05-17T22:36:32","date_gmt":"2025-05-17T17:36:32","guid":{"rendered":"https:\/\/rfaqs.com\/basic\/python-control-structures-quiz-12\/"},"modified":"2025-05-17T23:53:55","modified_gmt":"2025-05-17T18:53:55","slug":"python-control-structures-quiz-12","status":"publish","type":"post","link":"https:\/\/rfaqs.com\/python-quizzes\/python-control-structures-quiz-12\/","title":{"rendered":"Python Control Structures Quiz 12"},"content":{"rendered":"\n<p><strong>Master Python Control Structures with this interactive quiz!<\/strong> This Python Control Structures Quiz is designed for <strong>students, programmers, data analysts, and IT professionals<\/strong>. This <a href=\"https:\/\/rfaqs.com\/python-quizzes\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python Quiz<\/a> tests your understanding of <strong>if-else, loops (for\/while), and flow control<\/strong> in Python. Whether you are a beginner or an expert, sharpen your logic and debugging skills with real-world examples through this Python Control Structures Quiz. Can you score 100%? Let us start with the Online Python Control Structures Quiz now.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2025\/05\/Python-Control-Structures-Quiz-with-Answers.jpg\"><img decoding=\"async\" width=\"402\" height=\"170\" src=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2025\/05\/Python-Control-Structures-Quiz-with-Answers.jpg\" alt=\"Online Python Control Structures Quiz with Answers\" class=\"wp-image-9495\" srcset=\"https:\/\/rfaqs.com\/wp-content\/uploads\/2025\/05\/Python-Control-Structures-Quiz-with-Answers.jpg 402w, https:\/\/rfaqs.com\/wp-content\/uploads\/2025\/05\/Python-Control-Structures-Quiz-with-Answers-300x127.jpg 300w\" sizes=\"(max-width: 402px) 100vw, 402px\" \/><\/a><\/figure>\n<\/div>\n\n\n<script>\n  window.fbAsyncInit = function() {\n    FB.init({\n      appId            : '428441357660992',\n      autoLogAppEvents : true,\n      xfbml            : true,\n      version          : 'v3.1'\n    });\n  };\n\n  (function(d, s, id){\n     var js, fjs = d.getElementsByTagName(s)[0];\n     if (d.getElementById(id)) {return;}\n     js = d.createElement(s); js.id = id;\n     js.src = \"https:\/\/connect.facebook.net\/en_US\/sdk.js\";\n     fjs.parentNode.insertBefore(js, fjs);\n   }(document, 'script', 'facebook-jssdk'));\n<\/script><div id=\"watu_quiz\" class=\"quiz-area \">\n<p><p>Online Python Control Structures Quiz with Answers<\/p>\n<\/p><form action=\"\" method=\"post\" class=\"quiz-form \" id=\"quiz-43\" onsubmit=\"return Watu.submitResult(this)\">\n<div class='watu-question' id='question-1'><div class='question-content'><p><span class='watu_num'>1. <\/span>Which of the following best describes the purpose of the &#8216;elif&#8217; statement in a conditional structure?<\/p>\n<\/div><input type='hidden' name='question_id[]' value='821' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3500' \/><div class='watu-question-choice'><input type='radio' name='answer-821[]' id='answer-id-3500' class='answer answer-1  answerof-821' value='3500' \/>&nbsp;<label for='answer-id-3500' id='answer-label-3500' class=' answer label-1'><span class='answer'>It describes the end of a conditional structure<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3497' \/><div class='watu-question-choice'><input type='radio' name='answer-821[]' id='answer-id-3497' class='answer answer-1  answerof-821' value='3497' \/>&nbsp;<label for='answer-id-3497' id='answer-label-3497' class=' answer label-1'><span class='answer'>It describes a condition to test for if any one of the conditions has not been met<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3499' \/><div class='watu-question-choice'><input type='radio' name='answer-821[]' id='answer-id-3499' class='answer answer-1  answerof-821' value='3499' \/>&nbsp;<label for='answer-id-3499' id='answer-label-3499' class=' answer label-1'><span class='answer'>It defines the condition in case the preceding conditions in the if statement are not fulfilled<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3498' \/><div class='watu-question-choice'><input type='radio' name='answer-821[]' id='answer-id-3498' class='answer answer-1  answerof-821' value='3498' \/>&nbsp;<label for='answer-id-3498' id='answer-label-3498' class=' answer label-1'><span class='answer'>It describes a condition to test if all other conditions have failed<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType1' value='radio' class=''><\/div><div class='watu-question' id='question-2'><div class='question-content'><p><span class='watu_num'>2. <\/span>What is the result of the following lines of code?<\/p>\n<pre><code>x = 0\r\nwhile x &lt; 2:\r\n    print(x)\r\n    x = x + 1<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='827' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3616' \/><div class='watu-question-choice'><input type='radio' name='answer-827[]' id='answer-id-3616' class='answer answer-2  answerof-827' value='3616' \/>&nbsp;<label for='answer-id-3616' id='answer-label-3616' class=' answer label-2'><span class='answer'>This program will never leave the loop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3615' \/><div class='watu-question-choice'><input type='radio' name='answer-827[]' id='answer-id-3615' class='answer answer-2  answerof-827' value='3615' \/>&nbsp;<label for='answer-id-3615' id='answer-label-3615' class=' answer label-2'><span class='answer'>1<br \/>\n3<br \/>\n4<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3613' \/><div class='watu-question-choice'><input type='radio' name='answer-827[]' id='answer-id-3613' class='answer answer-2  answerof-827' value='3613' \/>&nbsp;<label for='answer-id-3613' id='answer-label-3613' class=' answer label-2'><span class='answer'>0<br \/>\n1<br \/>\n2<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3614' \/><div class='watu-question-choice'><input type='radio' name='answer-827[]' id='answer-id-3614' class='answer answer-2  answerof-827' value='3614' \/>&nbsp;<label for='answer-id-3614' id='answer-label-3614' class=' answer label-2'><span class='answer'>0<br \/>\n1<br \/>\n<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType2' value='radio' class=''><\/div><div class='watu-question' id='question-3'><div class='question-content'><p><span class='watu_num'>3. <\/span>Considering the function step, when will the following function return a value of 1?<\/p>\n<pre><code>def step(x):\r\n     if x &gt; 0:\r\n         y = 1\r\n     else:\r\n         y = 0\r\n     return y<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='829' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3623' \/><div class='watu-question-choice'><input type='radio' name='answer-829[]' id='answer-id-3623' class='answer answer-3  answerof-829' value='3623' \/>&nbsp;<label for='answer-id-3623' id='answer-label-3623' class=' answer label-3'><span class='answer'>if x is greater than 0<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3622' \/><div class='watu-question-choice'><input type='radio' name='answer-829[]' id='answer-id-3622' class='answer answer-3  answerof-829' value='3622' \/>&nbsp;<label for='answer-id-3622' id='answer-label-3622' class=' answer label-3'><span class='answer'>If x is equal to or less than zero<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3624' \/><div class='watu-question-choice'><input type='radio' name='answer-829[]' id='answer-id-3624' class='answer answer-3  answerof-829' value='3624' \/>&nbsp;<label for='answer-id-3624' id='answer-label-3624' class=' answer label-3'><span class='answer'>if x is less than zero<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3621' \/><div class='watu-question-choice'><input type='radio' name='answer-829[]' id='answer-id-3621' class='answer answer-3  answerof-829' value='3621' \/>&nbsp;<label for='answer-id-3621' id='answer-label-3621' class=' answer label-3'><span class='answer'>If x is equal to or greater than zero<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType3' value='radio' class=''><\/div><div class='watu-question' id='question-4'><div class='question-content'><p><span class='watu_num'>4. <\/span>What result does the following code produce?<\/p>\n<pre><code>def print_function(A):\r\n     for a in A:\r\n         print(a + '1')<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='825' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3607' \/><div class='watu-question-choice'><input type='radio' name='answer-825[]' id='answer-id-3607' class='answer answer-4  answerof-825' value='3607' \/>&nbsp;<label for='answer-id-3607' id='answer-label-3607' class=' answer label-4'><span class='answer'>a1<br \/>\nabc1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3606' \/><div class='watu-question-choice'><input type='radio' name='answer-825[]' id='answer-id-3606' class='answer answer-4  answerof-825' value='3606' \/>&nbsp;<label for='answer-id-3606' id='answer-label-3606' class=' answer label-4'><span class='answer'>a1<br \/>\nb1<br \/>\nc1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3608' \/><div class='watu-question-choice'><input type='radio' name='answer-825[]' id='answer-id-3608' class='answer answer-4  answerof-825' value='3608' \/>&nbsp;<label for='answer-id-3608' id='answer-label-3608' class=' answer label-4'><span class='answer'>0<br \/>\n1<br \/>\n2<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3605' \/><div class='watu-question-choice'><input type='radio' name='answer-825[]' id='answer-id-3605' class='answer answer-4  answerof-825' value='3605' \/>&nbsp;<label for='answer-id-3605' id='answer-label-3605' class=' answer label-4'><span class='answer'>a<br \/>\nb<br \/>\nc<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType4' value='radio' class=''><\/div><div class='watu-question' id='question-5'><div class='question-content'><p><span class='watu_num'>5. <\/span>What is the output of the following few lines of code?<\/p>\n<pre><code>for i, x in enumerate(['A', 'B', 'C']):\r\n     print(i + 1, x<\/code>)<\/pre>\n<\/div><input type='hidden' name='question_id[]' value='828' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3620' \/><div class='watu-question-choice'><input type='radio' name='answer-828[]' id='answer-id-3620' class='answer answer-5  answerof-828' value='3620' \/>&nbsp;<label for='answer-id-3620' id='answer-label-3620' class=' answer label-5'><span class='answer'>1 AA<br \/>\n2 BB<br \/>\n3 CC<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3618' \/><div class='watu-question-choice'><input type='radio' name='answer-828[]' id='answer-id-3618' class='answer answer-5  answerof-828' value='3618' \/>&nbsp;<label for='answer-id-3618' id='answer-label-3618' class=' answer label-5'><span class='answer'>1 A<br \/>\n2 B<br \/>\n3 C<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3617' \/><div class='watu-question-choice'><input type='radio' name='answer-828[]' id='answer-id-3617' class='answer answer-5  answerof-828' value='3617' \/>&nbsp;<label for='answer-id-3617' id='answer-label-3617' class=' answer label-5'><span class='answer'>0 A<br \/>\n1 B<br \/>\n2 C<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3619' \/><div class='watu-question-choice'><input type='radio' name='answer-828[]' id='answer-id-3619' class='answer answer-5  answerof-828' value='3619' \/>&nbsp;<label for='answer-id-3619' id='answer-label-3619' class=' answer label-5'><span class='answer'>0 AA<br \/>\n1 BB<br \/>\n2 CC<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType5' value='radio' class=''><\/div><div class='watu-question' id='question-6'><div class='question-content'><p><span class='watu_num'>6. <\/span>Which of the following statements correctly demonstrates the use of an if-else conditional statement in Python?<\/p>\n<\/div><input type='hidden' name='question_id[]' value='836' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3558' \/><div class='watu-question-choice'><input type='radio' name='answer-836[]' id='answer-id-3558' class='answer answer-6  answerof-836' value='3558' \/>&nbsp;<label for='answer-id-3558' id='answer-label-3558' class=' answer label-6'><span class='answer'>if x &gt; 10: {print(&#8216;x is greater than 10&#8217;)} else: {print(&#8216;x is not greater than 10&#8217;)}<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3559' \/><div class='watu-question-choice'><input type='radio' name='answer-836[]' id='answer-id-3559' class='answer answer-6  answerof-836' value='3559' \/>&nbsp;<label for='answer-id-3559' id='answer-label-3559' class=' answer label-6'><span class='answer'>if x &gt; 10: print(&#8216;x is greater than 10&#8217;) else: print(&#8216;x is not greater than 10&#8217;)<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3557' \/><div class='watu-question-choice'><input type='radio' name='answer-836[]' id='answer-id-3557' class='answer answer-6  answerof-836' value='3557' \/>&nbsp;<label for='answer-id-3557' id='answer-label-3557' class=' answer label-6'><span class='answer'>if x &gt; 10 then print(&#8216;x is greater than 10&#8217;) else print(&#8216;x is not greater than 10&#8217;)<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3560' \/><div class='watu-question-choice'><input type='radio' name='answer-836[]' id='answer-id-3560' class='answer answer-6  answerof-836' value='3560' \/>&nbsp;<label for='answer-id-3560' id='answer-label-3560' class=' answer label-6'><span class='answer'>if (x &gt; 10) {print(&#8216;x is greater than 10&#8217;)} else {print(&#8216;x is not greater than 10&#8217;)}<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType6' value='radio' class=''><\/div><div class='watu-question' id='question-7'><div class='question-content'><p><span class='watu_num'>7. <\/span>For the code shared below, what value of $x$ will produce the output \u201cHow are you?\u201d?<\/p>\n<pre><code>if(x!=1):\r\n     print('How are you?')\r\nelse:\r\n     print('Hi')<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='831' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3631' \/><div class='watu-question-choice'><input type='checkbox' name='answer-831[]' id='answer-id-3631' class='answer answer-7  answerof-831' value='3631' \/>&nbsp;<label for='answer-id-3631' id='answer-label-3631' class=' answer label-7'><span class='answer'>x = 1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3632' \/><div class='watu-question-choice'><input type='checkbox' name='answer-831[]' id='answer-id-3632' class='answer answer-7  answerof-831' value='3632' \/>&nbsp;<label for='answer-id-3632' id='answer-label-3632' class=' answer label-7'><span class='answer'>x = &#8220;7&#8221;<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3629' \/><div class='watu-question-choice'><input type='checkbox' name='answer-831[]' id='answer-id-3629' class='answer answer-7  answerof-831' value='3629' \/>&nbsp;<label for='answer-id-3629' id='answer-label-3629' class=' answer label-7'><span class='answer'>x = 0<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3630' \/><div class='watu-question-choice'><input type='checkbox' name='answer-831[]' id='answer-id-3630' class='answer answer-7  answerof-831' value='3630' \/>&nbsp;<label for='answer-id-3630' id='answer-label-3630' class=' answer label-7'><span class='answer'>x = 6<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType7' value='checkbox' class=''><\/div><div class='watu-question' id='question-8'><div class='question-content'><p><span class='watu_num'>8. <\/span>What will be the result of the following?<\/p>\n<pre><code>for x in range(0, 3):\r\n     print(x)<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='822' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3594' \/><div class='watu-question-choice'><input type='radio' name='answer-822[]' id='answer-id-3594' class='answer answer-8  answerof-822' value='3594' \/>&nbsp;<label for='answer-id-3594' id='answer-label-3594' class=' answer label-8'><span class='answer'>0<br \/>\n1<br \/>\n2<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3595' \/><div class='watu-question-choice'><input type='radio' name='answer-822[]' id='answer-id-3595' class='answer answer-8  answerof-822' value='3595' \/>&nbsp;<label for='answer-id-3595' id='answer-label-3595' class=' answer label-8'><span class='answer'>0<br \/>\n1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3593' \/><div class='watu-question-choice'><input type='radio' name='answer-822[]' id='answer-id-3593' class='answer answer-8  answerof-822' value='3593' \/>&nbsp;<label for='answer-id-3593' id='answer-label-3593' class=' answer label-8'><span class='answer'>0<br \/>\n1<br \/>\n2<br \/>\n3<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3596' \/><div class='watu-question-choice'><input type='radio' name='answer-822[]' id='answer-id-3596' class='answer answer-8  answerof-822' value='3596' \/>&nbsp;<label for='answer-id-3596' id='answer-label-3596' class=' answer label-8'><span class='answer'>1<br \/>\n2<br \/>\n3<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType8' value='radio' class=''><\/div><div class='watu-question' id='question-9'><div class='question-content'><p><span class='watu_num'>9. <\/span>In Python, what is the result of the following code?<\/p>\n<pre><code>x = 0\r\nwhile x &lt; 3:\r\n      x += 1\r\nprint(x)<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='833' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3637' \/><div class='watu-question-choice'><input type='radio' name='answer-833[]' id='answer-id-3637' class='answer answer-9  answerof-833' value='3637' \/>&nbsp;<label for='answer-id-3637' id='answer-label-3637' class=' answer label-9'><span class='answer'>2<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3639' \/><div class='watu-question-choice'><input type='radio' name='answer-833[]' id='answer-id-3639' class='answer answer-9  answerof-833' value='3639' \/>&nbsp;<label for='answer-id-3639' id='answer-label-3639' class=' answer label-9'><span class='answer'>0<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3638' \/><div class='watu-question-choice'><input type='radio' name='answer-833[]' id='answer-id-3638' class='answer answer-9  answerof-833' value='3638' \/>&nbsp;<label for='answer-id-3638' id='answer-label-3638' class=' answer label-9'><span class='answer'>1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3640' \/><div class='watu-question-choice'><input type='radio' name='answer-833[]' id='answer-id-3640' class='answer answer-9  answerof-833' value='3640' \/>&nbsp;<label for='answer-id-3640' id='answer-label-3640' class=' answer label-9'><span class='answer'>3<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType9' value='radio' class=''><\/div><div class='watu-question' id='question-10'><div class='question-content'><p><span class='watu_num'>10. <\/span>What will be the output of the following Python code?<\/p>\n<pre><code>x = 5\r\ny = 10\r\nif x &gt; y:\r\n     print('x is greater than y')\r\nelse:\r\n     print('x is less than or equal to y')<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='834' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3644' \/><div class='watu-question-choice'><input type='radio' name='answer-834[]' id='answer-id-3644' class='answer answer-10  answerof-834' value='3644' \/>&nbsp;<label for='answer-id-3644' id='answer-label-3644' class=' answer label-10'><span class='answer'>x is less than or equal to y<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3643' \/><div class='watu-question-choice'><input type='radio' name='answer-834[]' id='answer-id-3643' class='answer answer-10  answerof-834' value='3643' \/>&nbsp;<label for='answer-id-3643' id='answer-label-3643' class=' answer label-10'><span class='answer'>x is less than y<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3642' \/><div class='watu-question-choice'><input type='radio' name='answer-834[]' id='answer-id-3642' class='answer answer-10  answerof-834' value='3642' \/>&nbsp;<label for='answer-id-3642' id='answer-label-3642' class=' answer label-10'><span class='answer'>x is greater than y<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3641' \/><div class='watu-question-choice'><input type='radio' name='answer-834[]' id='answer-id-3641' class='answer answer-10  answerof-834' value='3641' \/>&nbsp;<label for='answer-id-3641' id='answer-label-3641' class=' answer label-10'><span class='answer'>x is greater than y by 5<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType10' value='radio' class=''><\/div><div class='watu-question' id='question-11'><div class='question-content'><p><span class='watu_num'>11. <\/span>What is the output of the following?<\/p>\n<pre><code>for i in range(1,5):\r\n     if (i!=2):\r\n        print(i)<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='832' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3633' \/><div class='watu-question-choice'><input type='radio' name='answer-832[]' id='answer-id-3633' class='answer answer-11  answerof-832' value='3633' \/>&nbsp;<label for='answer-id-3633' id='answer-label-3633' class=' answer label-11'><span class='answer'>1<br \/>\n3<br \/>\n4<br \/>\n5<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3634' \/><div class='watu-question-choice'><input type='radio' name='answer-832[]' id='answer-id-3634' class='answer answer-11  answerof-832' value='3634' \/>&nbsp;<label for='answer-id-3634' id='answer-label-3634' class=' answer label-11'><span class='answer'>1<br \/>\n3<br \/>\n4<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3635' \/><div class='watu-question-choice'><input type='radio' name='answer-832[]' id='answer-id-3635' class='answer answer-11  answerof-832' value='3635' \/>&nbsp;<label for='answer-id-3635' id='answer-label-3635' class=' answer label-11'><span class='answer'>1<br \/>\n2<br \/>\n3<br \/>\n4<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3636' \/><div class='watu-question-choice'><input type='radio' name='answer-832[]' id='answer-id-3636' class='answer answer-11  answerof-832' value='3636' \/>&nbsp;<label for='answer-id-3636' id='answer-label-3636' class=' answer label-11'><span class='answer'>2<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType11' value='radio' class=''><\/div><div class='watu-question' id='question-12'><div class='question-content'><p><span class='watu_num'>12. <\/span>Which loop is used when the number of iterations is unknown?<\/p>\n<\/div><input type='hidden' name='question_id[]' value='838' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3568' \/><div class='watu-question-choice'><input type='radio' name='answer-838[]' id='answer-id-3568' class='answer answer-12  answerof-838' value='3568' \/>&nbsp;<label for='answer-id-3568' id='answer-label-3568' class=' answer label-12'><span class='answer'>Infinite loop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3565' \/><div class='watu-question-choice'><input type='radio' name='answer-838[]' id='answer-id-3565' class='answer answer-12  answerof-838' value='3565' \/>&nbsp;<label for='answer-id-3565' id='answer-label-3565' class=' answer label-12'><span class='answer'>for loop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3566' \/><div class='watu-question-choice'><input type='radio' name='answer-838[]' id='answer-id-3566' class='answer answer-12  answerof-838' value='3566' \/>&nbsp;<label for='answer-id-3566' id='answer-label-3566' class=' answer label-12'><span class='answer'>while loop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3567' \/><div class='watu-question-choice'><input type='radio' name='answer-838[]' id='answer-id-3567' class='answer answer-12  answerof-838' value='3567' \/>&nbsp;<label for='answer-id-3567' id='answer-label-3567' class=' answer label-12'><span class='answer'>Nested loop<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType12' value='radio' class=''><\/div><div class='watu-question' id='question-13'><div class='question-content'><p><span class='watu_num'>13. <\/span>Which of the following correctly demonstrates the use of an if-else statement to check if a variable &#8216;x&#8217; is greater than 10 and print &#8216;High&#8217; if true, or &#8216;Low&#8217; if false?<\/p>\n<\/div><input type='hidden' name='question_id[]' value='837' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3562' \/><div class='watu-question-choice'><input type='radio' name='answer-837[]' id='answer-id-3562' class='answer answer-13  answerof-837' value='3562' \/>&nbsp;<label for='answer-id-3562' id='answer-label-3562' class=' answer label-13'><span class='answer'>if (x &gt; 10): print(&#8216;High&#8217;) if x &lt;= 10: print(&#039;Low&#039;)<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3564' \/><div class='watu-question-choice'><input type='radio' name='answer-837[]' id='answer-id-3564' class='answer answer-13  answerof-837' value='3564' \/>&nbsp;<label for='answer-id-3564' id='answer-label-3564' class=' answer label-13'><span class='answer'>if x &gt; 10: print(&#8216;High&#8217;) print(&#8216;Low&#8217;)<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3563' \/><div class='watu-question-choice'><input type='radio' name='answer-837[]' id='answer-id-3563' class='answer answer-13  answerof-837' value='3563' \/>&nbsp;<label for='answer-id-3563' id='answer-label-3563' class=' answer label-13'><span class='answer'>if x &gt; 10 then: print(&#8216;High&#8217;) else: print(&#8216;Low&#8217;)<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3561' \/><div class='watu-question-choice'><input type='radio' name='answer-837[]' id='answer-id-3561' class='answer answer-13  answerof-837' value='3561' \/>&nbsp;<label for='answer-id-3561' id='answer-label-3561' class=' answer label-13'><span class='answer'>if x &gt; 10: print(&#8216;High&#8217;) else: print(&#8216;Low&#8217;)<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType13' value='radio' class=''><\/div><div class='watu-question' id='question-14'><div class='question-content'><p><span class='watu_num'>14. <\/span>What does the break statement do in a loop?<\/p>\n<\/div><input type='hidden' name='question_id[]' value='839' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3572' \/><div class='watu-question-choice'><input type='radio' name='answer-839[]' id='answer-id-3572' class='answer answer-14  answerof-839' value='3572' \/>&nbsp;<label for='answer-id-3572' id='answer-label-3572' class=' answer label-14'><span class='answer'>Continues to the next iteration<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3570' \/><div class='watu-question-choice'><input type='radio' name='answer-839[]' id='answer-id-3570' class='answer answer-14  answerof-839' value='3570' \/>&nbsp;<label for='answer-id-3570' id='answer-label-3570' class=' answer label-14'><span class='answer'>Restarts the loop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3569' \/><div class='watu-question-choice'><input type='radio' name='answer-839[]' id='answer-id-3569' class='answer answer-14  answerof-839' value='3569' \/>&nbsp;<label for='answer-id-3569' id='answer-label-3569' class=' answer label-14'><span class='answer'>Skips the current iteration<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3571' \/><div class='watu-question-choice'><input type='radio' name='answer-839[]' id='answer-id-3571' class='answer answer-14  answerof-839' value='3571' \/>&nbsp;<label for='answer-id-3571' id='answer-label-3571' class=' answer label-14'><span class='answer'>Exits the loop entirely<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType14' value='radio' class=''><\/div><div class='watu-question' id='question-15'><div class='question-content'><p><span class='watu_num'>15. <\/span>What is the output of the following?<\/p>\n<pre><code>for i, x in enumerate(['A', 'B', 'C']):\r\n     print(i, x)<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='824' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3601' \/><div class='watu-question-choice'><input type='radio' name='answer-824[]' id='answer-id-3601' class='answer answer-15  answerof-824' value='3601' \/>&nbsp;<label for='answer-id-3601' id='answer-label-3601' class=' answer label-15'><span class='answer'>AA<br \/>\nBB<br \/>\nCC<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3604' \/><div class='watu-question-choice'><input type='radio' name='answer-824[]' id='answer-id-3604' class='answer answer-15  answerof-824' value='3604' \/>&nbsp;<label for='answer-id-3604' id='answer-label-3604' class=' answer label-15'><span class='answer'>0 A<br \/>\n1 B<br \/>\n2 C<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3602' \/><div class='watu-question-choice'><input type='radio' name='answer-824[]' id='answer-id-3602' class='answer answer-15  answerof-824' value='3602' \/>&nbsp;<label for='answer-id-3602' id='answer-label-3602' class=' answer label-15'><span class='answer'>0<br \/>\n1<br \/>\n2<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3603' \/><div class='watu-question-choice'><input type='radio' name='answer-824[]' id='answer-id-3603' class='answer answer-15  answerof-824' value='3603' \/>&nbsp;<label for='answer-id-3603' id='answer-label-3603' class=' answer label-15'><span class='answer'>A 0<br \/>\nB 1<br \/>\nC 2<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType15' value='radio' class=''><\/div><div class='watu-question' id='question-16'><div class='question-content'><p><span class='watu_num'>16. <\/span>What is the output of the following code?<\/p>\n<pre><code>x = \"Go\"\r\nif x == \"Go\":\r\n    print('Go')\r\nelse:\r\n    print('Stop')\r\nprint('Mike')<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='826' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3612' \/><div class='watu-question-choice'><input type='radio' name='answer-826[]' id='answer-id-3612' class='answer answer-16  answerof-826' value='3612' \/>&nbsp;<label for='answer-id-3612' id='answer-label-3612' class=' answer label-16'><span class='answer'>Mike<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3609' \/><div class='watu-question-choice'><input type='radio' name='answer-826[]' id='answer-id-3609' class='answer answer-16  answerof-826' value='3609' \/>&nbsp;<label for='answer-id-3609' id='answer-label-3609' class=' answer label-16'><span class='answer'>Go Stop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3611' \/><div class='watu-question-choice'><input type='radio' name='answer-826[]' id='answer-id-3611' class='answer answer-16  answerof-826' value='3611' \/>&nbsp;<label for='answer-id-3611' id='answer-label-3611' class=' answer label-16'><span class='answer'>Go Mike<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3610' \/><div class='watu-question-choice'><input type='radio' name='answer-826[]' id='answer-id-3610' class='answer answer-16  answerof-826' value='3610' \/>&nbsp;<label for='answer-id-3610' id='answer-label-3610' class=' answer label-16'><span class='answer'>Stop Mike<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType16' value='radio' class=''><\/div><div class='watu-question' id='question-17'><div class='question-content'><p><span class='watu_num'>17. <\/span>What is the output of the following lines of code?<\/p>\n<pre><code>a = 1\r\ndef do(x):\r\n    return x + a\r\nprint(do(1)<\/code>)<\/pre>\n<\/div><input type='hidden' name='question_id[]' value='830' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3628' \/><div class='watu-question-choice'><input type='radio' name='answer-830[]' id='answer-id-3628' class='answer answer-17  answerof-830' value='3628' \/>&nbsp;<label for='answer-id-3628' id='answer-label-3628' class=' answer label-17'><span class='answer'>NameError: Name &#8216;a&#8217; is not defined<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3625' \/><div class='watu-question-choice'><input type='radio' name='answer-830[]' id='answer-id-3625' class='answer answer-17  answerof-830' value='3625' \/>&nbsp;<label for='answer-id-3625' id='answer-label-3625' class=' answer label-17'><span class='answer'>0<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3626' \/><div class='watu-question-choice'><input type='radio' name='answer-830[]' id='answer-id-3626' class='answer answer-17  answerof-830' value='3626' \/>&nbsp;<label for='answer-id-3626' id='answer-label-3626' class=' answer label-17'><span class='answer'>1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3627' \/><div class='watu-question-choice'><input type='radio' name='answer-830[]' id='answer-id-3627' class='answer answer-17  answerof-830' value='3627' \/>&nbsp;<label for='answer-id-3627' id='answer-label-3627' class=' answer label-17'><span class='answer'>2<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType17' value='radio' class=''><\/div><div class='watu-question' id='question-18'><div class='question-content'><p><span class='watu_num'>18. <\/span>What is the output of the following<\/p>\n<pre><code>for x in ['A', 'B', 'C']:\r\n      print(x+'A')<\/code><\/pre>\n<\/div><input type='hidden' name='question_id[]' value='823' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3599' \/><div class='watu-question-choice'><input type='radio' name='answer-823[]' id='answer-id-3599' class='answer answer-18  answerof-823' value='3599' \/>&nbsp;<label for='answer-id-3599' id='answer-label-3599' class=' answer label-18'><span class='answer'>AA<br \/>\nBA<br \/>\nCA<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3597' \/><div class='watu-question-choice'><input type='radio' name='answer-823[]' id='answer-id-3597' class='answer answer-18  answerof-823' value='3597' \/>&nbsp;<label for='answer-id-3597' id='answer-label-3597' class=' answer label-18'><span class='answer'>A<br \/>\nB<br \/>\nC<br \/>\nA<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3600' \/><div class='watu-question-choice'><input type='radio' name='answer-823[]' id='answer-id-3600' class='answer answer-18  answerof-823' value='3600' \/>&nbsp;<label for='answer-id-3600' id='answer-label-3600' class=' answer label-18'><span class='answer'>A<br \/>\nB<br \/>\nC<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3598' \/><div class='watu-question-choice'><input type='radio' name='answer-823[]' id='answer-id-3598' class='answer answer-18  answerof-823' value='3598' \/>&nbsp;<label for='answer-id-3598' id='answer-label-3598' class=' answer label-18'><span class='answer'>AA<br \/>\nBB<br \/>\nCC<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType18' value='radio' class=''><\/div><div class='watu-question' id='question-19'><div class='question-content'><p><span class='watu_num'>19. <\/span>Which loop is best for iterating over a list?<\/p>\n<\/div><input type='hidden' name='question_id[]' value='840' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3576' \/><div class='watu-question-choice'><input type='radio' name='answer-840[]' id='answer-id-3576' class='answer answer-19  answerof-840' value='3576' \/>&nbsp;<label for='answer-id-3576' id='answer-label-3576' class=' answer label-19'><span class='answer'>Recursion<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3573' \/><div class='watu-question-choice'><input type='radio' name='answer-840[]' id='answer-id-3573' class='answer answer-19  answerof-840' value='3573' \/>&nbsp;<label for='answer-id-3573' id='answer-label-3573' class=' answer label-19'><span class='answer'>while loop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3575' \/><div class='watu-question-choice'><input type='radio' name='answer-840[]' id='answer-id-3575' class='answer answer-19  answerof-840' value='3575' \/>&nbsp;<label for='answer-id-3575' id='answer-label-3575' class=' answer label-19'><span class='answer'>do-while loop<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3574' \/><div class='watu-question-choice'><input type='radio' name='answer-840[]' id='answer-id-3574' class='answer answer-19  answerof-840' value='3574' \/>&nbsp;<label for='answer-id-3574' id='answer-label-3574' class=' answer label-19'><span class='answer'>for loop<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType19' value='radio' class=''><\/div><div class='watu-question' id='question-20'><div class='question-content'><p><span class='watu_num'>20. <\/span>Identify which of the following while loops will correctly execute 5 times.<\/p>\n<\/div><input type='hidden' name='question_id[]' value='835' \/><div class='watu-questions-wrap '><input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3556' \/><div class='watu-question-choice'><input type='checkbox' name='answer-835[]' id='answer-id-3556' class='answer answer-20  answerof-835' value='3556' \/>&nbsp;<label for='answer-id-3556' id='answer-label-3556' class=' answer label-20'><span class='answer'>counter = 1 while counter &lt; 5: print(counter) counter += 1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3553' \/><div class='watu-question-choice'><input type='checkbox' name='answer-835[]' id='answer-id-3553' class='answer answer-20  answerof-835' value='3553' \/>&nbsp;<label for='answer-id-3553' id='answer-label-3553' class=' answer label-20'><span class='answer'>counter = 0 while counter &lt; 5: print(counter) counter += 1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3554' \/><div class='watu-question-choice'><input type='checkbox' name='answer-835[]' id='answer-id-3554' class='answer answer-20  answerof-835' value='3554' \/>&nbsp;<label for='answer-id-3554' id='answer-label-3554' class=' answer label-20'><span class='answer'>counter = 1 while counter &lt; 6: print(counter) counter += 1<\/span><\/label><\/div>\n<input type='hidden' name='answer_ids[]' class='watu-answer-ids' value='3555' \/><div class='watu-question-choice'><input type='checkbox' name='answer-835[]' id='answer-id-3555' class='answer answer-20  answerof-835' value='3555' \/>&nbsp;<label for='answer-id-3555' id='answer-label-3555' class=' answer label-20'><span class='answer'>counter = 0 while counter &lt;= 5: print(counter) counter += 1<\/span><\/label><\/div>\n<\/div><input type='hidden' id='questionType20' value='checkbox' class=''><\/div><div style='display:none' id='question-21'><br \/><div class='question-content'><img decoding=\"async\" src=\"https:\/\/rfaqs.com\/wp-content\/plugins\/watu\/loading.gif\" width=\"16\" height=\"16\" alt=\"Loading ...\" title=\"Loading ...\" \/>&nbsp;Loading &#8230;<\/div><\/div><br \/>\n\t<p>Question <span id='numQ'>1<\/span> of 20<\/p>\n\t\t\t<input type=\"button\" id=\"prev-question\" value=\"&lt; Previous\" onclick=\"Watu.nextQuestion(event, 'prev');\" style=\"display:none;\" \/>\n\t\t<input type=\"button\" id=\"next-question\" value=\"Next &gt;\"  \/>\n\t<input type=\"submit\" name=\"submit_no_ajax\" id=\"action-button\" class=\"watu-submit-button\" value=\"Submit\" \/>\n<input type=\"hidden\" name=\"no_ajax\" value=\"1\"><input type=\"hidden\" name=\"do\" value=\"show_exam_result\">\n<input type=\"hidden\" name=\"post_id\" value=\"9493\">\n<input type=\"hidden\" name=\"quiz_id\" value=\"43\" \/>\n<input type=\"hidden\" id=\"watuStartTime\" name=\"start_time\" value=\"2026-04-24 06:06:49\" \/>\n<\/form>\n<\/div>\n<div id=\"watu-loading-result\" style=\"display:none;\">\n\t<p align=\"center\"><img decoding=\"async\" src=\"https:\/\/rfaqs.com\/wp-content\/plugins\/watu\/loading.gif\" width=\"16\" height=\"16\" alt=\"Loading\" title=\"Loading\" \/><\/p>\n<\/div>\t\n<script type=\"text\/javascript\">\nvar exam_id=0;\nvar question_ids='';\nvar watuURL='';\njQuery(function($){\nquestion_ids = \"821,827,829,825,828,836,831,822,833,834,832,838,837,839,824,826,830,823,840,835\";\nexam_id = 43;\nWatu.exam_id = exam_id;\nWatu.qArr = question_ids.split(',');\nWatu.post_id = 9493;\nWatu.singlePage = '0';\nWatu.hAppID = \"0.06339300 1776992809\";\nwatuURL = \"https:\/\/rfaqs.com\/wp-admin\/admin-ajax.php\";\nWatu.noAlertUnanswered = 0;\n});\n<\/script>\n\n\n\n<h3 class=\"wp-block-heading\">Online Python Control Structures Quiz with Answers<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Which of the following best describes the purpose of the &#8216;elif&#8217; statement in a conditional structure?<\/li>\n\n\n\n<li>What will be the result of the following?<br>for x in range(0, 3):<br>      print(x)<\/li>\n\n\n\n<li>What is the output of the following<br>for x in [&#8216;A&#8217;, &#8216;B&#8217;, &#8216;C&#8217;]:<br>      print(x+&#8217;A&#8217;)<\/li>\n\n\n\n<li>What is the output of the following?<br>for i, x in enumerate([&#8216;A&#8217;, &#8216;B&#8217;, &#8216;C&#8217;]):<br>      print(i, x)<\/li>\n\n\n\n<li>What result does the following code produce?<br>def print_function(A):<br>      for a in A:<br>           print(a + &#8216;1&#8217;)<\/li>\n\n\n\n<li>What is the output of the following code?<br>x = &#8220;Go&#8221;<br>if x == &#8220;Go&#8221;:<br>       print(&#8216;Go&#8217;)<br>else:<br>       print(&#8216;Stop&#8217;)<br>print(&#8216;Mike&#8217;)<\/li>\n\n\n\n<li>What is the result of the following lines of code?<br>x = 0<br>while x &lt; 2:<br>     print(x)<br>     x = x + 1<\/li>\n\n\n\n<li>What is the output of the following few lines of code?<br>for i, x in enumerate([&#8216;A&#8217;, &#8216;B&#8217;, &#8216;C&#8217;]):<br>       print(i + 1, x)<\/li>\n\n\n\n<li>Considering the function step, when will the following function return a value of 1?<br>def step(x):<br>      if x > 0:<br>            y = 1<br>      else:<br>            y = 0<br>      return y<\/li>\n\n\n\n<li>What is the output of the following lines of code?<br>a = 1<br>def do(x):<br>       return x + a<br>print(do(1))<\/li>\n\n\n\n<li>For the code shared below, what value of $x$ will produce the output \u201cHow are you?\u201d?<br>if(x!=1):<br>       print(&#8216;How are you?&#8217;)<br>else:<br>       print(&#8216;Hi&#8217;)<\/li>\n\n\n\n<li>What is the output of the following?<br>for i in range(1,5):<br>       if (i!=2):<br>           print(i)<\/li>\n\n\n\n<li>In Python, what is the result of the following code?<br>x = 0<br>while x &lt; 3:<br>       x += 1<br>print(x)<\/li>\n\n\n\n<li>What will be the output of the following Python code?<br>x = 5<br>y = 10<br>if x > y:<br>      print(&#8216;x is greater than y&#8217;)<br>else:<br>      print(&#8216;x is less than or equal to y&#8217;)<\/li>\n\n\n\n<li>Identify which of the following while loops will correctly execute 5 times.<\/li>\n\n\n\n<li>Which of the following statements correctly demonstrates the use of an if-else conditional statement in Python?<\/li>\n\n\n\n<li>Which of the following correctly demonstrates the use of an if-else statement to check if a variable &#8216;x&#8217; is greater than 10 and print &#8216;High&#8217; if true, or &#8216;Low&#8217; if false?<\/li>\n\n\n\n<li>Which loop is used when the number of iterations is unknown?<\/li>\n\n\n\n<li>What does the break statement do in a loop?<\/li>\n\n\n\n<li>Which loop is best for iterating over a list?<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-center\"><a href=\"https:\/\/itfeature.com\" target=\"_blank\" rel=\"noreferrer noopener\">Statistics for Data Analysts and Data Scientists<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Master Python Control Structures with this interactive quiz! This Python Control Structures Quiz is designed for students, programmers, data analysts, and IT professionals. This Python Quiz tests your understanding of if-else, loops (for\/while), and flow control in Python. Whether you &#8230; <a title=\"Python Control Structures Quiz 12\" class=\"read-more\" href=\"https:\/\/rfaqs.com\/python-quizzes\/python-control-structures-quiz-12\/\" aria-label=\"Read more about Python Control Structures Quiz 12\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[159],"tags":[],"class_list":["post-9493","post","type-post","status-publish","format-standard","hentry","category-python-quizzes"],"jetpack_publicize_connections":[],"_links":{"self":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/posts\/9493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/comments?post=9493"}],"version-history":[{"count":0,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/posts\/9493\/revisions"}],"wp:attachment":[{"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/media?parent=9493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/categories?post=9493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rfaqs.com\/wp-json\/wp\/v2\/tags?post=9493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}