Chapter 8 Programming: Unit 8.1: Programming concepts Flashcards

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

What are the 5 basic constructs to use and understand when developing a program?

A

Data use - variables, constants and arrays
Sequence - Order of steps in a task
Selection - Choosing a path through a program
Iteration - Repetition of a sequence of steps in a program
Operator use - Arithmetic for calculations, logical and Boolean for decisions

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

Define variable

A

Named data store that contains a value that may change during the execution of a program

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

Define constant

A

Named data store that contains a value that does not change during the execution of a program

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

What are the 5 basic data types?

A

Integer - A positive or negative whole number that can be used with mathematical operators
Real - A positive or negative number with a fractional part. Real numbers can be used with mathematical operators
Char - A variable or constant that is a single character
String - A variable or constant that is several characters in length. Strings vary in length and may even have no characters. The characters cam be letters and/or digits and/or any other printable symbol
Boolean - A variable or constant that can have only two values TRUE or FALSE.

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

What are the 6 basic concepts?

A

Sequence
Selection
Iteration
Counting and totalling
String handling
Use of operators (arithmetic, logical, boolean)

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

Define procedure

A

Set of programming statements grouped together under a single name that can be called to perform a task at any point in a program.

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

Define function

A

Set of programming statements grouped together under a single name that can be called to perform a task at any point in a program. In contrast to a procedure, a function will return a value back to the main program.

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

Define parameters

A

The variables that store the values of the arguments passed to a procedure or function. Some but not all procedures and functions will have parameters.

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

Define global variable

A

Can be used in any part of a program - its scope covers the whole program

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

Define local variable

A

Can only be used by a part of the program it has been declared in - its scope is restricted to that part of the program.

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

What are the 4 library routines?

A

MOD - returns the remainder of a division
DIV - returns the quotient, i.e. the whole number part, of a division
ROUND - returns a value rounded to a given number of decimal places
RANDOM - returns a random number

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

What are the 3 things that a maintainable program should have?

A
  1. Always use meaningful identifier names for:
    Variables
    Constants
    Arrays
    Procedures
    Functions
  2. Be divided into modules for each task using
    Procedures
    Functions
  3. Be fully commented using the programming language’s commenting feature.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly