TMA02 Flashcards
(34 cards)
What are mutually exclusive conditions?
Only one condition can be true or satisfied at any time
If one condition is true, all others must be false.
What is the outcome of mutually exclusive conditions?
Only one of the conditions will report true.
What does checking code by inspection involve?
Assessing whether a script works, just by looking at it and thinking about it.
What is selection (branching) in programming?
When the actions to be taken depend on conditions.
Name two types of selection blocks.
- if
- if-else
What are Boolean blocks in programming?
Condition blocks where action is taken if the condition holds (true/false).
What do comparison blocks do?
Compare conditions.
Define sequencing in programming.
A program’s instructions are executed in the order they are written, unless modified by control structures.
What happens after a selection block is executed?
Sequential execution resumes with the next instruction.
What is repetition in programming?
An instruction that directs a set of instructions to run repeatedly.
Repetition can occur under which two conditions?
- A fixed number of times
- Indefinitely (or until some condition holds)
Fill in the blank: Selection allows a program to choose whether to execute a specific set of instructions based on whether a given condition is _______.
[true or false]
What does precedence refer to in programming?
The order in which operations within a calculation are carried out
Precedence is essential for determining how expressions are evaluated in programming languages.
What is nesting in programming?
Placing one programming construct inside another of the same or different type
Nesting allows for more complex operations and control structures in code.
What does BIDMAS stand for?
Bracket-Indices (powers)-Division-Multiplication-Addition-Subtraction
BIDMAS is a mnemonic to remember the order of operations in mathematics and programming.
Define constants in programming.
Represent unchanging data
Constants are values that do not change during the execution of a program.
What is incremental construction?
The idea of constructing data in stages
This approach allows for gradual development and modification of data structures.
What is a data structure?
List with a collection of data
Data structures organize and store data efficiently for processing.
What does persistent data refer to?
A list of data that remains when a program is shut down and run again
Persistent data is crucial for applications that require data retention between sessions.
Fill in the blank: _______ refers to the order in which operations within a calculation are carried out.
[key learning term: Precedence]
True or False: Nesting can only occur with similar types of programming constructs.
False
Nesting can occur with constructs of different types, allowing for versatile programming.
What are lists in programming?
Lists are important components of programming languages that allow a collection of data to be stored together.
Lists can hold various data types and are used for organizing data efficiently.
What are parallel lists?
Parallel lists are lists such that each item in one list is related in some way to the item in the same position in the other list.
This structure is often used to manage related data, such as names and corresponding ages.
What is the purpose of a sentinel value in programming?
A sentinel value is used to stop loops and is particularly useful in handling an unknown number of user inputs.
Sentinels help prevent infinite loops by providing a clear exit condition.