1/36
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is a variable?
A named memory location that holds data that can change during the execution of a program.
Define constant.
Fixed data that during the execution of a program cannot change.
What is assignment?
The process of storing data in a variable or constant under a descriptive name. Example: name = "SME"
What is an operator?
A symbol used to instruct a computer to perform a specific operation on one or more values (e.g. arithmetic, comparison).
State four arithmetic operators.
+, -, *, /, %, //, **, MOD, DIV, ^ (any four)
State two comparison operators.
==, !=,
Define input.
A value that is read from an input device and then processed by a computer program.
True or False? Without inputs, programs are useful.
False. Without inputs, programs are not useful as they can't interact with the outside world and always produce the same result.
What is an output?
A value sent to an output device from a computer program.
Typical output devices include?
Monitor, speaker, printer.
What is a programming construct?
A construct that determines the order in which lines of code are executed and controls the logic and behaviour of code.
The three core programming constructs are?
Sequence, selection, and iteration.
Define sequence.
Lines of code which are run one line at a time in the order they are written from first to last.
What is selection?
When the flow of a program is changed depending on a set of conditions, determining which lines or block of code runs next.
Two ways to write selection statements are?
If…then…else statements and case/switch statements.
Define iteration.
Repeating a line or block of code using a loop.
State two types of iteration.
Count controlled (e.g. for loop) and condition controlled (e.g. while loop).
The keywords indicating selection are?
If, elseif, else, endif, switch, case.
The keywords indicating iteration are?
For, while, do.
If no selection or iteration keywords are present, the construct is?
Sequence.
State the output of 10 MOD(%) 3?
1
State the output of 10 DIV 3?
3
State the output of 2 ^ 3?
8
State the output of 15 % 4?
3
State the output of 10 // 2?
5
True or False? A data type classifies data into groups according to the kind of data they represent.
True.
What is a data type?
A classification of data into groups according to the kind of data they represent.
What is an integer?
A data type used for whole numbers like 10, -5, 0.
What is a real?
A data type used for numbers with a fractional part like 3.14, -2.5, 0.0.
What is a character?
A data type used for single characters like 'a', 'B', '6', '£'.
What is a string?
A data type used for a sequence of characters like "Hello world", "ABC", "@
What is a Boolean?
A data type used for true or false values like True, False.
What is casting?
Converting one data type to another data type.
True or False? Casting changes the data type within a program.
True.
State the Python code to cast an integer to a real. Variable is X.
real_value = float(X)
State the Python code to cast a real to an integer. Variable is X.
int_value = int(X)
State the Python code to cast a Boolean to a string. Variable is X.
str_value = str(X)