Data Types, Data Structures, Scope And Parameters Flashcards

1
Q

What is a record?

A

A collection of data stored for one item, person or event. A record may contain data items of different data types

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

What is a sequential file?

A

Data may be read from or written to external files. Data items are read/written in sequence. This is useful if the data is to be kept after program execution.

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

What is a subroutine?

A

A block of code that has been separated from the main program, they usually perform a single task or action. The subroutine is called by another part of the program when required, the lines in the subroutine are then executed and the program continues from the call command.

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

What is modular programming?

A

Aims to split a program into as many self-contained subroutines as possible. Modularity improves the maintainability of a program as it is possible to re write a single module without changes impacting on the rest of the program.

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

What is the scope of a variable?

A

The area of a program in which the variable can be used. A variable may be declared as either global - has global scope - so can be used at any point in the code, - or local . A local variable can only be used - has scope - inside the subprogram where it is defined.

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

What is an advantage of a local variable?

A

The value of a local variable can only be altered within the one part of the program in which it exists - has scope - usually a subroutine.

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

Describe the difference between a data type and a data structure

A

A data type is used to store a single variable. A data structure is used to store multiple items of data.

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

What is an array?

A

A type of data structure with numbered elements, each of element stores an item of the same data type

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

What is a procedure?

A

A subroutine which performs a task that is contained completely within its code.

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

What is a method?

A

A subroutine used in object-oriented programming that defines the behaviour of an object.

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

What is a function?

A

A subroutine with code that calculates a value which it returns to the main program.

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

What does passing a parameter by value mean?

A

If a variable is passed by value, a copy of the data is made within the subroutine. Any changes made to the passed data do not affect the original data.

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

What does parameter passing by reference mean?

A

If a variable is passed by reference, the original data is used inside the subroutine - no copy is made. So the global / passed value gets modified within the subroutine.

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

What is a formal parameter?

A

This refers to the variable name used on the subroutine definition line. Formal parameters only have a value when the subroutine is called. Example: procedure calc_wages hours rate

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

What is an actual parameter?

A

This refers to the actual data values that are passed into the subroutine at run time, when the subroutine is called e.g. calc_wages 40 7.50

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

What is the difference between a fixed loop and a conditional loop?

A

A fixed loop goes around a program a set number of times where as a conditional loop goes around until certain criteria are met.

16
Q

Concatenation

A

When two or more strings/substrings are joined

17
Q

What is a user defined function?

A

A user defined function is a function provided by the user to perform a specific task in order to generate a value.

18
Q

Value held by Boolean data types

A

A true or false value

19
Q

How is each element in a 1-D array identified?

A

An index value

20
Q

Sequential File

A

A file that holds data in a set order

Can be opened, closed, read from or written to

21
Q

What file operation is triggered if a non existent file name is opened?

A

Create

22
Q

Assignment

A

Giving a value to a variable

23
Q

What is meant by initialising a variable?

A

Assigning a starting value before the variable data is used or accessed

25
Q

Records in software

A

A user defined data type which can store a group of data items of different types

25
Q

Integers used to store

A

Positive or negative whole numbers

26
Q

Strings used to store

A

one or more text characters

27
Q

Real numbers used to store

A

Positive and negative whole numbers with decimal places

28
Q

Boolean used to store

A

A true or false value

29
Q

Why are data types declared before they are used?

A

Ensures that the required amount of memory is allocated to each variable during the programs execution

31
Q

Data Structure

A

Used to store multiple items of data together

32
Q

Array

A

Consists of numbered elements (storage locations)
Each of these stores an item of the same data type
Elements commonly accessed one at a time using repetition (a loop)
An array can be passed as a parameter