Unit 11 - Programming Techniques Flashcards

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

define iteration

A

a sequence of instructions is repeated multiple times

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

examples of iteration

A
  • for loop
  • do…until
  • while
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

difference between do…until and while loops

A
  • while loop condition is tested at the start
  • do..until condition is tested at the end. therefore code is always run at least once
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

define selection

A

changing the flow of the program

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

selection commands in LMC

A

BRA
BRZ
BRP

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

define IDE

A

Integrated Development Environment - software which enables you to enter, edit, compile (or interpret) and run your programs. many IDEs have debugging facilities to help you find the logic errors in a program

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

features of IDEs for code writing

A
  • line numbers
  • automatically indent code
  • auto-complete commands
  • comment or un-comment a region
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

features of IDEs for debugging

A
  • set a breakpoint in the program which will cause the program to stop on that line
  • set a watch on a variable so that its value is displayed each time it changes
  • step through a program one line at a time
  • trace the execution of the program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

define identifier

A

name that points to the memory location

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

define assignment

A

assigning a value to a memory location

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

define variable

A

a named location in memory where data can be stored and that can be changed throughout the program

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

define constant

A

cannot be the target of an assignment as you have to change the source code and then recompile. reduce the risk of errors by reducing access to the memory location

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

define subroutine

A

a set of instructions with a name that when called changes the sequence of a program

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

difference between procedures and functions

A
  • a function returns a value
  • call statement differs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

define parameters

A

appear in subroutine definitions and remain the same

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

define arguments

A

may change because they appear in subroutine calls

17
Q

passing by reference(value)

A

the address of the argument calling the statement is passed to the corresponding parameter in the subroutine. any calculation performed on that parameter in the subroutine will change the value of the corresponding argument in the calling routine

18
Q

define global variables

A

defined in the main program and can be re-used in subroutines

19
Q

advantages of local variables

A
  • subroutine will be independent of a particular program and can be re-used in different programs
  • there is no chance of accidentally changing a variable in the main program that is used in a subroutine or vice versa
  • subroutine is self-contained
  • uses less memory
20
Q

define modular programming

A
  • means breaking down a major task into smaller subtasks
  • these subtasks may be further broken down until each ‘module’ performs a single function
21
Q

advantages of modular programming

A

programs are more quickly and easily written:
- large programs are broken down into subtasks that are easier to program and manage
- each module is individually tested
- modules can be re-used several times in a program
- large programs are much easier to debug and maintain

22
Q

characteristics of recursion routines

A
  • a stopping condition or base case must be included which when met means that the routine will not call itself and start to ‘unwind’
  • for input values other than the stopping condition, the routine must call itself
  • the stopping condition must be reached after a finite number of calls
23
Q

use of call stack

A
  • every time a subroutine is called, the return address is put on the call stack
  • even with a stopping condition, the recursive routine can only be called a limited number of times or the stack will overflow with the maximum memory capacity