1.2.3 Introduction To Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What are the three main programming constructs
used in procedural programming?

A
  • Sequence
  • Selection
  • Iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does assembly language differ from
machine code?

A

Assembly language uses mnemonics
rather than binary. One line in assembly
language is equal to one line in machine
code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the function of the STA mnemonic?

A

Storing the value in the Accumulator at
the given memory address.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the function of the BRP
mnemonic?

A

Branches to a given address if the value
in the Accumulator is positive. It is a
conditional branch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Describe how selection works

A

A certain block of code is run if a specific
condition is met, using IF, ELSE IF and
ELSE statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do variables and constants differ?

A

The value of a constant cannot be edited
by the program during execution while
the contents of a variable can be
changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When might constants be used?

A

For values that do not need to be
changed or to prevent a value from being
accidentally changed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define what is meant by a function

A

A named block of code that performs a
specific task and must always return a
single value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the role of the MOD function?

A

MOD (or %) is used to find the remainder
when a number is divided by another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the result of 16 DIV 5?

A

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are relational operators used for?

A

Relational operators are used to make
comparisons between two values and
produce a result of either True or False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the function of the == operator?

A

== is used to check whether a value is
identical to another.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Give three Boolean operators

A

AND, OR and NOT.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

State the result of the following
section of code:
text = ‘computer science’
text.substring(10,3)

A

cie

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the pseudocode used to open a
file named ‘compsci.txt’ and write
‘computer science’ to it?

A

myFile = openWrite(“compsci.txt”)
myFile.writeLine(“computer science”)
myFile.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

State the function of the following
piece of code:
6**4

A

Raises 6 to the power of 4.

17
Q

What programming structure is used
when a certain section of code needs to
be executed while a certain condition
remains true?

A

Iteration - specifically a WHILE loop.