Topic 2 Programming Flashcards Preview

Edexcel GCSE Computer Science 9-1 > Topic 2 Programming > Flashcards

Flashcards in Topic 2 Programming Deck (32):
1

Describe a variable.

A named location in the computers memory to store a single value which can change during the execution of a program. Eg radiusOfCircle

2

Describe a constant.

A named location in the computers memory to store a single value which CANNOT change during the execution of a program. Eg the value of Pi.

3

What is an identifier?

The NAME of a variable, constant, procedure or function.

4

What is meant by assignment?

Setting the specific value of a variable. Eg number = 2 means assign the value 2 to the variable called 'number'.

5

List the arithmetic operators.

+, -, *, /, MOD, DIV, ^

6

Describe the arithmetic operator MOD

Modulus division. Returns the remainder after dividing one number by another. Eg 5 MOD 2 = 1

7

Describe the arithmetic operator DIV

Quotient division. Returns the whole number ignoring any remainder after dividing one number by another. Eg 5 DIV 2 = 2

8

Describe the the arithmetic operator ^

Exponential or power-of. Eg 3^2 = 9 (3 squared)

9

Describe the order or operations in arithmetic operators.

BIDMAS - Brackets, Indices, Division, Multiplication, Addition, Subtraction

10

What are relational operators used for?

To compare different items of data.

11

List/describe the 6 relational operators

= Equal To
<> Not Equal To
< Less Than
> Greater Than
<= Less Then or Equal To
>= Greater Than or Equal To

12

What are logical operators used for?

To combine statements which can be evaluated as TRUE or FALSE.

13

Name the three logical operators.

AND, OR, NOT

14

Describe the AND logical operator

The overall statement is true only if ALL of the individual statements are true.

15

Describe the OR logical operator.

The overall statement is true if ANY of the individual statements are true.

16

Describe the NOT logical operator.

Used to reverse the logical state of other operators.

17

What are the three main programming constructs?

Sequence, Selection & Iteration

18

Describe the sequence construct.

Executing lines of code in the order they are written.

19

Describe the selection construct.

Choosing which lines of code to execute based on a condition being true or false.

20

Describe the iteration construct.

Repeating lines of code either for a set number of times, or while a condition is true.

21

List and describe the five main data types.

Integer - Whole numbers.
Real - Numbers which include fractions/decimals.
Boolean - one of two values - usually True or False.
Character - A single letter, number or symbol.
String - A sequence of characters.

22

What is meant by a 'string literal'?

Characters enclosed in quotation marks.
Eg name = "Billy" - Billy is the string literal.

23

Describe 'string concatenation'.

Joining two strings together.
For example:
fname = "Billy"
sname = "Smith"
fullname = fname + sname (concatenated)

24

Describe an array.

An array is a data structure which can store multiple data items using a single identifier/name. Elements of the array are accessed using an index number which starts from 0.

25

What is a two-dimensional array?

A data structure which uses two index numbers. The array would look like a grid/matrix and elements are accessed using the two indices.
For example array[2,4]

26

What is a sub-procedure or sub-program?

A self contained sequence of program instructions that perform a specific task.

27

Why are sub-programs useful?

- Help with decomposition of a problem
- Make programs shorter as they can be re-used
- Make code easier to read and test
- Can shorten development time

28

What are the two types of sub-program?

-Functions
-Procedures

29

What is the difference between a function and a procedure?

Functions return at least one value to the main program.
Procedures carry out a specific task without returning a value to the main program.

30

What is a parameter?

A value or piece of data passed into a function or procedure (sub-program).

31

What is validation?

Program code which checks that the data input is sensible, reasonable and appropriate.
For example:
In a program where the user was expected to enter a number between 1 and 10, validation would check:
a. A number was entered
b. That number lies between 1 and 10

32

Why is validation important?

Ensures that:
- number of user errors are minimised
- program behaves as expected in spite of user actions