Selection In Programming | Types & Importance
Maybe your like
KS3 Computer Science
11-14 Years Old
48 modules covering EVERY Computer Science topic needed for KS3 level.
View KS3 Resources →GCSE Computer Science
14-16 Years Old
45 modules covering EVERY Computer Science topic needed for GCSE level.
View GCSE Resources →A-Level Computer Science
16-18 Years Old
66 modules covering EVERY Computer Science topic needed for A-Level.
View A-Level Resources →Home / Programming / Selection In Programming
KS3 Programming: Selection Resources (14-16 years)
- An editable PowerPoint lesson presentation
- Editable revision handouts
- A glossary which covers the key terminologies of the module
- Topic mindmaps for visualising the key concepts
- Printable flashcards to help students engage active recall and confidence-based repetition
- A quiz with accompanying answer key to test knowledge and understanding of the module
A-Level Introduction to programming (16-18 years)
- An editable PowerPoint lesson presentation
- Editable revision handouts
- A glossary which covers the key terminologies of the module
- Topic mindmaps for visualising the key concepts
- Printable flashcards to help students engage active recall and confidence-based repetition
- A quiz with accompanying answer key to test knowledge and understanding of the module
A selection in programming is used to make choices depending on the information. An algorithm can be made smarter by using IF, THEN, and ELSE functions to reiterate instructions, or to move the process in question to different parts of the program.
Selection is also called a decision. It is one of the three basic logic assemblies in computer programming. The other two logic assemblies are sequence and loop.
In the assembly of a selection, a question is asked, and based on the answer the program takes one of two paths of action, after which the program moves on to the next event.
This assembly is sometimes referred to as an IF-THEN-ELSE procedure because it leads the program to act in the following way: IF Condition A is True, THEN carry out Action A, ELSE carry out Action Y.
All logic problems in programming can be resolved by launching algorithms using only the three logic assemblies, and they can be merged in an infinite number of ways. The more intricate the computing requirement, the more intricate the combination of structures required to meet the relevant needs.
Importance of Selection in Programming
Selections enable including more than one route in a program. Many solutions require multiple choices or decisions, and these choices result in various possible routes which the program can take. These routes signify the outcome of making a choice. Without selection it would not be possible to contain diverse routes in programs, and the solutions we come up with would not be realistic.
Programming
Once an algorithm has been planned and finalized, it must be translated into a code that a computer can understand.
We make programs to execute algorithms. Algorithms have steps, while programs have statements.
IF Statement
Programs consist of a set of instructions that are executed one after another. Sometimes there may be more than one route that can be followed: at this point, a decision needs to be completed. This decision is referred to as a selection.
For example, the following algorithm displays a message depending on your age:
- Ask your age
- IF your age is 60 or older, say “You are a senior citizen!”
The selection comes in step 2. If you are aged 60 or older, one message is displayed.
In programming, a selection is implemented using an IF statement.
IF-ELSE Statements
In programming, selections are usually denoted by the statements: IF and ELSE.
- IF denotes the question
- ELSE leads to a given action if the answer to the question is false
For example, this simple algorithm prints out a different message depending on how old you are. Using IF and ELSE, the steps are as follows:
- Ask your age
- IF your age is 60 or older, say “You are a senior citizen!”
- ELSE say “You’re not a senior citizen yet!”
If this algorithm is tried using 65 as your age, the answer to the question at step 2 is true, so the algorithm tells us to say, “You are a senior citizen!”
If the algorithm is tried using 15 as your age, the answer to the question at step 2 is false, so the algorithm tells us to say, “You are not yet a senior citizen!”
IF-ELSE IF-ELSE Statements
Using IF and ELSE gives two possible choices or routes that a program can follow. However, sometimes more than two choices are wanted. To accommodate this, the statement ELSE IF is used.
This simple algorithm prints out a different message depending on how old you are. Using IF, ELSE and ELSE IF, the steps are:
- Ask your age
- IF your age is 60 or older, say “You are a senior citizen!”
- ELSE IF you are exactly 50, say “Wow, you are in your prime!”
- ELSE say “You’re not a senior citizen yet!”
When using an IF-ELSE IF statement, the program will stop inspecting as soon as it receives a positive answer. Therefore, it is imperative to include the IF and ELSE conditions in the correct sequence, in order to make the program as logical as possible.
Further Readings:
- Selection algorithm
- Selection (user interface)
About this site
Teach Computer Science provides detailed and comprehensive teaching resources for the new 9-1 GCSE specification, KS3 & A-Level. Equally suitable for International teachers and students.
Over 5,000 teachers have signed up to use our materials in their classroom.
Search for:What do we provide?
In short: everything you need to teach GCSE, KS3 & A-Level Computer Science:
- Condensed revision notes
- Exam question booklets
- Mind maps
- Interactive quizzes
- PowerPoint presentations
- Flashcards
Exam boards
Our materials cover both UK and international exam board specifications:
- AQA
- CIE
- Edexcel
- OCR
- Eduqas
- WJEC
- National 5
Tag » What Is Selection In Computer Science
-
Selection - AQA - GCSE Computer Science Revision - BBC Bitesize
-
Selection In Programming - KS3 Computer Science Revision - BBC
-
Selection - Computer Science GCSE GURU
-
[PDF] Selection In Programming
-
What Is Selection In Programming? - Quora
-
Selection - Isaac Computer Science
-
What Is Selection In Programming? - FutureLearn
-
What Is Selection? - Webopedia
-
Selection - Bits Of
-
Selection Strategy - Computer Science Wiki
-
Computer Science: Sequences, Selections, And Loops - GCFGlobal
-
5 Minutes To Code: Programming Basics "Selection" - YouTube
-
Selection Algorithm - Wikipedia