2.2.1 programming techniques Flashcards

1
Q

name 3 programming constructs

A

sequence, branching and iteration

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

which 2 categories of loop is iteration split up into?

A

count controlled and condition controlled

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

describe how the branching programming construct works

A

a certain block of code is run is a specific condition is met, using if statements

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

what is recursion?

A

a programming construct in which a subroutine call itself during execution until the stopping condition is met

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

what is the base case in recursion?

A

a condition that must be met in order for the recursion to end

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

state 2 advantages of recursion

A

can be represented in fewer lines of code, easier to express some function recursively that using iteration

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

state a disadvantages of recursion

A

inefficient use of memory, danger of stack overflow, difficult to trace

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

give 2 piece of information that are stored on the call stack

A

parameters, return addresses and local variables

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

define scope

A

the section of the program in which a variable is accessible

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

give 2 advantages of suing local variables over global variables

A

less memory is used, self contained so unaffected bye code outside the subroutine, take precedence over global variables with the same name

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

what is top down designed?

A

a technique used to modularise programs in which the problem is continually broken down into sub problems, until each can be represented as an individual, self contained module which performs a certain task

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

state 2 advantages of a modular design

A

makes a problem easier to understand and approach, simpler to divide task between a team, easier to project manage

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

give another name for top down design

A

stepwise refinement

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

what is the difference between procedures and functions?

A

function must always return a single value while a procedure does not always have to return a value

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

what does it mean to pass a parameter to a subroutine by reference

A

the address in memory of the parameter Is passed to the subroutine so its value outside the subroutine will be updated

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

state 2 features of IDEs

A

stepping, variable watch, breakpoint, source code editor, debugging tools

17
Q

what does IDE stand for?

A

integrated development environment

18
Q

what is encapsulation is object oriented programming?

A

when attributes are declared as private so can only be accessed and edited by public methords

19
Q

describe the purpose of encapsulation in object oriented programming

A

program complexity is reduced by protecting data from being accidentally edited by other parts of the program.