ORDER 1
 
Custom «Selection Control Structures» Essay Paper

Custom «Selection Control Structures» Essay Paper

In computer programming, selection control structures are decision mechanism that allows a certain statement to be executed both when the condition is true or false. This decision structure takes the “If-Then-Else” format (Dale &Weems, 2010).

Upon execution of any of true or false set of actions, the program execution resumes the following statement.

The general selection control structure pseudo code takes the following general structure;

If <conditional expression 1, control expression 2……….n>

Then < Statements to be executed if conditional expressions are true>

Else < Statements to be executed if conditional expressions are false>

End if

When the conditional expressions are true then the statements enclosed inside the “Then and Else” will be executed. After that, the program execution will not go through the remaining sets of statement enclosed inside the “Else and End if”. On the other hand, if the conditional expressions are false the first set of statements between “Then….Else” is not executed but the program control proceeds to the statements between the “Else….End If” where execution takes place. After these all execution, the program proceeds to the statements appearing after the “End If” (Dale &Weems, 2009).

 

Currency
Number of pages

Example,

If < the number is less than 100>

Then < Accept >

Else  < Deny>

End if

Selection control structures can be laid out to specify the statement to be executed depending on the condition. This means the program will only execute either true or false but not all in turns. For example if you to specify the execution to be performed only if the condition is through then:

If <set of true conditional expressions>

Then <Statements to be executed>

To represent above in a flow-chart then (Conger, 2002).

There four common categories of selection control structures namely; simple selection, simple selection having null false branch, nested selection and combine selection. The distinction here comes from the number of alternatives, and branching initiation. Simple selection also referred to as simple if statement. (Flanagan, 2006). This is a selection done on two possible paths basing on whether the condition is true or false. The simple selection is illustrated below as a simple “If….Then” format;

Limited Time offer!

Get 19% OFF

0
0
days
:
0
0
hours
:
0
0
minutes
:
0
0
seconds
 
Code:

If < conditional expression>

Then < Set of statements executed>

Else < Set of alternative statements>

End if

For a real world example; consider a program making bank deposits. Where two accounts; A and B can be updated by depositing some amount. For this case if the amount to be deposited is less than $1,000 then deposit are made to A else B if the sum is greater than $ 1,000. Then the simple selection will be as follows;

If < Deposit, d, is =< $1,000>

Then < Make deposit on account A>

Else <Make deposit on account B>

End if

The second type of selection control structures is; simple selection having Null False Branch. This selection is also known as null else statement. It is executed only when certain conditional statement is true. If condition required is true then execution takes place, but if it is false, then the whole If statement is jumped. In this selection, the keyword “Else” is not used since execution only takes place following the truth of the conditional phrase and does not proceed to option for the “ False ”. Therefore, the statement seems to have only two choices; execution and bypassing which can not be done on the same case. A pseudo code to demonstrate null else statement is represented as follows.

We Provide 24/7 Support

Have you got any questions?

Start Live chat

If <conditional expression>

Then < Statement to be executed>

End if

As an example in real life situations; consider an application updating a particular database. The condition for data entry is only the validity of the data.

If < Data=valid >

Then < Input appropriately >

End if

In general, the simple selection control structure with null false branch takes the format; “If….Then, with False considerations”.

The third category of selection control structures is combined selection. This is a selection which is a combination of several If Statements where each one is connected by the following logical operators i.e. OR or AND. The AND operator is used for combining 2 conditions which should also be true must be true if the combined condition should be true. The pseudo code for this selection takes the following format.

If <conditional expression X AND Y>

Then <Two actions performed (statement execution)>

End if

On the other hand, the OR operator is used when combining two condition such that only one is required be true for the combined condition to be true also. Its pseudo code takes the following format;

Benefit from Our Service: Save 25%
Along with the first order offer - 15% discount, you save extra 10% since we provide 300 words/page instead of 275 words/page

Help

If <two alternate conditional expressions>

Then <One combined statement to be executed>

Consider the example below showing simple life experience application. This aims at executing a statement provided any one of the condition is true.

If < password or user ID is wrong>

Then <Deny log in>

The fourth and the last category of selection structure is the nested selection, also referred to nested If statement. This applies when the phrase IF is used more than once within a single IF statement. In this selection structure, the true or false branch of an If statement has another If statement incorporated within it. The relevance of this selection is when there several conditions to select from. The pseudo code takes this format;

IF <conditional expression W>

IF <conditional expression X>

End if

THEN <Statements executed simultaneously based on W and X>

ELSEIF<conditional expression Z>

THEN <Execution based on W and Z>

The following is a feasible example

IF < Age =55>

IF Gender=female

THEN <Output retired-female>

ELSEIF Gender=male

THEN <Output retired-male>

ENDIF

ENDIF

Selection control structures increases the usefulness and power of a computer program by making it structured and giving programmer a lot of flexibility. Selection control structures controls execution of a program. It increases the usefulness and power of a computer program by making it structured and giving programmer a lot of flexibility. These structure provide program efficiency especially the “null else statement which provides a program simple execution”. Program will skip the false statement (Cabrera, 2002).  In summary of this concept; the program doesn’t execute the “dead” and “unreachable codes”. This makes the compile time and run time to be minimal hence the response time is greatly improved. The programmer doesn’t also need to make separated coding but can use one code to serve the entire statements. This evidenced in both combined and nested If statements.

VIP Services

Get
extended REVISION

2.00 USD

Get
SMS NOTIFICATIONS

3.00 USD

Get an order
Proofread by editor

3.99 USD

Get an order prepared
by Top 30 writers

4.80 USD
5.99 USD

Get a full
PDF plagiarism report

9.99 USD

Get
VIP Support

VIP SERVICES
PACKAGE 23.82 USD20% off

VIP SERVICES
PACKAGE 23.82 USD

These control structures also improves computer utility by proving ways of utilizing technology. For example, branching makes computer respond to both maskable and non-maskable interrupts. These statements can be incorporated in a program to facilitate such branching. Computer’s memory can be utilized by combining long codes into a simple selection control pseudo code (Buono, 2003).

As a hypothetical real-world application example, consider the following case; in solving mathematical problems especially a fraction. In multiplying two mixed fractions; apply selection control structures as follow; using null else statements, work only on mixed fractions and change them into simple fractions, using combined if statements multiply new whole value by resulting denominator. On adding the numerator to resulting product of the whole number to the denominator, sum is made the new numerator of the resulting improper fraction. Using nested if statements check on the result in the improper fraction and multiply numerator and denominator. To obtain the final result, use combined If statement to multiply the denominator by the denominator in the resulting improper fraction.

Do you need professionally written papers?

Place your order on our website to get help from qualified experts!

 
Your request should consist of 5 char min.
Now Accepting Apple Pay!

Ensure Your Academic Success with Our Verified Work Report Service

Try it now
x
Online - please click here to chat