answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: How do loops differ from selection structures?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Where do you get loop the loop straws?

C, for loops, while loops, and do while loops are control structures forFor example, the following programs are functionally identical: While loop


What is repetition control structure?

Repetitive control structures are loops like the do while loop and the for loops. They repeat and execute the same set of instruction until the condition stated in the while or for loop ceases to be true. After which it will exit the loop and continue down the program.


Why do you think chromatin loops and nucleosomes are useful structures within a chromosome?

Chromatin loops and nucleosomes are useful structures within a chromosome as they help to store genetic information. This allows for complex codes to be contained within chromosomes.


What does natural selection predict about mimicry camoflauge homologous structures and vestigial structures?

a


How do stuctures in C and C plus plus differ?

Structures in C and C++ differ in that C structures do not have an automatic typdef associated with them.


How do ribosomes differ from other cell structures found in cytoplasm?

how do ribosomes differ from other cell structures found found the cytoplasm?


Three kinds of iteration structures in c?

Iteration structures are also called as loops. The following are the loops available in c. 1. for (initialization; condition; increase/decrese) statement 2. while (expression) statement 3. do statement while (condition)


Find length of the string without using loops and control structures?

length = strlen(string);


What is a embryonic structures?

Embryonic structures are those parts of the embryo of animals. They differ from the structures that are found in term infants.


How do prewriting activities like brainstorming and topic selection differ for individuals and teams?

Answering "How do prewriting activities like brainstorming and topic selection differ for individuals and teams?"


Selection and Repetition Control Structures Prepare a 3 to4 page paper that addresses the following- Selection Control Structures Explain how selection control structures increase the usefulness and?

SELECTION CONTROL STRUCTURES AND THEIR USEA selection control structure is used to make a choice between two or more actions, depending on whether a condition is true or false. This condition is expressed with one of the relational operators like less than, greater than, equal to (,=,,)etc. Adding selection structures makes the program a lot more structured and also gives the programmer a lot of flexibility. There are mainly four different kinds of selection control structures.1. Simple selection2. Simple selection with null false branch3. Combined selection4. Nested selectionLet us go through the control structures one by one relating them to real life examples.1>Simple selection (Simple If statement):Simple selection occurs when a choice is made between two alternate paths, depending on the result of a condition being true or false. The important keywords used are IF, THEN, ELSE and ENDIF.Let us take the example of a city where we want to count the sex ratio. For that we need to calculate the number of males and females. A pseudocode to solve the problem using a simple selection structure would be as followsIF Gender = "M"THENIncrease Male-Count by oneELSEIncrease Female-Count by oneENDIF2. Simple Selection with Null False Branch (null ELSE statement):These kind of selection structures are used when we a task is performed only when a particular condition is true. If the mentioned condition is false, then there is no execution or processing and the IF statement is skipped or bypassed. The ELSEclause is not used. Thus the selection is between executing or bypassing an action. The important keywords used are IF, THEN, ELSE and ENDIF.Let us take an example where we want to count the number of adults in a city. A pseudocode to solve the problem using a simple selection with null false branch would be as followsIF AGE > 18THENIncrease Adult Count by oneENDIF3. Combined Selection(combined IF statement):A combined IFstatement is one that contains multiple conditions, each connected with the logical operators AND or OR.If the connector AND is used to combine two conditions, then both conditions must be true for the combined condition to be true.First let us take an example of combined selection using AND. Say we want to count the number of females above the age of 18.The pseudocode would beIF Age > 18 AND Gender = "F"THENIncrease Female-Adult-Count by oneENDIFIf the connector ORis used to combine two conditions, then only one of the conditions needs to be true for the combined condition to be considered true.Say we want to determine the tickets that can be priced at half rate for children and senior people. The pseudocode would beIF Age < 12 OR Age > 65THENAdd 1 to Half-Price-CountENDIF4. Nested Selection (nested IF statement) A nested selection occurs when the word IF appears more than once within an IFstatement. A nested selection (IF) occurs when either the true of false branch of one If has another IF statement embedded within it.This kind of structure is used when there are multiple conditions to choose from. For example while calculating tax the tax rate varies according to the gross salary.A simple pseudocode to count number of male and female adults will beIF Age > 18IF Gender = "F"THENIncrease Female-Adult-Count by oneELSEIF Gender = "M"THENIncrease Male-Adult-Count by oneENDIFENDIFREPITITION CONTROL STRUCTURES AND THEIR USEThis type of control structures specify a block of one or more statements that are repeatedly executed until a condition is satisfied. These are also called iteration control structures. There are three different ways that a set of instructions can be repeated, and each way is determined by where the decision to repeat is placed:- at the beginning of the loop (leading decision loop)- at the end of the loop (trailing decision loop)- a counted number of times (counted loop)1. Leading Decision Loop:In such loops the testing of the condition is at the beginning of the loop. Examples are DOWHILE loops. The only way to terminate the loop is to render the DO WHILE loop false. Consider a program to sell tickets. The program should sell tickets while there are tickets available. In such types of loops Leading Decision loops can be used to sell tickets until tickets are 0 which can be used as the termination statement.2. Trailing Decision Loop:In such structures the testing of condition is done at end of loop except that the logic to keep on repeating is same as in case of other repetition structures. REPEAT&hellip;UNTIL is an example of trailing decision loop. In trailing loops the statements are executed at least once before the condition is tested. These loops are sued in almost all kinds of computer program for e.g to print student records, to continue taking input until a certain limit, etc.3. Counted Loop:These are also known as DO or FOR loops. In such kind of repetition structures the programmer knows in advance the exact number of loop iterations. The loop execution is controlled by an important variable called the loop index. Say a programmer wants to input the salary record for 20 individuals. He will give the counted loops a high priority because he knows hp many times he wants to repeats the loop.Finally we can conclude that selection control structures and repetition control structures find their use in almost any application. Using them wisely and judiciously depends on the person who is going to use these loops. Proper implementation of loop structures can reduce program complexity and cost a lot.


What looping structures are there in JavaScript?

Loops in Java Script are:for - loops through a block of code a specified number of timeswhile - loops through a block of code while a specified condition is truedo...while - also loops through a block of code while a specified condition is truefor...in - loops through the properties of an objectFor more information, visit the Related Link.