1.2.3 Introduction To Programming Flashcards
What are the three main programming constructs
used in procedural programming?
- Sequence
- Selection
- Iteration
How does assembly language differ from
machine code?
Assembly language uses mnemonics
rather than binary. One line in assembly
language is equal to one line in machine
code.
What is the function of the STA mnemonic?
Storing the value in the Accumulator at
the given memory address.
What is the function of the BRP
mnemonic?
Branches to a given address if the value
in the Accumulator is positive. It is a
conditional branch.
Describe how selection works
A certain block of code is run if a specific
condition is met, using IF, ELSE IF and
ELSE statements.
How do variables and constants differ?
The value of a constant cannot be edited
by the program during execution while
the contents of a variable can be
changed.
When might constants be used?
For values that do not need to be
changed or to prevent a value from being
accidentally changed.
Define what is meant by a function
A named block of code that performs a
specific task and must always return a
single value.
What is the role of the MOD function?
MOD (or %) is used to find the remainder
when a number is divided by another.
What is the result of 16 DIV 5?
3
What are relational operators used for?
Relational operators are used to make
comparisons between two values and
produce a result of either True or False
What is the function of the == operator?
== is used to check whether a value is
identical to another.
Give three Boolean operators
AND, OR and NOT.
State the result of the following
section of code:
text = ‘computer science’
text.substring(10,3)
cie
What is the pseudocode used to open a
file named ‘compsci.txt’ and write
‘computer science’ to it?
myFile = openWrite(“compsci.txt”)
myFile.writeLine(“computer science”)
myFile.close()