2.2.1 Programming Techniques(uncomplete) Flashcards

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

Name 3 programming constructs

A

-sequence
-selection
-iteration

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

which two categories of loop is iteration split into

A

-count controlled loop
-condition controlled loop

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

describe how the branching programming construct work

A

A certain block of code is run if 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 calls on itself during its 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 two advantages of recursion

A
  • can be represented in fewer lines of code
    -Easier to express some functions recursively than using iteration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

state a disadvantage of recursion

A

-inefficient use of memory

-danger of stack overflow from it calling itself repeatedly which would cause the call stack to run out of memory this would cause the program to crash

-difficult to trace

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

give two pieces of information that are stored on the call stack

A

-parameters
-return addresses
-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 two advantages of using local variables over global variables

A

-less memory is used
-self contained so unaffected by code outside of the subroutine
- take procedure 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 design

A

A technique used to modularize programs in which the problem is continually broken down into sub problems, until each can be represented as an individual, self-contained module which can preforms a certain tasks

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

state two advantages of a modular design

A

-makes a problem easier to understand and approach
-simpler to divide tasks between a team
-easier to manage project
-self contained modules simplify testing and maintenance
-greater reusability

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

what is the difference between procedures and functions

A

Functions must always return a 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
14
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 of the subroutine will be updated

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

state 2 features of an IDE

A

-stepping
-variable watch
-breakpoint
-source code editors
-debugging tools

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

what does IDE stand for

A

integrated development environment

17
Q

What is a local variable

A

Local variables have limited scope which means that they can only be accessed within the subroutine in which they were defined.
Therefore, multiple local variables with the same name can exist in different subroutines.

18
Q

Advantage to local variables

A

Using local variables is considered to be good programming practice because it ensures subroutines are self-contained, with no danger of variables being affected by code outside of the
suoroutine.

19
Q

What is a global variable

A

Global variables, on the other hand, can be accessed across the whole program.
These are useful for values that need to be used by multiple parts of the program

20
Q

Disadvantage to global variables

A

using global variables is not recommended because they can be unintentionally overwritten. As global variables are not deleted until the program terminates, they require more memory than local variables which are deleted once the subroutine has been completed.

21
Q

Modular programming

A

Modular programming is a technique used to split large, complex programs into smaller, self-contained modules. A modular design also makes it easier to divide tasks between a team and manage projects, whilst simplifying the process of testing and maintenance, as each component can be dealt with individually. This improves the reusability of components, as once a module has been tested, it can be reused
with contidence

22
Q

What is a parmeter

A

A parameter is a variable used in a subroutine to receive input data from the calling code

23
Q

Stepping IDE

A

This allows you to monitor the effect of each individual line of code by executing a single line at a time

24
Q

Variable watch IDE

A

This allows users to observe how the contents of a variable change in real-time

25
Q

Breakpoint IDE

A

IDEs allow users to set a point in the program at which the program will stop

26
Q

Source code editor IDE

A

The editor provides features such as autocompletion of words, indentation, syntax highlighting and automatic bracket completion.

27
Q

Debugging tools IDE

A

Some IDEs also provide run-time detection of errors with a guide as to where in the code they are likely to have occurred.