Which iteration structure executes a sequence of statements repeatedly as long as condition is true

Mcqs Clouds

mcqs.teswesm.com

Which structure executes a sequence of statements repeatedly as long as a condition holds true?

A. Selection structure

B. Iteration structure

C. Sequence structure

D. None of the above

Solution by Mcqs Clouds

Answer: Option B

Explanation:
No explanation is available for this question!

Join The Discussion

Comments

    Related Questions on PL SQL Interview Questions

    1 The ______ control structures are statements that enable you to executestatements in a PL/SQL block repeatedly.

    Get answer to your question and much more

    2 The ______ statement enables PL/SQL to perform actions selectively based onconditions.

    Get answer to your question and much more

    3 SQL%FOUND, SQL%NOTFOUND, and SQL%ROWCOUNT are:

    Get answer to your question and much more

    4 In for loop, counter must be explicitly declared.

    Get answer to your question and much more

    5 A ________ is an expression that determines a course of action based onconditions and can be used outside a PL/SQL block in a SQL statement.

    Get answer to your question and much more

    6 The statement used to terminate a loop is _______.

    Get answer to your question and much more

    7 In retrieving data in PL/SQL, the INTO clause occurs after the WHERE clause andis mandatory.

    Get answer to your question and much more

    8 The lower and upper bound of a for loop must be a numeric literals.Group of answer choices

    Get answer to your question and much more

    9 Use _______ to declare a variable as a record based on the structure of the

     </td></tr> </form></tbody></table> <center> <table width="800"> <tbody><tr> <td align="center" valign="top" height="100%" width="230"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="150"> <tbody><tr> <td align="center" valign="top" bgcolor="#F8F8FF" width="150"> <font><img src="https://scientificsentence.net/PLSQL/images/empty.gif" width="5" height="1"></font> <table border="0" cellpadding="2" cellspacing="0"> <tbody><tr> <td valign="top" align="center"> <center> <h2 class="left"> Contents </h2> <br> <hr width="50%"> <b>Oracle- Forms - PL/SQL</b> <hr width="50%"> <h2 class="left"> Database </h2> <hr width="50%"> <b>Orders and Tables</b> <hr width="50%"> <ul> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=sql_order">Database - Main orders</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=table_insurance">Tables Insurance</a></li> </ul> <hr width="50%"> <h2 class="left"> PL/SQL </h2> <hr width="50%"> <ul> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=PLSQL">LP/SQL</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=statements">PL/SQL Statements</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=plsql_advanced">PL/SQL Programming</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=plsql_php">PHP &amp; PL/SQL</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=plsql_java">Java &amp; PL/SQL</a></li> </ul> <hr width="50%"> <h2 class="left"> Oracle- Forms </h2> <hr width="50%"> <ul> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=install_forms">Installing Oracle Forms</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=form_connection">Setting up a connection</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=form_builder">Using Oracle Forms Builder</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=example_join">Forms &amp; joining relations</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=forms_plsql">Forms &amp; PL/SQL</a></li> <li><a target="_blank" href="https://scientificsentence.net/PLSQL/index.php?key=yes&Integer=home">home</a></li> </ul> <br> <br> <table> <tbody><tr> <td align="center"> <b><font size="2" face="Bookman old style" color="blue">Search a word:</font><b></b></b></td></tr><tr> <td align="center"> <input type="text" name="terms" size="15"></td> <td><input type="hidden" name="key" value="yess" size="20"></td> </tr> <tr> <td align="center"> <input type="submit" value="Find">&nbsp;&nbsp;&nbsp; <input type="reset"> </td> </tr> </tbody></table> <br><br> <hr width="75%" align="left"> <small>© The scientific sentence. 2010 </small> <br><br> </center></td><td class="espace" valign="top"> <title>Statements</title> <br> <h2>PL/SQL Control Structures</h2> <hr width="70%" align="left"> <pre>In any computer program, a <i>condition</i> is a variable or expression that returns a Boolean value (TRUE or FALSE). Generally, we have three <i>controls structures</i>: - The <i>selection structure</i> that tests a condition, and then executes one sequence of statements instead of another, depending on whether the condition is true or false, - The <i>iteration structure</i> that executes a sequence of statements repeatedly as long as a condition is true. - The <i>sequence structure</i> that simply executes a sequence of statements in the order in which they occur. </pre> <br> <h3>1. IF and CASE statements</h3><pre>The <i>IF statement</i> executes a sequence of statements depending on the value of a condition (true or false). There are three forms of IF statements: <b>IF-THEN</b>, <b>IF-THEN-ELSE</b>, and <b>IF-THEN-ELSIF</b>. The <b>CASE</b> statement is used when the condition takes several cases; each corresponds to its related action. </pre> <h4>1.1. IF-THEN Statement</h4> <pre>The sytax is:<font color="maroon"> IF condition THEN // the sequence of statements goes here .. END IF; </font> The sequence of statements is executed only if the condition is true, otherwise the IF statement does nothing. </pre> <h4>1.2. IF-THEN-ELSE Statement</h4><pre>Here, the keyword ELSE is added for an alternative sequense of statements. followed by an alternative sequence of statements. The syntax is: <font color="maroon">IF condition THEN // the sequence of statements 1 goes here .. ELSE // the sequence of statements 2 goes here .. END IF; </font> Here, in the case where the condition is false or null, "the sequence of statements 2" is executed. The clauses THEN and ELSE can include IF statements. </pre> <h4>1.3. IF-THEN-ELSIF Statement</h4><pre>The syntax is: <font color="maroon"> IF condition1 THEN // the sequence of statements 1 goes here .. ELSIF condition2 THEN // the sequence of statements 2 goes here .. ELSE sequence_of_statements3 END IF; </font> Here a second condition is introduced. The <i>ELSIF clause</i> tests another condition (condition2), If the first condition is false or null. We can have several ELSIF clauses following the first IF. The ELSE clause is optional and executed when all the conditions are false or null. </pre> <h4>1.4. CASE Statement</h4><pre>The CASE statement replaces the IF-THEN-ELSIF Statement containinig several ELSIF's. To select and execute <b>one</b> sequence of statements, The CASE statement uses a <i>selector</i> (that is an expression whose value is used to select one of several alternatives. It could be also a function call). The syntax is: <font color="maroon"> <em>&lt;&lt;label_name&gt;&gt;</em> CASE selector WHEN expression1 THEN sequence_of_statements_1; WHEN expression2 THEN sequence_of_statements_2; ... WHEN expressionN THEN sequence_of_statements_N; <b>ELSE sequence_of_statements_N+1;</b> END CASE <em>label_name</em>; </font> The label is optional. The ELSE clause is optional. It is a default action. When omitted, and all the WHEN clauses fail, PL/SQL will add "ELSE RAISE CASE_NOT_FOUND;" which is a predefined exception, and therefore outputs "CASE_NOT_FOUND". </pre> <h4>1.5. Searched CASE Statement</h4> <pre>In the <i>searched CASE statement</i>, we have no selector. It is included in the search_condition expression. It yiels a boolean value, that determine which WHEN clause is executed. <em>&lt;&lt;label_name&gt;&gt;</em> CASE WHEN search_condition1 THEN sequence_of_statements_1; WHEN search_condition2 THEN sequence_of_statements_2; ... WHEN search_conditionN THEN sequence_of_statements_N; <b>ELSE sequence_of_statements_N+1;</b> END CASE <em>label_name</em>; The expression "search_condition_x" could be as follows: WHEN <b>selector = something </b> THEN do_some_thing .. ; </pre> <br> <h3>2. Iterative Control: LOOP and EXIT Statements</h3><pre><i>LOOP statements</i> executes a sequence of statements several times. There are three forms of LOOP statements: LOOP, WHILE-LOOP, and FOR-LOOP. </pre> <h4>2.1. LOOP</h4> <pre>The syntax is: <font color="maroon">LOOP // The sequence of statements go here .. END LOOP; </font> For each iteration of the loop, the sequence of statements is executed; then control start again from the top till the end of iterations. If further processing is not desirable, we use an <i>EXIT statement</i> to complete the loop. We can place any number of EXIT statement inside a loop. There are two forms of EXIT statements: <b>EXIT</b> and <b>EXIT-WHEN</b>. </pre> <h4>2.2. EXIT</h4> <pre>The EXIT statement stops a loop immediately. It is not used in PL/SQL blocks. In this case use <i>RETURN</i> instead. <u>Example:</u><font color="maroon"> LOOP ... IF condition .. ... EXIT; END IF; END LOOP; </font> </pre> <h4>2.3. EXIT-WHEN </h4> <pre>The EXIT-WHEN statement states a condition to be satisfied in order to stop the loop. <u>Example:</u> LOOP ... EXIT WHEN condition // the loop is left if condition is true ... END LOOP; Loops can be labeled: <em>&lt;&lt;label_name&gt;&gt;</em> LOOP sequence of statements .. END LOOP <em>label_name</em>; With the two forms of EXIT (EXIT or EXIT-WHEN) statement, we can complete the current loop and the loops that can be enclosed inside. In this case, we have to label the enclosing (the first) loop. This is an example: <font color="maroon"> <em>&lt;&lt;<i>label_name</i>&gt;&gt;</em> LOOP ... LOOP ... EXIT <i>label_name</i> WHEN ... END LOOP; ... END LOOP <i>label_name</i>; </font> The both loops are exited. </pre> <h4>2.4. WHILE-LOOP </h4> <pre>The syntax is: WHILE condition LOOP sequence of statements .. END LOOP; The condition is evaluated each iteration. If it is true, the sequence of statements is executed, then control restarts at the top of the loop. If the condition is false or null, the loop is left and control passes to the next statement. Some languages have a LOOP UNTIL or REPEAT UNTIL structure, which tests the condition at the bottom of the loop instead of at the top. Therefore, the sequence of statements is executed at least once. PL/SQL has no such structure, but you can easily build one, as follows: </pre> <h4>2.5. FOR-LOOP </h4> <pre>FOR loops iterate over a specified range of integers. We use double dot (..) ti indicate the range operator. The syntax is:<font color="maroon"> FOR <i>number</i> IN <b>range</b> LOOP sequence of statements .. END LOOP; </font> After each iteration, the loop <i>number</i> is incremented. Iteration can be processed downward; in this case, we use IN REVERSE keyword instead of IN alone. When we have enclosing loops, to specify each integer we mean, we label the loops and use dot notation as this example shows: <em>&lt;&lt;<b>label_name</b>&gt;&gt;</em> FOR <i>number</i> IN 1..6 LOOP FOR <i>number</i> IN 1..3 LOOP ... IF <b>label_name</b>.<i>number</i> ... THEN ... END LOOP; END LOOP <b>label_name</b>; We can use the EXIT Statement to quit a loop. For example: FOR j IN 1..7 LOOP FETCH custom_number INTO custom_table; EXIT WHEN custom_number%NOTFOUND; ... END LOOP; In the case that we have enclosing loops, we have to specify which loop to exit; for example if we want to quit the two loops at the same time, we write: <em>&lt;&lt;<i>label_name</i>&gt;&gt;</em> FOR i IN 1..7 LOOP ... FOR k IN 1..10 LOOP FETCH custom_number INTO custom_table; EXIT <i>label_name</i> WHEN custom_number %NOTFOUND; ... END LOOP; END LOOP <i>label_name</i>; </pre> </td> <td>&nbsp;&nbsp;</td> <td align="left" valign="top" height="170"> <table align="center" border="0" cellpadding="0" cellspacing="0" width="165" height="100%"> <tbody><tr> <td align="left" bgcolor="white" valign="top"> <table align="center" border="0" cellpadding="0" cellspacing="0"> <tbody><tr> <form method="get" action="http://www.google.com/custom" target="google_window"> </form></tr></tbody></table><table border="0"> <tbody><tr><td nowrap="nowrap" valign="top" align="left" height="32"> <a target="_blank" href="http://www.google.com/"> <img border="0" alt="Google" align="middle" class="ezlazyload" data-ezsrc="https://www.google.com/logos/Logo_25wht.gif"></a> </td> </tr> <tr> <td nowrap="nowrap"> <input type="hidden" name="domains" value="scientificsentence.net"> <input type="text" name="q" size="20" maxlength="155" value="" id="sbi"> </td></tr> <tr><td> <input type="submit" name="sa" value="Search" id="sbb"> </td></tr> <tr> <td nowrap="nowrap"> <table> <tbody><tr> <td> <input type="radio" name="sitesearch" value="" checked="checked"> <font size="-1" color="#000000">Web</font></td> </tr><tr> <td> <input type="radio" name="sitesearch" value="scientificsentence.net"> <font size="-1" color="#000000">ScientificSentence</font></td> </tr> </tbody></table> <input type="hidden" name="client" value="pub-8320962076161620"> <input type="hidden" name="forid" value="1"> <input type="hidden" name="ie" value="ISO-8859-1"> <input type="hidden" name="oe" value="ISO-8859-1"> <input type="hidden" name="safe" value="active"> <input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1"> <input type="hidden" name="hl" value="en"> </td></tr></tbody></table> </td> </tr> <tr><td height="20"> &nbsp;</td></tr> <tr> <td width="165"> <p align="center"> <br> </p> </td> </tr> </tbody></table> </td> </tr> </tbody></table> </td> </tr> </tbody></table> <br> <table align="center" border="0" cellpadding="0" cellspacing="0" width="750"> <tbody><tr> <td align="center" valign="top&quot;"> </td></tr></tbody></table> <table align="center" border="0" cellpadding="0" cellspacing="0" width="750"> <tbody><tr><td> <hr> </td></tr> <tr> <td align="center" valign="top&quot;"> <table align="center" border="0" cellpadding="0" cellspacing="0"> <tbody><tr> <td width="80" align="center" valign="top"><font class="content"><a target="_blank" class="head" href="https://scientificsentence.net/Chemistry_laboratories/index.php"><center>chimie labs </center></a></font></td> <td align="center" valign="top"><font class="content">|</font></td> <td width="120" align="center" valign="top"><font class="content"><a target="_blank" class="head" href="https://scientificsentence.net/index.shtml"><center>scientific sentence</center></a></font></td> <td align="center" valign="top"><font class="content">|</font></td> <td width="80" align="center" valign="top"><font class="content"><a target="_blank" class="head" href="https://scientificsentence.net/Java/index.html"><center>java</center></a></font></td> <td align="center" valign="top"><font class="content">|</font></td> <td width="80" align="center" valign="top"><font class="content"><a target="_blank" class="head" href="https://scientificsentence.net/PHP/CMS/books/server/index.php"><center>php</center> </a></font></td> <td align="center" valign="top"><font class="content">|</font></td> <td width="80" align="center" valign="top"><font class="content"><a target="_blank" class="head" href="https://scientificsentence.net/webTechnologies/index.html"><center>green cat</center></a></font></td> <td align="center" valign="top"><font class="content">|</font></td> <td width="80" align="center" valign="top"><font class="content"><a target="_blank" class="head" href="https://scientificsentence.net/PLSQL/Mail/Mail.html"><center>contact</center></a></font></td> <td align="center" valign="top"><font class="content">|</font></td> </tr> </tbody></table> </td> </tr> <tr><td> <hr> </td></tr> <tr><td> <br> </td></tr> <tr> <td align="center" bgcolor="#ffffff" colspan="3"><font class="footer"> <center> © <a href="http://scientificsentence.net/" target="_blank">Scientificsentence</a> 2009. All rights reserved. </center> <br> </font></td> </tr> <tr> <td bgcolor="#ffffff" colspan="3" height="7"></td> </tr> </tbody></table> </td></tr></tbody></table></center><div class="ezmob-footer ezoic-floating-bottom ezo_ad ezmob-footer-desktop" id="ezmobfooter"><center><span id="ezoic-pub-ad-placeholder-100"></span><div class="ezmob-footer ezoic-floating-bottom ezo_ad ezmob-footer-desktop" id="ezmobfooter"><center><span class="ezoic-ad ezoic-at-4 medrectangle-2 medrectangle-2100 adtester-container adtester-container-100" data-ez-name="scientificsentence_net-medrectangle-2"><span id="div-gpt-ad-scientificsentence_net-medrectangle-2-0" ezaw="728" ezah="90" style="position:relative;z-index:0;display:inline-block;padding:0;min-height:90px;min-width:728px" class="ezoic-ad"><script data-ezscrex="false" data-cfasync="false" type="text/javascript" style="display:none">if(typeof ez_ad_units != 'undefined'){ez_ad_units.push([[728,90],'scientificsentence_net-medrectangle-2','ezslot_0',100,'0','0'])};if(typeof __ez_fad_position != 'undefined'){__ez_fad_position('div-gpt-ad-scientificsentence_net-medrectangle-2-0')};x