1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What are the requirements of a well written algorithm
it should be free of logic errors
It should be easy to code in any high-level language
define execution
the process by which a computer carries out the instructions of a computer program
What are some uses of variables
controlling the number of times a loop is executed
determining which branch of an IF statement is taken
keeping running totals
holding user input
Do you need to specify data types of variables?
It is not necessary in pseudocode, however data types become much more important in high level language programming as the data type of a variable determines the operations that can be performed on it.
what is type coercion
the process of converting the value stored in a variable from one data type to another (implicitly)
Type coercion is when the data type of a variable changes during program execution (implicit so it happens automatically e.g if an integer and real value are used in a calculation the resulting value will be a real value)
what is type casting
the process of converting the value stored in a variable from one data type to another (explicitly)
Type casting is when the data type of a variable is converted during program execution (explicit so the user needs to state e.g may = int(x))
define initialize
to set variables to their starting values at the beginning of a program or subprogram
assignment statement
the command/ statement used to change the value of a variable that has been initialized
it is also the SET … TO command used to initialize variables in pseudocode
assignment statement
the command/ statement used to change the value of a variable that has been initialized
it is also the SET … TO command used to initialize variables in pseudocode
What does a variable (such as a loop counter) that is intended to hold a running total need to be in order to use it?
the variable should always be initialized to a starting values (e.g 0)
some programming languages won’t execute if the programmer fails to do this
others may execute but may well produce some unexpected results (logic error)
selection
a construct that allows a choice to be made between different alternatives
used to create a branch in a program
the computer selects which branch to follow based on the outcome of a condition
define nested IF statement
a nested IF statement consists of one or more IF statements placed inside each other. A nested IF statement is used when there are more than two possible courses of action
for Pearson edexcel pseudocode, when creating nested IF statements, you have to ensure that each one is completed with an END IF at the correct indentation level
what is order of precedence for logical operators ?
AND
NOT
OR
define relational operator
an operator that tests the relationship between two entities
define logical operator
a Boolean operator using AND, OR and NOT
definite iteration
when the number of iterations is known in advance
using a for loop (python + pseudocode) and repeat loop
nested loop
a loop within a loop
each iteration of the outer loop causes the inner loop to be executed until completion
indefinite iteration
when the number of iterations is not known in advance
repeated until specific condition is met
while loop (python) repeat until (pseudocode)
Random numbers
used to make an event random
python has a random module
(Import random
random has 3 different forms:
what happens when a variable is initialized
When a variable is declared, the computer gives it a location in its memory. Initially this location is empty so before a variable can be used, it has to be given a value