Slr 1 Flashcards

1
Q

Define program

A

A program is a series of statements

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

What are the three programming constructs?

A

Sequence
Selection
Iteration

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

Define sequence

A

Executing one instruction after another

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

Define selection

A

Allows a program to branch and follows a different direction depending on the outcome of a condition
E.g. if statement

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

Define iteration

A

Repeating sections of code
E.g. for loop, while loop, do until

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

Define nesting

A

Process of putting one statement inside another

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

Is for loop condition or count

A

Count controlled loop

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

Is while loop condition or count

A

Condition controlled loop

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

Define variable

A

A value that can change while the program is running. It is a (named) address in memory

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

Define constant

A

Value that remains fixed, as it does not change while the program is running. It must be set when the program is first written

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

Define assignment

A

Supply a value to a variable or constant. Performed with a =

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

Define Subroutine

A

Block of code given a unique, identifiable name within a program

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

Why use subroutines

A

To break down a larger problem into a series of smaller, more manageable problems, making them easier to:
Code
Debug
Reuse

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

Define procedures

A

Are blocks of code that carry out a set task

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

Define function

A

Blocks of code that carry out a set task and returns a value

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

What do procedures do?

A

Carry out a task
Provide structure to code

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

What do functions do?

A

Carry out a task
Returns a value
Create reusable program components

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

Advantages of subroutines

A

Programs are easier to write
Programs are easier to debug
Creates re useable components
Functions can be grouped in a library for easy reuse access across multiple programs
Programs are easier to test

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

Sign for addition

A

+

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

Sign for subtraction

A

-

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

Sign for multiplication

A

*

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

Sign for division (d.p)

A

/

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

Sign for exponential

A

Or **

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

Sign for modulus

A

//

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Sign for equal to
==
26
Sign for not equal to
!=
27
Sign for less than
<
28
Sign for less than or equal to
<=
29
Sign for greater than
>
30
Sign for greater than or equal to
>=
31
Where are Boolean operators used
In Boolean expressions- present in selection and iteration statements
32
What are the Boolean operators.
Not And Or
33
Define string manipulation
Act of manipulating, extracting or changing the characters in a string variable
34
String function
String functions are often built into a programming language to manipulate the string data type
35
What does file handling involve
Opening Closing Reading to Writing from Files by program code
36
Define data dependency
The program requires the items from the text file to be in a specific order
37
Open file for reading
Command takes two parameters -characters- the name of the file to open -r what you want to do with the file
38
Open file for writing
Open command takes two parameters - characters- name of the file to open - a/w- what you want to do with the file (append/ write)
39
What does /n mean
Start a new line
40
Assembly languages
Substituted binary code with simple sequences of letters known as mnemonics. All assembly languages are classified as low level languages. Assembly language is directly translated into binary machine code by an assembler
41
LMC (RAM)
100 memory locations (0-99)
42
LMC (CPU)
An ALU An accumulator to store the results of the last operation or calculation A program counter to store the address of the next instruction in memory An instruction register to hold the first digit of the instruction read from memory An address register to hold the second and third digits of instruction read from memory
43
Assembler (LMC)
Allows us to name addresses- labels
44
Define label
Any word that is not a recognised instruction is assumed to be a label
45
Label before instruction
The LMC defines the label as representing that address
46
Label after instruction
The address is substituted for the label
47
Three parts the LMC code can be
Label Mnemonic Data it applies to
48
What does 0 mean (LMC)
HLT
49
HLT description
Stops the program
50
What does 1 mean (LMC)
ADD
51
What does 2 mean (LMC)
SUB
52
What does 3 mean (LMC)
STA / STO
53
What does 4 mean (LMC)
Unused
54
What does 5 mean (LMC)
LDA
55
What does 6 mean (LMC)
BRA
56
What does 7 mean (LMC)
BRZ
57
What does 8 mean (LMC)
BRP
58
What does 9 mean (LMC)
INP/ OUT
59
Description of ADD
Adds the contents of the memory address to the accumulator
60
Description of SUB
Subtract the contents of the memory address from the accumulator
61
Description of STA/ STO
Store the value currently stored in the accumulator in the memory address
62
Description of 4
The code is unused and gives an error
63
Description of LDA
Load the contents of the memory address into the accumulator
64
Description of BRA
Use the memory address as the address of the next instruction
65
Description of BRZ
Branch to the memory address of the accumulator is zero
66
Description of BRP
Branch to the memory address of the accumulator is zero or positive
67
Description of INP/ OUT
Take from the input if the address is 1; copy to the output if the address is 2
68
Description of DAT
Indicates a location that contains data
69
What does the pc hold?
Only two digits (0-99)
70
What does the accumulator hold
Three digits and a sign (-999 to 999)
71
What does the code do =open(,”r”)
Opens a file for reading
73
What does the code do = open(, “w”)
Opens a file for writing
74
What does the code do = open(, “a”)
Opens a file for appending
76
What does the code do .close()
Closes file
77
What does the code do .upper
Returns the original string in upper case
78
What does the code do .lower
Returns the original string in lower case
79
What does the code do .isupper
Returns true, if all characters are uppercase
80
What does the code do .islower
Returns true, if all characters are lower case
81
Parameter
A parameter is a variable in a function definition. It is a placeholder and hence does not have a concrete value.
82
Argument
An argument is a value passed during function invocation.
83
Global variables
Variables declared outside of the functions have a global scope and can be accessed within and outside of functions.
84
Local variable
Variables declared in a function have a local scope and are therefore specific to the function at that time and cannot be referenced outside of the function unless they are declared as global variables in the function.