Computational Constructs Flashcards Preview

Higher Computing (SDD) > Computational Constructs > Flashcards

Flashcards in Computational Constructs Deck (20):
1

How is code modularity improved?

Keeping sub-programs as self contained as possible so they can be tested independently

2

What is the scope of a variable?

the part / parts of the program where a variable can be used - eg local variables only exist within the sub program they are defined inside

3

Why are global variables best avoided when possible?

They have global scope so can be accessed anywhere throughout the program. So their values can be altered unintentionally to bad effect

4

What are sub-programs defined and called with?

Defined with formal parameters
Called with actual parameters

5

What is a computational construct?

A combination of control structures which can be used to make solving programming programs more intuitive

6

The scope of a variable describes...

Where it can be accessed from

7

What is meant by variable declaration?

When a variable is created in a program

8

What is a user defined function?

A sub-program written by the programmer which returns a value

9

What is a method in an object-oriented language?

A function which is defined inside a class and can only be used in relation to an object of that class

10

Parameters can be passed by....name and define both terms

Value: Parameters which are not changed when passed into a procedure (a local copy of the actual parameter is made and used inside the subroutine)
Reference: Parameters which may be changed by the procedure they are passed into

11

What is unique about a sequential file compared to other input and output devices?

Treated in the same way but they have specific commands for opening and closing

12

Function use

A category of sub program which will always return a single value to another part of the program

13

Scope of a local variable

The sub program where it has been created

14

Where are actual parameters listed?

On the call line used to activate a sub program

15

Why is it unnecessary to use the same identifier (name) for related actual and formal parameters?

Most software development environments link parameters based on the order in which they are listed rather than their names
Allows for procedures/functions to be called several times with different values being passed in on each occasion

16

How is an array usually passed and why?

By reference because passing an array by value would create too many copies which would place a large demand on RAM

17

Pre-Defined Function

Already defined by the high level language, examples:random, round

18

Call

Executes a sub-program from another part of a larger program

19

What is necessary when listing formal parameters in the declaration/definition of a sub program?

The data type so that the sub-program can expect a type of data for the parameter to use

20

Data Flow

The way in which data flows from one part of the program into another, e.g. from the main program into / back from a subroutine